1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 12:21:25 -08:00

Fix 'kill-region' when buffer has been changed outside of Emacs

* lisp/subr.el (read-char-choice): Let-bind 'last-command' to
prevent it from being overwritten by 'recursive-edit'.
(Bug#79388)
This commit is contained in:
Eli Zaretskii 2025-09-13 11:56:15 +03:00
parent 4d91665367
commit 92fa2b60c6

View file

@ -3625,7 +3625,13 @@ argument INHIBIT-KEYBOARD-QUIT is ignored. However, if
function is used instead (see `read-char-choice-with-read-key'),
and INHIBIT-KEYBOARD-QUIT is passed to it."
(if (not read-char-choice-use-read-key)
(read-char-from-minibuffer prompt chars)
;; We are about to enter recursive-edit, which sets
;; 'last-command'. If the callers of this function have some
;; logic based on 'last-command's value (example: 'kill-region'),
;; that could interfere with their logic. So we let-bind
;; 'last-command' here to prevent that.
(let ((last-command last-command))
(read-char-from-minibuffer prompt chars))
(read-char-choice-with-read-key prompt chars inhibit-keyboard-quit)))
(defun read-char-choice-with-read-key (prompt chars &optional inhibit-keyboard-quit)