GNU bug report logs - #68745
[PATCH] 30.0.50; calc can't parse matrices with trailing newlines

Previous Next

Package: emacs;

Reported by: Paul Nelson <ultrono <at> gmail.com>

Date: Fri, 26 Jan 2024 22:53:01 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 68745 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#68745; Package emacs. (Fri, 26 Jan 2024 22:53:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Nelson <ultrono <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 26 Jan 2024 22:53:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Paul Nelson <ultrono <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] 30.0.50; calc can't parse matrices with trailing newlines
Date: Fri, 26 Jan 2024 23:51:38 +0100
[Message part 1 (text/plain, inline)]
calc reports an error when parsing (e.g., via C-x * g) latex matrix
environments with trailing newlines.

Steps to reproduce (all with emacs -Q): use "C-x * * d L" to start
calc and set the language mode to latex, then (math-read-expr
"\\begin{pmatrix} a & b \\\\ c & d \\\\ \\end{pmatrix}") gives an
error.

The core issue has nothing to do with latex: use "C-x * * d N" to
reset the language mode to normal, then (math-read-expr
"[[a,b],[c,d],]") gives an error.

I would like to propose that it should instead return the same as
(math-read-expr "[[a,b],[c,d]]"), and similarly, that (math-read-expr
"[u;v;]") should return the same as (math-read-expr "[u;v]").  In
other words, we should simply ignore commas or semicolons when they
appear at the end of a vector or matrix.

The attached patch has the effect that, when a comma or semicolon is
followed by a closing delimiter, we do not attempt to further enlarge
the vector/matrix.  The patch makes it so more expressions can be
parsed, but should not modify how anything that can already be parsed
is parsed.



In GNU Emacs 30.0.50 (build 1, aarch64-apple-darwin22.5.0, NS
 appkit-2299.60 Version 13.4.1 (Build 22F82)) of 2023-08-17 built on
 d51735
Repository revision: 5856ea5e4e897f4cb5cd1c3c28d14b335fe5cf54
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2487
System Description:  macOS 14.2.1

Configured using:
 'configure --with-ns --with-native-compilation --with-tree-sitter
 --with-gif --with-png --with-jpeg --with-rsvg --with-tiff
 --with-imagemagick --with-x-toolkit=gtk3 --with-xwidgets'

Configured features:
ACL DBUS GLIB GNUTLS IMAGEMAGICK JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP XIM XWIDGETS ZLIB

Important settings:
  value of $LC_CTYPE: UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils calc-vec calc-aent calc-yank calc-lang
calc-ext calc-misc calc-menu calc calc-loaddefs rect calc-macs compile
text-property-search comint ansi-osc ansi-color ring comp comp-cstr
warnings icons rx cl-seq cl-macs gv cl-extra help-mode bytecomp
byte-compile time-date subr-x cl-loaddefs cl-lib rmc iso-transl tooltip
cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win touch-screen tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads xwidget-internal dbusbind kqueue cocoa ns lcms2 multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 125047 12021) (symbols 48 11032 0) (strings 32 28904 1662)
 (string-bytes 1 811127) (vectors 16 18887)
 (vector-slots 8 383681 18510) (floats 8 39 179) (intervals 56 273 0)
 (buffers 992 14))
[0001-allow-trailing-delimiters-when-parsing-vectors-matri.patch (application/octet-stream, attachment)]

This bug report was last modified 98 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.