Don't suggest to revert buffer from non-existing file

* lisp/files-x.el (modify-file-local-variable-message): Suggest to
revert from the buffer's file only if that file exists; otherwise
suggest 'normal-mode'.  (Bug#64844)
This commit is contained in:
Eli Zaretskii 2023-07-25 17:51:58 +03:00
parent f6e4e77d23
commit 142007b747

View file

@ -136,7 +136,10 @@ Intended to be used in the `interactive' spec of
(eq new-value not-value)
(not (equal old-value new-value)))
(message "%s" (substitute-command-keys
"For this change to take effect revisit file using \\[revert-buffer]")))))
(if (and (stringp buffer-file-name)
(file-exists-p buffer-file-name))
"For this change to take effect revisit file using \\[revert-buffer]"
"For this change to take effect use \\[normal-mode]"))))))
(defun modify-file-local-variable (variable value op &optional interactive)
"Modify file-local VARIABLE in Local Variables depending on operation OP.