diff options
| author | Eli Zaretskii | 2016-11-25 12:06:26 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2016-11-25 12:06:26 +0200 |
| commit | e0884f1d04d90458fb412a488bcda20a9d45bfa4 (patch) | |
| tree | b926e4a336ab96cb744dbfb96425d85ef49872af | |
| parent | a6213ce4b3ab8435de80e01f6df7de261a0a8c87 (diff) | |
| download | emacs-e0884f1d04d90458fb412a488bcda20a9d45bfa4.tar.gz emacs-e0884f1d04d90458fb412a488bcda20a9d45bfa4.zip | |
Restore keystroke echo in 'C-q'
* lisp/simple.el (read-quoted-char): Use 'read-event' instead of
'read-key', to avoid losing the keystroke echo in 'C-q'. (Bug#24635)
| -rw-r--r-- | lisp/simple.el | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 295f8c63867..162f6dd89c5 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -681,7 +681,7 @@ for numeric input." | |||
| 681 | (let ((message-log-max nil) | 681 | (let ((message-log-max nil) |
| 682 | (help-events (delq nil (mapcar (lambda (c) (unless (characterp c) c)) | 682 | (help-events (delq nil (mapcar (lambda (c) (unless (characterp c) c)) |
| 683 | help-event-list))) | 683 | help-event-list))) |
| 684 | done (first t) (code 0) translated) | 684 | done (first t) (code 0) char translated) |
| 685 | (while (not done) | 685 | (while (not done) |
| 686 | (let ((inhibit-quit first) | 686 | (let ((inhibit-quit first) |
| 687 | ;; Don't let C-h or other help chars get the help | 687 | ;; Don't let C-h or other help chars get the help |
| @@ -693,15 +693,21 @@ for numeric input." | |||
| 693 | or the octal character code. | 693 | or the octal character code. |
| 694 | RET terminates the character code and is discarded; | 694 | RET terminates the character code and is discarded; |
| 695 | any other non-digit terminates the character code and is then used as input.")) | 695 | any other non-digit terminates the character code and is then used as input.")) |
| 696 | (setq translated (read-key (and prompt (format "%s-" prompt)))) | 696 | (setq char (read-event (and prompt (format "%s-" prompt)) t)) |
| 697 | (if inhibit-quit (setq quit-flag nil))) | 697 | (if inhibit-quit (setq quit-flag nil))) |
| 698 | ;; Translate TAB key into control-I ASCII character, and so on. | ||
| 699 | ;; Note: `read-char' does it using the `ascii-character' property. | ||
| 700 | ;; We tried using read-key instead, but that disables the keystroke | ||
| 701 | ;; echo produced by 'C-q', see bug#24635. | ||
| 702 | (let ((translation (lookup-key local-function-key-map (vector char)))) | ||
| 703 | (setq translated (if (arrayp translation) | ||
| 704 | (aref translation 0) | ||
| 705 | char))) | ||
| 698 | (if (integerp translated) | 706 | (if (integerp translated) |
| 699 | (setq translated (char-resolve-modifiers translated))) | 707 | (setq translated (char-resolve-modifiers translated))) |
| 700 | (cond ((null translated)) | 708 | (cond ((null translated)) |
| 701 | ((not (integerp translated)) | 709 | ((not (integerp translated)) |
| 702 | (setq unread-command-events | 710 | (setq unread-command-events (list char) |
| 703 | (nconc (listify-key-sequence (this-single-command-raw-keys)) | ||
| 704 | unread-command-events) | ||
| 705 | done t)) | 711 | done t)) |
| 706 | ((/= (logand translated ?\M-\^@) 0) | 712 | ((/= (logand translated ?\M-\^@) 0) |
| 707 | ;; Turn a meta-character into a character with the 0200 bit set. | 713 | ;; Turn a meta-character into a character with the 0200 bit set. |
| @@ -720,9 +726,7 @@ any other non-digit terminates the character code and is then used as input.")) | |||
| 720 | ((and (not first) (eq translated ?\C-m)) | 726 | ((and (not first) (eq translated ?\C-m)) |
| 721 | (setq done t)) | 727 | (setq done t)) |
| 722 | ((not first) | 728 | ((not first) |
| 723 | (setq unread-command-events | 729 | (setq unread-command-events (list char) |
| 724 | (nconc (listify-key-sequence (this-single-command-raw-keys)) | ||
| 725 | unread-command-events) | ||
| 726 | done t)) | 730 | done t)) |
| 727 | (t (setq code translated | 731 | (t (setq code translated |
| 728 | done t))) | 732 | done t))) |