Mercurial > emacs
changeset 50427:6ce9db7934cb
(read-quoted-char): Remember the input char
before translation thru function-key-map, and use that for unreading.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 03 Apr 2003 23:13:38 +0000 |
parents | 23d82f089582 |
children | 8636083efe8b |
files | lisp/subr.el |
diffstat | 1 files changed, 20 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/subr.el Thu Apr 03 23:11:06 2003 +0000 +++ b/lisp/subr.el Thu Apr 03 23:13:38 2003 +0000 @@ -1104,7 +1104,7 @@ The optional argument PROMPT specifies a string to use to prompt the user. The variable `read-quoted-char-radix' controls which radix to use for numeric input." - (let ((message-log-max nil) done (first t) (code 0) char) + (let ((message-log-max nil) done (first t) (code 0) char translated) (while (not done) (let ((inhibit-quit first) ;; Don't let C-h get the help message--only help function keys. @@ -1121,32 +1121,32 @@ ;; We could try and use read-key-sequence instead, but then C-q ESC ;; or C-q C-x might not return immediately since ESC or C-x might be ;; bound to some prefix in function-key-map or key-translation-map. - (and char - (let ((translated (lookup-key function-key-map (vector char)))) - (if (arrayp translated) - (setq char (aref translated 0))))) - (cond ((null char)) - ((not (integerp char)) - (setq unread-command-events (listify-key-sequence (this-single-command-raw-keys)) + (setq translated char) + (let ((translation (lookup-key function-key-map (vector char)))) + (if (arrayp translation) + (setq translated (aref translation 0)))) + (cond ((null translated)) + ((not (integerp translated)) + (setq unread-command-events (list char) done t)) - ((/= (logand char ?\M-\^@) 0) + ((/= (logand translated ?\M-\^@) 0) ;; Turn a meta-character into a character with the 0200 bit set. - (setq code (logior (logand char (lognot ?\M-\^@)) 128) + (setq code (logior (logand translated (lognot ?\M-\^@)) 128) done t)) - ((and (<= ?0 char) (< char (+ ?0 (min 10 read-quoted-char-radix)))) - (setq code (+ (* code read-quoted-char-radix) (- char ?0))) - (and prompt (setq prompt (message "%s %c" prompt char)))) - ((and (<= ?a (downcase char)) - (< (downcase char) (+ ?a -10 (min 26 read-quoted-char-radix)))) + ((and (<= ?0 translated) (< translated (+ ?0 (min 10 read-quoted-char-radix)))) + (setq code (+ (* code read-quoted-char-radix) (- translated ?0))) + (and prompt (setq prompt (message "%s %c" prompt translated)))) + ((and (<= ?a (downcase translated)) + (< (downcase translated) (+ ?a -10 (min 26 read-quoted-char-radix)))) (setq code (+ (* code read-quoted-char-radix) - (+ 10 (- (downcase char) ?a)))) - (and prompt (setq prompt (message "%s %c" prompt char)))) - ((and (not first) (eq char ?\C-m)) + (+ 10 (- (downcase translated) ?a)))) + (and prompt (setq prompt (message "%s %c" prompt translated)))) + ((and (not first) (eq translated ?\C-m)) (setq done t)) ((not first) - (setq unread-command-events (listify-key-sequence (this-single-command-raw-keys)) + (setq unread-command-events (list char) done t)) - (t (setq code char + (t (setq code translated done t))) (setq first nil)) code))