[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Weired side-effect of using the remap feature in keymaps
From: |
Chong Yidong |
Subject: |
Re: Weired side-effect of using the remap feature in keymaps |
Date: |
Sat, 31 Mar 2007 11:58:19 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.96 (gnu/linux) |
> (defvar my-dummy-map (make-keymap))
> (define-key my-dummy-map
> (vector 'remap 'delete-backward-char) 'backward-char)
> (switch-to-buffer (get-buffer-create "foo"))
> (use-local-map my-dummy-map)
> (where-is-internal 'delete-backward-char global-map)
>
> This search seems to fail after the code above, i.e. something
> seems to have changed in global map which should not have changed.
The trouble is that when where_is_internal checks whether the command
you entered is remapped, it does so using Fcommand_remapping, which
looks at all currently-active keymaps. The alternative is to scan
through the provided keymaps manually.
The following patch should DTRT.
*** emacs/src/keymap.c.~1.348.~ 2007-03-24 21:19:54.000000000 -0400
--- emacs/src/keymap.c 2007-03-31 11:44:16.000000000 -0400
***************
*** 2579,2593 ****
/* 1 means ignore all menu bindings entirely. */
int nomenus = !NILP (firstonly) && !EQ (firstonly, Qnon_ascii);
- /* If this command is remapped, then it has no key bindings
- of its own. */
- if (NILP (no_remap) && SYMBOLP (definition))
- {
- Lisp_Object tem;
- if (tem = Fcommand_remapping (definition, Qnil), !NILP (tem))
- return Qnil;
- }
-
found = keymaps;
while (CONSP (found))
{
--- 2579,2584 ----
***************
*** 2601,2606 ****
--- 2592,2615 ----
found = Qnil;
sequences = Qnil;
+ /* If this command is remapped, then it has no key bindings
+ of its own. */
+ if (NILP (no_remap) && SYMBOLP (definition))
+ {
+ Lisp_Object check_maps, map, remap;
+
+ for (check_maps = maps;
+ !NILP (check_maps);
+ check_maps = Fcdr (check_maps))
+ {
+ map = Fcdr (Fcar (maps));
+ ASET (command_remapping_vector, 1, definition);
+ remap = Flookup_key (map, command_remapping_vector, Qnil);
+ if (!NILP (remap) && !INTEGERP (remap))
+ RETURN_UNGCPRO (Qnil);
+ }
+ }
+
for (; !NILP (maps); maps = Fcdr (maps))
{
/* Key sequence to reach map, and the map that it reaches */