GNU bug report logs - #76615
14.0.9; error with amsmath style hooks

Previous Next

Package: auctex;

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

Date: Thu, 27 Feb 2025 18:31:02 UTC

Severity: normal

Found in version 14.0.9

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


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

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: "Paul D. Nelson" <ultrono <at> gmail.com>
Cc: arash <at> gnu.org, 76615 <at> debbugs.gnu.org
Subject: Re: bug#76615: 14.0.9; error with amsmath style hooks
Date: Mon, 24 Mar 2025 18:10:09 +0900
[ Sorry to have incomplete References: header; I deleted Paul's last post
by mistake. ]

Hi Paul,

>>>>> "Paul D. Nelson" <ultrono <at> gmail.com> writes:
> The result of reftex-TeX-master-file is passed to file-truename, so it
> can be "<none>.tex" but not nil.  Modifying your patch as follows seems
> to do the trick.

Thanks. I reconsidered and came to think that we should check whether
`master' is nil. Here is my next proposal:
diff -r 3eca07415d50 lisp/textmodes/reftex.el
--- a/lisp/textmodes/reftex.el	Sun Mar 23 02:56:31 2025 +0900
+++ b/lisp/textmodes/reftex.el	Mon Mar 24 17:55:36 2025 +0900
@@ -62,6 +62,12 @@
     (setq reftex-tables-dirty t)
     (set symbol value)))
 
+(defvar reftex--suppress-nonfile-error nil
+  "When non-nil, don't signal error in non-file buffer.
+
+Note that this is just a quick and dirty hack and is _not_ reliable at
+all.  It only circumvents disastrous error in `reftex-TeX-master-file',
+in case that the user turns on RefTeX in latex mode hook.")
 
 ;; Configuration variables
 (require 'reftex-vars)
@@ -378,7 +384,8 @@
           (buffer-file-name)))))
     (cond
      ((null master)
-      (error "Need a filename for this buffer, please save it first"))
+      (or reftex--suppress-nonfile-error
+          (error "Need a filename for this buffer, please save it first")))
      ((or (file-exists-p (concat master ".tex"))
           (find-buffer-visiting (concat master ".tex")))
       ;; Ahh, an extra .tex was missing...
@@ -390,7 +397,10 @@
      (t
       ;; Use buffer file name.
       (setq master (buffer-file-name))))
-    (expand-file-name master)))
+    (if (and (not master)
+             reftex--suppress-nonfile-error)
+        "<none>.tex"
+      (expand-file-name master))))
 
 (defun reftex-is-multi ()
   ;; Tell if this is a multifile document.  When not sure, say yes.

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine
#Gaza #StopMassiveKilling #CeasefireNOW




This bug report was last modified 46 days ago.

Previous Next


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