Better support for nil enable-local-variables in vc-find-revision-no-save
* lisp/vc/diff-mode.el (diff-syntax-fontify-props): * lisp/vc/vc.el (vc-find-revision-no-save): Use enable-local-variables as is only when it's one of these values: :safe, :all, or nil. Otherwise, for all remaining values that query, use :safe. Also use non-nil 'find-file' arg of 'normal-mode'. https://lists.gnu.org/archive/html/emacs-devel/2025-02/msg00897.html
This commit is contained in:
parent
3f72af9973
commit
24e8477aa2
2 changed files with 15 additions and 3 deletions
|
@ -3182,7 +3182,12 @@ hunk text is not found in the source file."
|
|||
(cl-assert (null buffer-file-name))
|
||||
;; Use `:safe' to find `mode:'. In case of hunk-only, use nil because
|
||||
;; Local Variables list might be incomplete when context is truncated.
|
||||
(let ((enable-local-variables (unless hunk-only :safe))
|
||||
(let ((enable-local-variables
|
||||
(unless hunk-only
|
||||
(if (memq enable-local-variables '(:safe :all nil))
|
||||
enable-local-variables
|
||||
;; Ignore other values that query.
|
||||
:safe)))
|
||||
(buffer-file-name file))
|
||||
;; Don't run hooks that might assume buffer-file-name
|
||||
;; really associates buffer with a file (bug#39190).
|
||||
|
|
|
@ -2461,12 +2461,19 @@ Unlike `vc-find-revision-save', doesn't save the buffer to the file."
|
|||
(goto-char (point-min))
|
||||
(if buffer
|
||||
;; For non-interactive, skip any questions
|
||||
(let ((enable-local-variables :safe) ;; to find `mode:'
|
||||
(let ((enable-local-variables
|
||||
(if (memq enable-local-variables '(:safe :all nil))
|
||||
enable-local-variables
|
||||
;; Ignore other values that query,
|
||||
;; use `:safe' to find `mode:'.
|
||||
:safe))
|
||||
(buffer-file-name file))
|
||||
;; Don't run hooks that might assume buffer-file-name
|
||||
;; really associates buffer with a file (bug#39190).
|
||||
(ignore-errors (delay-mode-hooks (set-auto-mode))))
|
||||
(normal-mode))
|
||||
;; Use non-nil 'find-file' arg of 'normal-mode'
|
||||
;; to not ignore 'enable-local-variables' when nil.
|
||||
(normal-mode (not enable-local-variables)))
|
||||
(set-buffer-modified-p nil)
|
||||
(setq buffer-read-only t)
|
||||
(setq failed nil))
|
||||
|
|
Loading…
Add table
Reference in a new issue