From 142007b747eacf81b609f98852053bc0f6e18bdf Mon Sep 17 00:00:00 2001
From: Eli Zaretskii <eliz@gnu.org>
Date: Tue, 25 Jul 2023 17:51:58 +0300
Subject: [PATCH] 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)
---
 lisp/files-x.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/files-x.el b/lisp/files-x.el
index 9b1a7a17902..3ba7632d253 100644
--- a/lisp/files-x.el
+++ b/lisp/files-x.el
@@ -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.
-- 
2.39.5