GNU bug report logs -
#76615
14.0.9; error with amsmath style hooks
Previous Next
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 #20 received at 76615 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Ikumi,
>
> 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.)
>
This has also been my understanding (although I stopped using RefTeX
years ago, basically for this reason).
>>>>>> "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.
>
Something like the attached, I guess? There are other uses of "reftex-"
in style/, so I guess something similar should be done for all of them?
Thanks, best,
Paul
[Message part 2 (text/plain, inline)]
diff --git a/style/amsmath.el b/style/amsmath.el
index 9d6944dc..c73f7475 100644
--- a/style/amsmath.el
+++ b/style/amsmath.el
@@ -163,24 +163,25 @@
(TeX-run-style-hooks "amstext" "amsbsy" "amsopn")
;; RefTeX support: Tell RefTeX about amsmath environments.
- (when (fboundp 'reftex-add-to-label-alist)
- (reftex-add-to-label-alist '(AMSTeX)))
-
- ;; Add \eqref to `reftex-ref-style-alist' and associate it to `e'
- (when (and (boundp 'reftex-ref-style-alist)
- ;; check if Emacs is already equipped with this
- (not (assoc "AMSmath" reftex-ref-style-alist)))
- ;; Append it to a local version in order to avoid a clash with
- ;; user settings
- (add-to-list (make-local-variable 'reftex-ref-style-alist)
- '("AMSmath" "amsmath" (("\\eqref" ?e)))
- t))
-
- ;; Activate `AMSmath' when `LaTeX-reftex-ref-style-auto-activate'
- ;; is non-nil
- (and LaTeX-reftex-ref-style-auto-activate
- (fboundp 'reftex-ref-style-activate)
- (reftex-ref-style-activate "AMSmath"))
+ (when buffer-file-truename
+ (when (fboundp 'reftex-add-to-label-alist)
+ (reftex-add-to-label-alist '(AMSTeX)))
+
+ ;; Add \eqref to `reftex-ref-style-alist' and associate it to `e'
+ (when (and (boundp 'reftex-ref-style-alist)
+ ;; check if Emacs is already equipped with this
+ (not (assoc "AMSmath" reftex-ref-style-alist)))
+ ;; Append it to a local version in order to avoid a clash with
+ ;; user settings
+ (add-to-list (make-local-variable 'reftex-ref-style-alist)
+ '("AMSmath" "amsmath" (("\\eqref" ?e)))
+ t))
+
+ ;; Activate `AMSmath' when `LaTeX-reftex-ref-style-auto-activate'
+ ;; is non-nil
+ (and LaTeX-reftex-ref-style-auto-activate
+ (fboundp 'reftex-ref-style-activate)
+ (reftex-ref-style-activate "AMSmath")))
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
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.