Mercurial > hg > xemacs-beta
comparison lisp/cmdloop.el @ 5861:c87b776ab0e1
Create a new error for when a char is needed but event-to-character gives nil
lisp/ChangeLog addition:
2015-03-14 Aidan Kehoe <kehoea@parhasard.net>
* cmdloop.el (no-character-typed):
New error, for those cases when a keystroke is to be treated as a
character but has no character equivalent.
* cmdloop.el (read-char-1): Use it.
* keymap.el (synthesize-keysym): Use it.
src/ChangeLog addition:
2015-03-14 Aidan Kehoe <kehoea@parhasard.net>
* general-slots.h (Qno_character_typed): New error symbol.
* event-stream.c (syms_of_event_stream): Define it.
New error, for those cases when a keystroke is to be treated as a
character in some context but has no character equivalent.
* cmds.c (Fself_insert_command):
Use it.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sat, 14 Mar 2015 01:40:49 +0000 |
parents | 0e9f791cc655 |
children | f9e59cd39a9a |
comparison
equal
deleted
inserted
replaced
5860:916b48abd1c6 | 5861:c87b776ab0e1 |
---|---|
278 (princ (key-description (car (cdr error-object))) stream) | 278 (princ (key-description (car (cdr error-object))) stream) |
279 ;; #### I18N3: doesn't localize properly. | 279 ;; #### I18N3: doesn't localize properly. |
280 (princ (gettext " not defined.") stream) ; doo dah, doo dah. | 280 (princ (gettext " not defined.") stream) ; doo dah, doo dah. |
281 )) | 281 )) |
282 | 282 |
283 (put 'no-character-typed 'display-error | |
284 #'(lambda (error-object stream) | |
285 (write-sequence "Not a character keystroke, " stream) | |
286 (write-sequence (key-description (cadr error-object)) stream))) | |
283 | 287 |
284 (defcustom teach-extended-commands-p t | 288 (defcustom teach-extended-commands-p t |
285 "*If true, then `\\[execute-extended-command]' will teach you keybindings. | 289 "*If true, then `\\[execute-extended-command]' will teach you keybindings. |
286 Any time you execute a command with \\[execute-extended-command] which has a | 290 Any time you execute a command with \\[execute-extended-command] which has a |
287 shorter keybinding, you will be shown the alternate binding before the | 291 shorter keybinding, you will be shown the alternate binding before the |
591 (aref (cdr binding) (caar binding)))) | 595 (aref (cdr binding) (caar binding)))) |
592 (return-from read-char-1 | 596 (return-from read-char-1 |
593 (aref (cdr binding) (caar binding))))))) | 597 (aref (cdr binding) (caar binding))))))) |
594 (return-from read-char-1 character))) | 598 (return-from read-char-1 character))) |
595 (if errorp | 599 (if errorp |
596 (error 'invalid-key-binding "Not a character keystroke" | 600 (error 'no-character-typed (aref events 0))) |
597 (aref events 0))) | |
598 ;; If we're not erroring, loop until we get a character | 601 ;; If we're not erroring, loop until we get a character |
599 (setq events [])) | 602 (setq events [])) |
600 (if timeout (disable-timeout timeout)))))) | 603 (if timeout (disable-timeout timeout)))))) |
601 ;; Because of byte compiler limitations, each function has its own copy of | 604 ;; Because of byte compiler limitations, each function has its own copy of |
602 ;; #'read-char-1, so why not inline it. | 605 ;; #'read-char-1, so why not inline it. |