Subject: bug#50780: 28.0.50; [PATCH] Mention the 'r' key in ask-user-about-supersession-help

From: Daniel Martín <[email-masked]>
Date: Fri, 24 Sep 2021 15:59:08 +0200

When you edit a buffer whose underlying file has changed, Emacs presents
a dialog to confirm if you really want to edit the buffer.  The dialog,
since 1996, offers to revert the file by pressing 'r', but the help
message still mentions 'n' and then 'M-x revert'.  As they are
equivalent, the attached patch updates the help text to recommend
pressing 'r'.

Thanks.

>From b1e4985bb70ec820d59984e1bab8223c11de941a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= <[email-masked]>
Date: Fri, 24 Sep 2021 15:32:01 +0200
Subject: [PATCH] Mention the 'r' key in ask-user-about-supersession-help

* lisp/userlock.el (ask-user-about-supersession-help): Replace "n, and
then M-x revert-buffer" in the help message with "r", which does the
same thing.
---
 lisp/userlock.el | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/lisp/userlock.el b/lisp/userlock.el
index a38f6ac422..87a8b7b451 100644
--- a/lisp/userlock.el
+++ b/lisp/userlock.el
@@ -201,13 +201,10 @@ ask-user-about-supersession-threat
 
 (defun ask-user-about-supersession-help ()
   (with-output-to-temp-buffer "*Help*"
-    (let ((revert-buffer-binding
-           ;; This takes place in the original buffer.
-           (substitute-command-keys "\\[revert-buffer]")))
-      (with-current-buffer standard-output
-        (insert
-         (format
-          "You want to modify a buffer whose disk file has changed
+    (with-current-buffer standard-output
+      (insert
+       (format
+        "You want to modify a buffer whose disk file has changed
 since you last read it in or saved it with this buffer.
 
 If you say %s to go ahead and modify this buffer,
@@ -216,14 +213,13 @@ ask-user-about-supersession-help
 from the file on disk.
 If you say %s, the change you started to make will be aborted.
 
-Usually, you should type %s and then %s,
-to get the latest version of the file, then make the change again."
-          (userlock--fontify-key "y")
-          (userlock--fontify-key "r")
-          (userlock--fontify-key "n")
-          (userlock--fontify-key "n")
-          revert-buffer-binding))
-        (help-mode)))))
+Usually, you should type %s to get the latest version of the
+file, then make the change again."
+        (userlock--fontify-key "y")
+        (userlock--fontify-key "r")
+        (userlock--fontify-key "n")
+        (userlock--fontify-key "r")))
+      (help-mode))))
 
 ;;;###autoload
 (defun userlock--handle-unlock-error (error)
-- 
2.31.0