Mercurial > hg > xemacs-beta
changeset 5371:6f10ac29bf40
Be better about searching for chars typed via XIM and x-compose.el, isearch
lisp/ChangeLog addition:
2011-03-12 Aidan Kehoe <kehoea@parhasard.net>
* isearch-mode.el (isearch-mode-map):
Document why we bind the ASCII characters to isearch-printing-char
in more detail.
* isearch-mode.el (isearch-maybe-frob-keyboard-macros):
If `this-command' is nil and the keys typed would normally be
bound to `self-insert-command' in the global map, force
`isearch-printing-char' to be called with an appropriate value for
last-command-event. Addresses an issue where searching for
characters generated from x-compose.el and XIM threw errors for me
in dired.
src/ChangeLog addition:
2011-03-12 Aidan Kehoe <kehoea@parhasard.net>
* event-stream.c (Fdispatch_event):
As documented, allow pre-command-hook to usefully modify
this-command even when this-command is nil (that is, we would
normally throw an undefined-keystroke-sequence error). Don't throw
that error if this-command was modified, instead try to execute
the new value.
Allow pre-command-hook to modify last-command-event in this
specific context. Don't document this, for the moment.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sat, 12 Mar 2011 13:11:31 +0000 |
parents | 4c4b96b13f70 |
children | 6c3a695f54f5 |
files | lisp/ChangeLog lisp/isearch-mode.el src/ChangeLog src/event-stream.c |
diffstat | 4 files changed, 74 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Fri Mar 11 20:40:01 2011 +0000 +++ b/lisp/ChangeLog Sat Mar 12 13:11:31 2011 +0000 @@ -1,3 +1,16 @@ +2011-03-12 Aidan Kehoe <kehoea@parhasard.net> + + * isearch-mode.el (isearch-mode-map): + Document why we bind the ASCII characters to isearch-printing-char + in more detail. + * isearch-mode.el (isearch-maybe-frob-keyboard-macros): + If `this-command' is nil and the keys typed would normally be + bound to `self-insert-command' in the global map, force + `isearch-printing-char' to be called with an appropriate value for + last-command-event. Addresses an issue where searching for + characters generated from x-compose.el and XIM threw errors for me + in dired. + 2011-03-10 Aidan Kehoe <kehoea@parhasard.net> * etags.el (buffer-tag-table-list):
--- a/lisp/isearch-mode.el Fri Mar 11 20:40:01 2011 +0000 +++ b/lisp/isearch-mode.el Sat Mar 12 13:11:31 2011 +0000 @@ -239,10 +239,18 @@ (let ((map (make-keymap))) (set-keymap-name map 'isearch-mode-map) - ;; Bind all printing characters to `isearch-printing-char'. - ;; This isn't normally necessary, but if a printing character were - ;; bound to something other than self-insert-command in global-map, - ;; then it would terminate the search and be executed without this. + ;; Bind ASCII printing characters to `isearch-printing-char'. This + ;; isn't normally necessary, but if a printing character were bound to + ;; something other than self-insert-command in global-map, then it would + ;; terminate the search and be executed without this. + + ;; This is also relevant when other modes (notably dired and gnus) call + ;; `suppress-keymap' on their major mode maps; this means that + ;; `isearch-maybe-frob-keyboard-macros' won't pick up that the command + ;; that would normally be executed is `self-insert-command' and do its + ;; thing of transforming that to `isearch-printing-char'. This is less + ;; of an issue for the non-ASCII characters, because they rarely have + ;; specific bindings in major modes. (let ((i 32) (str (make-string 1 0))) (while (< i 127) @@ -1609,8 +1617,27 @@ last-command-char (and (stringp this-command) (aref this-command 0)) this-command 'isearch-printing-char)) - )) - + ((and (null this-command) + (eq 'key-press (event-type last-command-event)) + (current-local-map) + (let* ((this-command-keys (this-command-keys)) + (this-command-keys (or (lookup-key function-key-map + this-command-keys) + this-command-keys)) + (lookup-key (lookup-key global-map this-command-keys))) + (and (eq 'self-insert-command lookup-key) + ;; The feature here that a modification of + ;; last-command-event is respected is undocumented, and + ;; only applies when this-command is nil. The design + ;; isn't reat, and I welcome suggestions for a better + ;; one. + (setq last-command-event + (find-if 'key-press-event-p this-command-keys + :from-end t) + last-command-char + (event-to-character last-command-event) + this-command 'isearch-printing-char))))))) + ;;;======================================================== ;;; Highlighting
--- a/src/ChangeLog Fri Mar 11 20:40:01 2011 +0000 +++ b/src/ChangeLog Sat Mar 12 13:11:31 2011 +0000 @@ -1,3 +1,14 @@ +2011-03-12 Aidan Kehoe <kehoea@parhasard.net> + + * event-stream.c (Fdispatch_event): + As documented, allow pre-command-hook to usefully modify + this-command even when this-command is nil (that is, we would + normally throw an undefined-keystroke-sequence error). Don't throw + that error if this-command was modified, instead try to execute + the new value. + Allow pre-command-hook to modify last-command-event in this + specific context. Don't document this, for the moment. + 2011-03-11 Aidan Kehoe <kehoea@parhasard.net> * bytecode.c (optimize_byte_code):
--- a/src/event-stream.c Fri Mar 11 20:40:01 2011 +0000 +++ b/src/event-stream.c Sat Mar 12 13:11:31 2011 +0000 @@ -4445,6 +4445,7 @@ { Lisp_Object leaf = lookup_command_event (command_builder, event, 1); + lookedup: if (KEYMAPP (leaf)) /* Incomplete key sequence */ break; @@ -4524,6 +4525,22 @@ GCPRO1 (keys); pre_command_hook (); UNGCPRO; + + if (!NILP (Vthis_command)) + { + /* Allow pre-command-hook to change the command to + something more useful, and avoid barfing. */ + leaf = Vthis_command; + if (!EQ (command_builder->most_current_event, + Vlast_command_event)) + { + reset_current_events (command_builder); + command_builder_append_event (command_builder, + Vlast_command_event); + } + goto lookedup; + } + /* The post-command-hook doesn't run. */ Fsignal (Qundefined_keystroke_sequence, list1 (keys)); }