comparison lisp/cmdloop.el @ 3341:591c4e52c6d5

[xemacs-hg @ 2006-04-15 14:44:34 by aidan] Use Unicode for quoted-insert of codes greater than #xFF.
author aidan
date Sat, 15 Apr 2006 14:44:34 +0000
parents 827b833cd3ce
children e9214c743a8b
comparison
equal deleted inserted replaced
3340:4a73066779c1 3341:591c4e52c6d5
540 Legitimate radix values are 8, 10 and 16." 540 Legitimate radix values are 8, 10 and 16."
541 :type '(choice (const 8) (const 10) (const 16)) 541 :type '(choice (const 8) (const 10) (const 16))
542 :group 'editing-basics) 542 :group 'editing-basics)
543 543
544 (defun read-quoted-char (&optional prompt) 544 (defun read-quoted-char (&optional prompt)
545 ;; XEmacs change; description of the character code input
545 "Like `read-char', but do not allow quitting. 546 "Like `read-char', but do not allow quitting.
546 Also, if the first character read is an octal digit, 547
547 we read any number of octal digits and return the 548 Also, if the first character read is a digit of base (the value of)
548 specified character code. Any nondigit terminates the sequence. 549 `read-quoted-char-radix', we read as many of such digits as are
549 If the terminator is RET, it is discarded; 550 typed and return a character with the corresponding Unicode code
550 any other terminator is used itself as input. 551 point. Any input that not a digit (in the base used) terminates the
552 sequence. If the terminator is RET, it is discarded; any other
553 terminator is used itself as input.
551 554
552 The optional argument PROMPT specifies a string to use to prompt the user. 555 The optional argument PROMPT specifies a string to use to prompt the user.
553 The variable `read-quoted-char-radix' controls which radix to use 556 The variable `read-quoted-char-radix' controls which radix to use
554 for numeric input." 557 for numeric input."
555 (let (;(message-log-max nil) 558 (let (;(message-log-max nil)
556 done (first t) (code 0) char event 559 done (first t) (code 0) char event
557 (prompt (and prompt (gettext prompt))) 560 (prompt (and prompt (gettext prompt)))
558 ) 561 )
559 (while (not done) 562 (while (not done)
560 (let ((inhibit-quit first) 563 (let ((inhibit-quit first)
561 ;; Don't let C-h get the help message--only help function keys. 564 ;; Don't let C-h get the help message--only help
565 ;; function keys.
566 ;; XEmacs: we don't support the help function keys as of
567 ;; 2006-04-16. GNU have a Vhelp_event_list in addition
568 ;; to help-char in src/keyboard.c, and it's only useful
569 ;; to set help-form while help-char is nil when that
570 ;; functionality is available.
562 (help-char nil) 571 (help-char nil)
563 (help-form 572 (help-form (format
564 "Type the special character you want to use, 573 "Type the special character you want to use,
565 or the octal character code. 574 or the character code, base %d (the value of `read-quoted-char-radix')
566 RET terminates the character code and is discarded; 575 RET terminates the character code and is discarded;
567 any other non-digit terminates the character code and is then used as input.")) 576 any other non-digit terminates the character code and is then used as input."
577 read-quoted-char-radix)))
568 (and prompt (display-message 'prompt (format "%s-" prompt))) 578 (and prompt (display-message 'prompt (format "%s-" prompt)))
569 (setq event (next-command-event) 579 (setq event (next-command-event)
570 char (or (event-to-character event) 580 char (or (event-to-character event)
571 (signal 'error 581 (signal 'error
572 (list "key read cannot be inserted in a buffer" 582 (list "key read cannot be inserted in a buffer"
603 (setq unread-command-events (list event) 613 (setq unread-command-events (list event)
604 done t)) 614 done t))
605 (t (setq code (char-to-int char) 615 (t (setq code (char-to-int char)
606 done t))) 616 done t)))
607 (setq first nil)) 617 (setq first nil))
608 (int-to-char code))) 618 ;; XEmacs change; unicode-to-char instead of int-to-char
619 (unicode-to-char code)))
609 620
610 ;; in passwd.el. 621 ;; in passwd.el.
611 ; (defun read-passwd (prompt &optional confirm default) 622 ; (defun read-passwd (prompt &optional confirm default)
612 ; "Read a password, prompting with PROMPT. Echo `.' for each character typed. 623 ; "Read a password, prompting with PROMPT. Echo `.' for each character typed.
613 ; End with RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line. 624 ; End with RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line.