]> git.eshelyaron.com Git - emacs.git/commitdiff
(hack-one-local-variable): Refine last patch (bug#74964)
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 17 Jan 2025 13:43:50 +0000 (08:43 -0500)
committerEshel Yaron <me@eshelyaron.com>
Sat, 18 Jan 2025 22:00:23 +0000 (23:00 +0100)
* lisp/files.el (hack-local-variables--inhibit-eval): Rename from
`hack-local-variables--inhibit`.
(hack-one-local-variable): Skip only those eval forms we're already
in the process of evaluating.

(cherry picked from commit 4fada67748db787bf3a08ff15f1ab6f7992f9a7e)

lisp/files.el

index c6093721434776dff0d5920e12c1d400f8191e70..0c788a42ae17ae11d49c0a877b76cb8fa974bd40 100644 (file)
@@ -4532,15 +4532,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.")
+(defvar hack-local-variables--inhibit-eval nil
+  "List of `eval' forms to ignore in file/dir local variables.")
 
 (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)
+    ((and 'eval (guard (member val hack-local-variables--inhibit-eval))) nil)
     ('mode
      (let ((mode (intern (concat (downcase (symbol-name val))
                                  "-mode"))))
@@ -4548,8 +4548,8 @@ already the major mode."
     ('eval
      (pcase val
        (`(add-hook ',hook . ,_) (hack-one-local-variable--obsolete hook)))
-     (let ((hack-local-variables--inhibit ;; FIXME: Should be buffer-local!
-            (cons 'eval hack-local-variables--inhibit)))
+     (let ((hack-local-variables--inhibit-eval ;; FIXME: Should be buffer-local!
+            (cons val hack-local-variables--inhibit-eval)))
        (save-excursion (eval val t))))
     (_
      (hack-one-local-variable--obsolete var)