From cc5b6cb6bcc63d447663e1e98b05b7a16bd27f99 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 27 Aug 2021 04:00:58 +0200 Subject: Fix backtrace when query-about-changed-file nil and file has changed * lisp/userlock.el (userlock--check-content-unchanged): Make the assertion more robust -- we may be called here from a different contexts if `query-about-changed-file' is nil. --- lisp/userlock.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lisp/userlock.el') diff --git a/lisp/userlock.el b/lisp/userlock.el index 38aaf6aec23..a38f6ac4222 100644 --- a/lisp/userlock.el +++ b/lisp/userlock.el @@ -125,7 +125,8 @@ You can <%s>uit; don't modify this file." (with-demoted-errors "Unchanged content check: %S" ;; Even tho we receive `filename', we know that `filename' refers to the current ;; buffer's file. - (cl-assert (equal filename (expand-file-name buffer-file-truename))) + (cl-assert (equal (expand-file-name filename) + (expand-file-name buffer-file-truename))) ;; Note: rather than read the file and compare to the buffer, we could save ;; the buffer and compare to the file, but for encrypted data this ;; wouldn't work well (and would risk exposing the data). -- cgit v1.2.3 From 67a0eee727925264041b610b8cf0360654590d51 Mon Sep 17 00:00:00 2001 From: Daniel Martín Date: Fri, 24 Sep 2021 15:32:01 +0200 Subject: 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. (Bug#50780) --- lisp/userlock.el | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'lisp/userlock.el') diff --git a/lisp/userlock.el b/lisp/userlock.el index a38f6ac4222..87a8b7b4519 100644 --- a/lisp/userlock.el +++ b/lisp/userlock.el @@ -201,13 +201,10 @@ really edit the buffer? (%s, %s, %s or %s) " (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 @@ If you say %s to revert, the contents of the buffer are refreshed 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) -- cgit v1.2.3 From 013e3be8327ee090cef101121dd8f10e992e7958 Mon Sep 17 00:00:00 2001 From: "David M. Koppelman" Date: Sun, 10 Oct 2021 20:27:29 +0300 Subject: * lisp/userlock.el (ask-user-about-supersession-threat): Accept 'y' strictly. (Bug#51101) --- lisp/userlock.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lisp/userlock.el') diff --git a/lisp/userlock.el b/lisp/userlock.el index 87a8b7b4519..348ccc6f8ec 100644 --- a/lisp/userlock.el +++ b/lisp/userlock.el @@ -194,7 +194,9 @@ really edit the buffer? (%s, %s, %s or %s) " (list "File reverted" filename))) ((eq answer ?n) (signal 'file-supersession - (list "File changed on disk" filename))))) + (list "File changed on disk" filename))) + ((eq answer ?y)) + (t (setq answer nil)))) (message "File on disk now will become a backup file if you save these changes.") (setq buffer-backed-up nil)))) -- cgit v1.2.3