From 8cb95edf7cdec140efb1c8dbf4f7f33320f0ca0c Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 11 Sep 2009 00:58:59 +0000 Subject: * 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. --- src/keymap.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src') diff --git a/src/keymap.c b/src/keymap.c index 4ffb071272c..7f539fd57b5 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -97,6 +97,7 @@ Lisp_Object Vemulation_mode_map_alists; 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 @@ remapped command in the returned list. */) 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 @@ remapped command in the returned list. */) && !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 @@ preferred. */); 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); -- cgit v1.2.1