]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix infinite recursion in mode: tex
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 20 Aug 2021 13:57:06 +0000 (15:57 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 20 Aug 2021 13:57:06 +0000 (15:57 +0200)
* lisp/textmodes/tex-mode.el (tex--redirect-to-submode): Inhibit
recursion when called from file-local variables (bug#50126).

lisp/textmodes/tex-mode.el

index c53acf53e7e59c90e09e33232780441a7cf6e7f7..2a61e4e9a31048f2b59a3e45ae88f0768310b3e1 100644 (file)
@@ -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