From 24bd59b1c4843e6061d4c50e12d7d9add58dd08e Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sat, 5 Apr 2025 11:54:06 +0200 Subject: [PATCH] Drop 'local-enable-local-variables'. --- lisp/arc-mode.el | 1 - lisp/files.el | 56 +++++++--------------------------------------- lisp/mail/rmail.el | 2 -- lisp/so-long.el | 1 - lisp/tar-mode.el | 1 - 5 files changed, 8 insertions(+), 53 deletions(-) diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index 32743edd6b3..a2b4725e242 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -737,7 +737,6 @@ archive. (setq-local truncate-lines t) (setq-local require-final-newline nil) - (setq-local local-enable-local-variables nil) ;; Prevent loss of data when saving the file. (setq-local file-precious-flag t) diff --git a/lisp/files.el b/lisp/files.el index b3826e6525d..6423413357e 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -757,38 +757,6 @@ See also `trusted-content'." (setq trusted t))) trusted))))))) -;; This is an odd variable IMO. -;; You might wonder why it is needed, when we could just do: -;; (setq-local enable-local-variables nil) -;; These two are not precisely the same. -;; Setting this variable does not cause -*- mode settings to be -;; ignored, whereas setting enable-local-variables does. -;; Only three places in Emacs use this variable: tar and arc modes, -;; and rmail. The first two don't need it. They already use -;; inhibit-local-variables-regexps, which is probably enough, and -;; could also just set enable-local-variables locally to nil. -;; Them setting it has the side-effect that dir-locals cannot apply to -;; eg tar files (?). FIXME Is this appropriate? -;; AFAICS, rmail is the only thing that needs this, and the only -;; reason it uses it is for BABYL files (which are obsolete). -;; These contain "-*- rmail -*-" in the first line, which rmail wants -;; to respect, so that find-file on a BABYL file will switch to -;; rmail-mode automatically (this is nice, but hardly essential, -;; since most people are used to explicitly running a command to -;; access their mail; M-x gnus etc). Rmail files may happen to -;; contain Local Variables sections in messages, which Rmail wants to -;; ignore. So AFAICS the only reason this variable exists is for a -;; minor convenience feature for handling of an obsolete Rmail file format. -(defvar local-enable-local-variables t - "Like `enable-local-variables', except for major mode in a -*- line. -The meaningful values are nil and non-nil. The default is non-nil. -It should be set in a buffer-local fashion. - -Setting this to nil has the same effect as setting `enable-local-variables' -to nil, except that it does not ignore any mode: setting in a -*- line. -Unless this difference matters to you, you should set `enable-local-variables' -instead of this variable.") - (defcustom enable-local-eval nil "Control processing of the \"variable\" `eval' in a file's local variables. The value can be t, nil or something else. @@ -3013,8 +2981,6 @@ Uses the visited file name, the -*- line, and the local variables spec. This function is called automatically from `find-file'. In that case, we may set up the file-specified mode and local variables, depending on the value of `enable-local-variables'. -In addition, if `local-enable-local-variables' is nil, we do -not set local variables (though we do notice a mode specified with -*-.) `enable-local-variables' is ignored if you run `normal-mode' interactively, or from Lisp without specifying the optional argument FIND-FILE; @@ -3613,8 +3579,7 @@ It also obeys `major-mode-remap-alist' and `major-mode-remap-defaults'. If `enable-local-variables' is nil, or if the file name matches `inhibit-local-variables-regexps', this function does not check -for any mode: tag anywhere in the file. If `local-enable-local-variables' -is nil, then the only mode: tag that can be relevant is a -*- one. +for any mode: tag anywhere in the file. If the optional argument KEEP-MODE-IF-SAME is non-nil, then we set the major mode only if that would change it. In other words @@ -3629,7 +3594,6 @@ we don't actually set it to the same mode the buffer already has." (save-excursion (goto-char (point-min)) (skip-chars-forward " \t\n") - ;; Note by design local-enable-local-variables does not matter here. (and enable-local-variables try-locals (setq end (set-auto-mode-1)) @@ -3816,8 +3780,7 @@ Call with point at the place to start searching from. If one is found, set point to the beginning and return the position of the end. Otherwise, return nil; may change point. The variable `inhibit-local-variables-regexps' can cause a -*- spec to -be ignored; but `enable-local-variables' and `local-enable-local-variables' -have no effect." +be ignored; but `enable-local-variables' has no effect." (let (beg end) (and ;; Don't look for -*- if this file name matches any @@ -4258,12 +4221,11 @@ would be applicable to files in `default-directory'. Uses `hack-local-variables-apply' and `hack-dir-local-variables' to apply the variables. -If `enable-local-variables' or `local-enable-local-variables' is -nil, or INHIBIT-LOCALS is non-nil, this function disregards all -normal local variables. If `inhibit-local-variables-regexps' -applies to the file in question, the file is not scanned for -local variables, but directory-local variables may still be -applied. +If `enable-local-variables' is nil, or if INHIBIT-LOCALS is non-nil, +this function disregards all normal local variables. If +`inhibit-local-variables-regexps' applies to the file in question, the +file is not scanned for local variables, but directory-local variables +may still be applied. Variables present in `permanently-enabled-local-variables' will still be evaluated, even if local variables are otherwise @@ -4281,9 +4243,7 @@ all the specified local variables, but ignores any settings of \"mode:\"." ;; variable sections, but there is no reason dir-locals cannot apply ;; to them. The real meaning of inhibit-local-variables-p is "do ;; not scan this file for local variables". - (let ((enable-local-variables - (and (not inhibit-locals) - local-enable-local-variables enable-local-variables))) + (let ((enable-local-variables (not inhibit-locals))) (if (eq handle-mode t) ;; We're looking just for the major mode setting. (and enable-local-variables diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 41b0813707f..4ab1e78d74a 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -1481,8 +1481,6 @@ If so restore the actual mbox message collection." (defun rmail-variables () ;; Turn off undo. We turn it back on in rmail-edit. (setq buffer-undo-list t) - ;; Don't let a local variables list in a message cause confusion. - (setq-local local-enable-local-variables nil) ;; Don't turn off auto-saving based on the size of the buffer ;; because that code does not understand buffer-swapping. (setq-local auto-save-include-big-deletions t) diff --git a/lisp/so-long.el b/lisp/so-long.el index 6f6e2ec7963..4b04dc7100e 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -1630,7 +1630,6 @@ function defined by `so-long-file-local-mode-function'." (save-excursion (goto-char (point-min)) (skip-chars-forward " \t\n") - ;; Note by design local-enable-local-variables does not matter here. (and enable-local-variables try-locals (setq end (set-auto-mode-1)) diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index 6a138455f8f..85cd8063444 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -843,7 +843,6 @@ See also: variables `tar-update-datestamp' and `tar-anal-blocksize'. (setq buffer-read-only nil)) ; undo what `special-mode' did (make-local-variable 'tar-parse-info) (setq-local require-final-newline nil) ; binary data, dude... - (setq-local local-enable-local-variables nil) (setq-local next-line-add-newlines nil) (setq-local tar-file-name-coding-system (or file-name-coding-system -- 2.39.5