diff src/event-stream.c @ 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 c096d8051f89
children 3889ef128488 ac37a5f7e5be
line wrap: on
line diff
--- 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));
 	      }