diff src/keymap.c @ 104922:c603ee2aac17

* keymap.c (QCadvertised_binding): New constant. (syms_of_keymap): Initialize it. (Fwhere_is_internal): Try and use bindings from :advertised-binding if applicable. * progmodes/xscheme.el (xscheme-evaluation-commands): Put a :advertised-binding property rather than using advertised-xscheme-send-previous-expression. (advertised-xscheme-send-previous-expression): Declare obsolete. * emulation/crisp.el (crisp-mode-map): Use `undo' rather than `advertised-undo'. (crisp-mode): Add corresponding bindings to undo's :advertised-binding instead. * dired.el (dired-mode-map): Put a :advertised-binding property rather than using dired-advertised-find-file. (dired-advertised-find-file): * simple.el (advertised-undo): * wid-edit.el (advertised-widget-backward): Declare obsolete. (widget-keymap): Put a :advertised-binding property rather than using advertised-widget-backward. * bindings.el (ctl-x-map): Put a :advertised-binding property rather than using advertised-undo. * tutorial.el (tutorial--default-keys): Adjust accordingly.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 11 Sep 2009 00:58:59 +0000
parents ad7987e70109
children 54e4fb84ea5d
line wrap: on
line diff
--- a/src/keymap.c	Thu Sep 10 19:17:56 2009 +0000
+++ b/src/keymap.c	Fri Sep 11 00:58:59 2009 +0000
@@ -97,6 +97,7 @@
 Lisp_Object Vdefine_key_rebound_commands;
 
 Lisp_Object Qkeymapp, Qkeymap, Qnon_ascii, Qmenu_item, Qremap;
+Lisp_Object QCadvertised_binding;
 
 /* Alist of elements like (DEL . "\d").  */
 static Lisp_Object exclude_keys;
@@ -2818,6 +2819,7 @@
      because remapping is not done recursively by Fcommand_remapping: you
      can't remap and remapped command.  */
   int remapped = 0;
+  Lisp_Object tem;
 
   /* Refresh the C version of the modifier preference.  */
   where_is_preferred_modifier
@@ -2843,6 +2845,20 @@
       && !NILP (Fcommand_remapping (definition, Qnil, keymaps)))
     RETURN_UNGCPRO (Qnil);
 
+  if (SYMBOLP (definition)
+      && !NILP (firstonly)
+      && !NILP (tem = Fget (definition, QCadvertised_binding)))
+    {
+      /* We have a list of advertized bindings.  */
+      while (CONSP (tem))
+	if (EQ (shadow_lookup (keymaps, XCAR (tem), Qnil), definition))
+	  return XCAR (tem);
+	else
+	  tem = XCDR (tem);
+      if (EQ (shadow_lookup (keymaps, tem, Qnil), definition))
+	return tem;
+    }
+
   sequences = Freverse (where_is_internal (definition, keymaps,
 					   !NILP (noindirect), nomenus));
 
@@ -4036,6 +4052,9 @@
   Qremap = intern ("remap");
   staticpro (&Qremap);
 
+  QCadvertised_binding = intern (":advertised-binding");
+  staticpro (&QCadvertised_binding);
+
   command_remapping_vector = Fmake_vector (make_number (2), Qremap);
   staticpro (&command_remapping_vector);