mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-09 01:05:39 -08:00
(read-quoted-char): Remember the input char
before translation thru function-key-map, and use that for unreading.
This commit is contained in:
parent
5354cb6d88
commit
c83256a09a
1 changed files with 20 additions and 20 deletions
40
lisp/subr.el
40
lisp/subr.el
|
|
@ -1104,7 +1104,7 @@ any other terminator is used itself as input.
|
|||
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 @@ any other non-digit terminates the character code and is then used as input."))
|
|||
;; 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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue