emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master e1a209e 2/2: Fix infinite recursion in mode: tex


From: Lars Ingebrigtsen
Subject: master e1a209e 2/2: Fix infinite recursion in mode: tex
Date: Fri, 20 Aug 2021 09:57:15 -0400 (EDT)

branch: master
commit e1a209ef41ab0f0d11c93c863524ad3c9d4acdc5
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Fix infinite recursion in mode: tex
    
    * lisp/textmodes/tex-mode.el (tex--redirect-to-submode): Inhibit
    recursion when called from file-local variables (bug#50126).
---
 lisp/textmodes/tex-mode.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index c53acf5..2a61e4e 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -1016,10 +1016,14 @@ says which mode to use."
 (advice-add 'tex-mode :around #'tex--redirect-to-submode)
 (defun tex--redirect-to-submode (orig-fun)
   "Redirect to one of the submodes when called directly."
-  (funcall (if delay-mode-hooks
-               ;; We're called from one of the children already.
-               orig-fun
-             (tex--guess-mode))))
+  ;; The file may have "mode: tex" in the local variable
+  ;; block, in which case we'll be called recursively
+  ;; infinitely.  Inhibit that.
+  (let ((enable-local-variables nil))
+    (funcall (if delay-mode-hooks
+                 ;; We're called from one of the children already.
+                 orig-fun
+               (tex--guess-mode)))))
 
 ;; The following three autoloaded aliases appear to conflict with
 ;; AUCTeX.  However, even though AUCTeX uses the mixed case variants



reply via email to

[Prev in Thread] Current Thread [Next in Thread]