changeset 5692:be87f507f510

Handle interactive command remapping a little better than 7371081ce8f7, keymap.c src/ChangeLog addition: 2012-11-06 Aidan Kehoe <kehoea@parhasard.net> * keymap.c (event_binding): Do command remapping here for interactive lookups; avoids a relatively expensive repeated call to get_relevant_keymaps(), as was necessary in 7371081ce8f7 (which changeset has been backed out). lisp/ChangeLog addition: 2012-10-14 Aidan Kehoe <kehoea@parhasard.net> * help.el: * help.el (describe-function-1): Add some newlines here when dealing with remapped commands, thank you Robert Pluim.
author Aidan Kehoe <kehoea@parhasard.net>
date Tue, 06 Nov 2012 22:27:15 +0000
parents b490ddbd42aa
children 4d15e903800b
files lisp/ChangeLog lisp/help.el src/ChangeLog src/keymap.c
diffstat 4 files changed, 32 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Nov 06 21:34:15 2012 +0000
+++ b/lisp/ChangeLog	Tue Nov 06 22:27:15 2012 +0000
@@ -1,3 +1,10 @@
+2012-10-14  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* help.el:
+	* help.el (describe-function-1):
+	Add some newlines here when dealing with remapped commands, thank
+	you Robert Pluim.
+
 2012-10-13  Mats Lidell  <matsl@xemacs.org>
 
 	* process.el (call-process-shell-command): New function from GNU.
--- a/lisp/help.el	Tue Nov 06 21:34:15 2012 +0000
+++ b/lisp/help.el	Tue Nov 06 22:27:15 2012 +0000
@@ -1544,10 +1544,10 @@
                                    (format "\n\\[%s]" function))))
                        (when commands-remapped-to
                          (if (cdr commands-remapped-to)
-                             (princ (format "The following functions are \
+                             (princ (format "\n\nThe following functions are \
 remapped to it:\n`%s'" (mapconcat #'prin1-to-string commands-remapped-to
                                   "', `")))
-                           (princ (format "`%s' is remapped to it.\n"
+                           (princ (format "\n\n`%s' is remapped to it.\n"
                                           (car
                                            commands-remapped-to))))))))))))))
 
--- a/src/ChangeLog	Tue Nov 06 21:34:15 2012 +0000
+++ b/src/ChangeLog	Tue Nov 06 22:27:15 2012 +0000
@@ -1,3 +1,11 @@
+2012-11-06  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* keymap.c (event_binding):
+	Do command remapping here for interactive lookups; avoids a
+	relatively expensive repeated call to get_relevant_keymaps(), as
+	was necessary in 7371081ce8f7 (which changeset has been backed
+	out).
+
 2012-10-14  Aidan Kehoe  <kehoea@parhasard.net>
 
 	Respect face and display table information in the minibuffer
--- a/src/keymap.c	Tue Nov 06 21:34:15 2012 +0000
+++ b/src/keymap.c	Tue Nov 06 22:27:15 2012 +0000
@@ -2996,7 +2996,7 @@
 event_binding (Lisp_Object event0, int accept_default)
 {
   /* This function can GC */
-  Lisp_Object maps[100];
+  Lisp_Object maps[100], result;
   int nmaps;
 
   assert (EVENTP (event0));
@@ -3004,8 +3004,20 @@
   nmaps = get_relevant_keymaps (event0, Qnil, countof (maps), maps);
   if (nmaps > countof (maps))
     nmaps = countof (maps);
-  return process_event_binding_result (lookup_events (event0, nmaps, maps,
-						      accept_default));
+
+  result = process_event_binding_result (lookup_events (event0, nmaps, maps,
+							accept_default));
+
+  if (!NILP (result) && SYMBOLP (result))
+    {
+      Lisp_Object remap = command_remapping (result, nmaps, maps);
+      if (!NILP (remap))
+	{
+	  result = remap;
+	}
+    }
+
+  return result;
 }
 
 /* like event_binding, but specify a keymap to search */