From c2026cf3667c0b68a99deed2896b97ce2cf7f5cb Mon Sep 17 00:00:00 2001
From: Lars Ingebrigtsen <larsi@gnus.org>
Date: Fri, 20 Aug 2021 15:55:24 +0200
Subject: Fix infinite recursion of conf-mode

* lisp/textmodes/conf-mode.el (conf-mode): Inhibit recursion when
called from file-local variables (bug#50126).
---
 lisp/textmodes/conf-mode.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'lisp/textmodes')

diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el
index 5f34ae152d1..949d8cbdab9 100644
--- a/lisp/textmodes/conf-mode.el
+++ b/lisp/textmodes/conf-mode.el
@@ -420,7 +420,11 @@ See also `conf-space-mode', `conf-colon-mode', `conf-javaprop-mode',
 (advice-add 'conf-mode :around
             (lambda (orig-fun)
               "Redirect to one of the submodes when called directly."
-              (funcall (if delay-mode-hooks orig-fun (conf--guess-mode)))))
+              ;; The file may have "mode: conf" 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 orig-fun (conf--guess-mode))))))
 
 
 
-- 
cgit v1.2.3