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


View this message in rfc822 format

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: "Paul D. Nelson" <ultrono <at> gmail.com>, Arash Esbati <arash <at> gnu.org>
Cc: 76615 <at> debbugs.gnu.org
Subject: bug#76615: 14.0.9; error with amsmath style hooks
Date: Sat, 01 Mar 2025 00:57:06 +0900
Hi Paul and Arash,

>>>>> Arash Esbati <arash <at> gnu.org> writes:
> "Paul D. Nelson" <ultrono <at> gmail.com> writes:

>> Evaluating the following after Emacs -Q
>> 
>> (progn
>> (package-initialize)
>> (package-activate 'auctex)
>> (add-hook 'LaTeX-mode-hook #'turn-on-reftex)
>> (with-temp-buffer
>> (LaTeX-mode)
>> (TeX-run-style-hooks "amsmath")))
>> 
>> gives the backtrace:
>> 
>> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>> expand-file-name(nil)
>> reftex-TeX-master-file()
>> reftex-tie-multifile-symbols()
>> reftex-add-to-label-alist((AMSTeX))

> I think this is because of this part of amsmath.el[1]:

>    ;; RefTeX support: Tell RefTeX about amsmath environments.
>    (when (fboundp 'reftex-add-to-label-alist)
>      (reftex-add-to-label-alist '(AMSTeX)))

I tried commenting out this part, but it still fails at another part im
amsmath.el:
   (and LaTeX-reftex-ref-style-auto-activate
        (fboundp 'reftex-ref-style-activate)
        (reftex-ref-style-activate "AMSmath"))

>> The issue arose when using log-edit-generate-changelog-from-diff for a
>> commit involving tex files.  I distilled it down to the above example.

> I'd say the form above was in amsmath.el since forever :-)

The fundamental origin of the problem is that RefTeX presumes that it
always works in the buffer associated with files. In other words, RefTeX
pays no attention to non-file buffer. (I have such impression, skimming
over the RefTeX code. Please correct me if I'm wrong.)

>>>>> "Paul D. Nelson" <ultrono <at> gmail.com> writes:
> The attached patch addresses the issue for me.  Thoughts?

I have basically the same idea, but I think such partial treatment
inctroduces inconsistent internal state of RefTeX and can be potential
problems. Rather I propose to wrap the whole RefTeX management
part in amsmath.el by (when buffer-file-name ... ). In addition, we
should turn off RefTeX mode in `TeX-mode-cleanup' like
  (unless buffer-file-truename
    (if (bound-and-true-p reftex-mode) <-- addition
      (reftex-mode -1))                <-- addition
    (TeX-update-style))
to avoid inconsistency.

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.