aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2010-05-31 15:35:04 -0400
committerStefan Monnier2010-05-31 15:35:04 -0400
commit1ab8293c369c39375d17e50b0664b2d20f7b7871 (patch)
treedbe9d8daaeb46c6e047faf8dd5246af8b304fb5c /src
parent896114cf6401b58e1aaa66736d726779d087f166 (diff)
downloademacs-1ab8293c369c39375d17e50b0664b2d20f7b7871.tar.gz
emacs-1ab8293c369c39375d17e50b0664b2d20f7b7871.zip
* src/keymap.c (Fwhere_is_internal): Fix handling of remapping (in thread
of bug#6305).
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/keymap.c36
2 files changed, 27 insertions, 14 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2bf7617b4e8..4e0b04def0c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12010-05-31 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * keymap.c (Fwhere_is_internal): Fix handling of remapping (in thread
4 of bug#6305).
5
12010-05-27 Chong Yidong <cyd@stupidchicken.com> 62010-05-27 Chong Yidong <cyd@stupidchicken.com>
2 7
3 * xdisp.c (redisplay_window): After redisplay, check if point is 8 * xdisp.c (redisplay_window): After redisplay, check if point is
diff --git a/src/keymap.c b/src/keymap.c
index 88e0687272f..53b6795d623 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -2829,16 +2829,16 @@ remapped command in the returned list. */)
2829 Lisp_Object found = Qnil; 2829 Lisp_Object found = Qnil;
2830 /* 1 means ignore all menu bindings entirely. */ 2830 /* 1 means ignore all menu bindings entirely. */
2831 int nomenus = !NILP (firstonly) && !EQ (firstonly, Qnon_ascii); 2831 int nomenus = !NILP (firstonly) && !EQ (firstonly, Qnon_ascii);
2832 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 2832 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
2833 /* List of sequences found via remapping. Keep them in a separate 2833 /* List of sequences found via remapping. Keep them in a separate
2834 variable, so as to push them later, since we prefer 2834 variable, so as to push them later, since we prefer
2835 non-remapped binding. */ 2835 non-remapped binding. */
2836 Lisp_Object remapped_sequences = Qnil; 2836 Lisp_Object remapped_sequences = Qnil;
2837 /* Whether or not we're handling remapped sequences. This is needed 2837 /* Whether or not we're handling remapped sequences. This is needed
2838 because remapping is not done recursively by Fcommand_remapping: you 2838 because remapping is not done recursively by Fcommand_remapping: you
2839 can't remap and remapped command. */ 2839 can't remap a remapped command. */
2840 int remapped = 0; 2840 int remapped = 0;
2841 Lisp_Object tem; 2841 Lisp_Object tem = Qnil;
2842 2842
2843 /* Refresh the C version of the modifier preference. */ 2843 /* Refresh the C version of the modifier preference. */
2844 where_is_preferred_modifier 2844 where_is_preferred_modifier
@@ -2852,17 +2852,25 @@ remapped command in the returned list. */)
2852 else 2852 else
2853 keymaps = Fcurrent_active_maps (Qnil, Qnil); 2853 keymaps = Fcurrent_active_maps (Qnil, Qnil);
2854 2854
2855 GCPRO5 (definition, keymaps, found, sequences, remapped_sequences); 2855 GCPRO6 (definition, keymaps, found, sequences, remapped_sequences, tem);
2856 2856
2857 /* If this command is remapped, then it has no key bindings of its own. 2857 tem = Fcommand_remapping (definition, Qnil, keymaps);
2858 FIXME: Actually, this is not quite right: if A is remapped to 2858 /* If `definition' is remapped to tem', then OT1H no key will run
2859 `definition', then bindings to A will actually bind the key to 2859 that command (since they will run `tem' instead), so we should
2860 `definition' despite the remapping from `definition' to something else. 2860 return nil; but OTOH all keys bound to `definition' (or to `tem')
2861 Another corner case is if `definition' is remapped to itself. */ 2861 will run the same command.
2862 if (NILP (no_remap) 2862 So for menu-shortcut purposes, we want to find all the keys bound (maybe
2863 && SYMBOLP (definition) 2863 via remapping) to `tem'. But for the purpose of finding the keys that
2864 && !NILP (Fcommand_remapping (definition, Qnil, keymaps))) 2864 run `definition', then we'd want to just return nil.
2865 RETURN_UNGCPRO (Qnil); 2865 We choose to make it work right for menu-shortcuts, since it's the most
2866 common use.
2867 Known bugs: if you remap switch-to-buffer to toto, C-h f switch-to-buffer
2868 will tell you that switch-to-buffer is bound to C-x b even though C-x b
2869 will run toto instead. And if `toto' is itself remapped to forward-char,
2870 then C-h f toto will tell you that it's bound to C-f even though C-f does
2871 not run toto and it won't tell you that C-x b does run toto. */
2872 if (NILP (no_remap) && !NILP (tem))
2873 definition = tem;
2866 2874
2867 if (SYMBOLP (definition) 2875 if (SYMBOLP (definition)
2868 && !NILP (firstonly) 2876 && !NILP (firstonly)