aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman1997-07-17 06:24:48 +0000
committerRichard M. Stallman1997-07-17 06:24:48 +0000
commit1ba764decd5755041daf6befc92a04ba493f4f31 (patch)
tree5d5c0cae9c0cd2d2902685898cd0f387a22cdf2e /lisp
parentae8ad8859ba5639f91b156c36d0ccc9a0fba8332 (diff)
downloademacs-1ba764decd5755041daf6befc92a04ba493f4f31.tar.gz
emacs-1ba764decd5755041daf6befc92a04ba493f4f31.zip
(read-quoted-char): Handle non-character events.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/subr.el25
1 files changed, 19 insertions, 6 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index bc966c7bda8..4d583944de9 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -649,12 +649,18 @@ FILE should be the name of a library, with no directory name."
649 649
650;;;; Input and display facilities. 650;;;; Input and display facilities.
651 651
652(defcustom read-quoted-char-radix 8
653 "*Radix for \\[quoted-insert] and other uses of `read-quoted-char'.
654Legitimate radix values are 8, 10 and 16."
655 :type '(choice (const 8) (const 10) (const 16))
656 :group 'editing-basics)
657
652(defun read-quoted-char (&optional prompt) 658(defun read-quoted-char (&optional prompt)
653 "Like `read-char', but do not allow quitting. 659 "Like `read-char', but do not allow quitting.
654Also, if the first character read is an octal digit, 660Also, if the first character read is an octal digit,
655we read any number of octal digits and return the 661we read any number of octal digits and return the
656soecified character code. Any nondigit terminates the sequence. 662soecified character code. Any nondigit terminates the sequence.
657If the terminator is a space, it is discarded; 663If the terminator is RET, it is discarded;
658any other terminator is used itself as input. 664any other terminator is used itself as input.
659 665
660The optional argument PROMPT specifies a string to use to prompt the user." 666The optional argument PROMPT specifies a string to use to prompt the user."
@@ -666,16 +672,23 @@ The optional argument PROMPT specifies a string to use to prompt the user."
666 (help-form 672 (help-form
667 "Type the special character you want to use, 673 "Type the special character you want to use,
668or the octal character code. 674or the octal character code.
669Space terminates the character code and is discarded; 675RET terminates the character code and is discarded;
670any other non-digit terminates the character code and is then used as input.")) 676any other non-digit terminates the character code and is then used as input."))
671 (and prompt (message "%s-" prompt)) 677 (and prompt (message "%s-" prompt))
672 (setq char (read-char)) 678 (setq char (read-event))
673 (if inhibit-quit (setq quit-flag nil))) 679 (if inhibit-quit (setq quit-flag nil)))
674 (cond ((null char)) 680 (cond ((null char))
675 ((and (<= ?0 char) (<= char ?7)) 681 ((not (integerp char))
676 (setq code (+ (* code 8) (- char ?0))) 682 (setq unread-command-events (list char)
683 done t))
684 ((and (<= ?0 char) (< char (+ ?0 (min 10 read-quoted-char-radix))))
685 (setq code (+ (* code read-quoted-char-radix) (- char ?0)))
686 (and prompt (setq prompt (message "%s %c" prompt char))))
687 ((and (<= ?a (downcase char))
688 (< (downcase char) (+ ?a -10 (min 26 read-quoted-char-radix))))
689 (setq code (+ (* code read-quoted-char-radix) (+ 10 (- char ?a))))
677 (and prompt (setq prompt (message "%s %c" prompt char)))) 690 (and prompt (setq prompt (message "%s %c" prompt char))))
678 ((and (not first) (eq char ?\ )) 691 ((and (not first) (eq char ?\C-m))
679 (setq done t)) 692 (setq done t))
680 ((not first) 693 ((not first)
681 (setq unread-command-events (list char) 694 (setq unread-command-events (list char)