emacs-diffs
[Top][All Lists]
Advanced

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

master 127fc983080: (hack-one-local-variable): Fix bug#74964


From: Stefan Monnier
Subject: master 127fc983080: (hack-one-local-variable): Fix bug#74964
Date: Sun, 5 Jan 2025 10:03:48 -0500 (EST)

branch: master
commit 127fc983080a3b9a607fa693bacfcf02f19ce0b7
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    (hack-one-local-variable): Fix bug#74964
    
    * lisp/files.el (hack-local-variables--inhibit): New var.
    (hack-one-local-variable): Use it to avoid infinite recursion in a more
    targeted manner.
---
 lisp/files.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/files.el b/lisp/files.el
index 72128ea4af2..b0f6440fdce 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -4490,11 +4490,15 @@ It is dangerous if either of these conditions are met:
                      (substitute-command-keys instead)
                    (format-message "use `%s' instead" instead)))))))
 
+(defvar hack-local-variables--inhibit nil
+  "List of file/dir local variables to ignore.")
+
 (defun hack-one-local-variable (var val)
   "Set local variable VAR with value VAL.
 If VAR is `mode', call `VAL-mode' as a function unless it's
 already the major mode."
   (pcase var
+    ((guard (memq var hack-local-variables--inhibit)) nil)
     ('mode
      (let ((mode (intern (concat (downcase (symbol-name val))
                                  "-mode"))))
@@ -4502,7 +4506,8 @@ already the major mode."
     ('eval
      (pcase val
        (`(add-hook ',hook . ,_) (hack-one-local-variable--obsolete hook)))
-     (let ((enable-local-variables nil)) ;FIXME: Should be buffer-local!
+     (let ((hack-local-variables--inhibit ;; FIXME: Should be buffer-local!
+            (cons 'eval hack-local-variables--inhibit)))
        (save-excursion (eval val t))))
     (_
      (hack-one-local-variable--obsolete var)



reply via email to

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