diff options
| author | Eli Zaretskii | 2025-09-13 11:56:15 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2025-09-13 11:56:15 +0300 |
| commit | 92fa2b60c613c653ecea262a04ab8e7f3a8ff2f9 (patch) | |
| tree | 5f0aaaa8db97d26b86e594ceb585b4e617952774 | |
| parent | 4d91665367e68400e48bda4d9e50ab23489f62f4 (diff) | |
| download | emacs-92fa2b60c613c653ecea262a04ab8e7f3a8ff2f9.tar.gz emacs-92fa2b60c613c653ecea262a04ab8e7f3a8ff2f9.zip | |
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)
| -rw-r--r-- | lisp/subr.el | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 35bb00e0c49..da208d7063f 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -3625,7 +3625,13 @@ argument INHIBIT-KEYBOARD-QUIT is ignored. However, if | |||
| 3625 | function is used instead (see `read-char-choice-with-read-key'), | 3625 | function is used instead (see `read-char-choice-with-read-key'), |
| 3626 | and INHIBIT-KEYBOARD-QUIT is passed to it." | 3626 | and INHIBIT-KEYBOARD-QUIT is passed to it." |
| 3627 | (if (not read-char-choice-use-read-key) | 3627 | (if (not read-char-choice-use-read-key) |
| 3628 | (read-char-from-minibuffer prompt chars) | 3628 | ;; We are about to enter recursive-edit, which sets |
| 3629 | ;; 'last-command'. If the callers of this function have some | ||
| 3630 | ;; logic based on 'last-command's value (example: 'kill-region'), | ||
| 3631 | ;; that could interfere with their logic. So we let-bind | ||
| 3632 | ;; 'last-command' here to prevent that. | ||
| 3633 | (let ((last-command last-command)) | ||
| 3634 | (read-char-from-minibuffer prompt chars)) | ||
| 3629 | (read-char-choice-with-read-key prompt chars inhibit-keyboard-quit))) | 3635 | (read-char-choice-with-read-key prompt chars inhibit-keyboard-quit))) |
| 3630 | 3636 | ||
| 3631 | (defun read-char-choice-with-read-key (prompt chars &optional inhibit-keyboard-quit) | 3637 | (defun read-char-choice-with-read-key (prompt chars &optional inhibit-keyboard-quit) |