aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2007-04-01 22:03:22 +0000
committerChong Yidong2007-04-01 22:03:22 +0000
commit55665fe72ad7badee0fc15674f4714e6cbcb3c14 (patch)
tree17a830abf46adcc9a2a849ec1d38cec142d53a07 /src
parent9be34f7f0846a62777cd132deb75ef5f6818bc53 (diff)
downloademacs-55665fe72ad7badee0fc15674f4714e6cbcb3c14.tar.gz
emacs-55665fe72ad7badee0fc15674f4714e6cbcb3c14.zip
(Fcommand_remapping): New optional argument.
(where_is_internal): Use new keymaps argument. (Fkey_binding): Caller changed.
Diffstat (limited to 'src')
-rw-r--r--src/keymap.c50
1 files changed, 30 insertions, 20 deletions
diff --git a/src/keymap.c b/src/keymap.c
index 501f4683398..89b880c65ae 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1224,23 +1224,42 @@ binding KEY to DEF is added at the front of KEYMAP. */)
1224 1224
1225/* This function may GC (it calls Fkey_binding). */ 1225/* This function may GC (it calls Fkey_binding). */
1226 1226
1227DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 2, 0, 1227DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 3, 0,
1228 doc: /* Return the remapping for command COMMAND in current keymaps. 1228 doc: /* Return the remapping for command COMMAND.
1229Returns nil if COMMAND is not remapped (or not a symbol). 1229Returns nil if COMMAND is not remapped (or not a symbol).
1230 1230
1231If the optional argument POSITION is non-nil, it specifies a mouse 1231If the optional argument POSITION is non-nil, it specifies a mouse
1232position as returned by `event-start' and `event-end', and the 1232position as returned by `event-start' and `event-end', and the
1233remapping occurs in the keymaps associated with it. It can also be a 1233remapping occurs in the keymaps associated with it. It can also be a
1234number or marker, in which case the keymap properties at the specified 1234number or marker, in which case the keymap properties at the specified
1235buffer position instead of point are used. */) 1235buffer position instead of point are used. The KEYMAPS argument is
1236 (command, position) 1236ignored if POSITION is non-nil.
1237 Lisp_Object command, position; 1237
1238If the optional argument KEYMAPS is non-nil, it should be a list of
1239keymaps to search for command remapping. Otherwise, search for the
1240remapping in all currently active keymaps. */)
1241 (command, position, keymaps)
1242 Lisp_Object command, position, keymaps;
1238{ 1243{
1239 if (!SYMBOLP (command)) 1244 if (!SYMBOLP (command))
1240 return Qnil; 1245 return Qnil;
1241 1246
1242 ASET (command_remapping_vector, 1, command); 1247 ASET (command_remapping_vector, 1, command);
1243 return Fkey_binding (command_remapping_vector, Qnil, Qt, position); 1248
1249 if (NILP (keymaps))
1250 return Fkey_binding (command_remapping_vector, Qnil, Qt, position);
1251 else
1252 {
1253 Lisp_Object maps, binding;
1254
1255 for (maps = keymaps; !NILP (maps); maps = Fcdr (maps))
1256 {
1257 binding = Flookup_key (Fcar (maps), command_remapping_vector, Qnil);
1258 if (!NILP (binding) && !INTEGERP (binding))
1259 return binding;
1260 }
1261 return Qnil;
1262 }
1244} 1263}
1245 1264
1246/* Value is number if KEY is too long; nil if valid but has no definition. */ 1265/* Value is number if KEY is too long; nil if valid but has no definition. */
@@ -1770,7 +1789,7 @@ specified buffer position instead of point are used.
1770 if (NILP (no_remap) && SYMBOLP (value)) 1789 if (NILP (no_remap) && SYMBOLP (value))
1771 { 1790 {
1772 Lisp_Object value1; 1791 Lisp_Object value1;
1773 if (value1 = Fcommand_remapping (value, position), !NILP (value1)) 1792 if (value1 = Fcommand_remapping (value, position, Qnil), !NILP (value1))
1774 value = value1; 1793 value = value1;
1775 } 1794 }
1776 1795
@@ -2594,19 +2613,10 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap)
2594 2613
2595 /* If this command is remapped, then it has no key bindings 2614 /* If this command is remapped, then it has no key bindings
2596 of its own. */ 2615 of its own. */
2597 if (NILP (no_remap) && SYMBOLP (definition)) 2616 if (NILP (no_remap)
2598 { 2617 && SYMBOLP (definition)
2599 Lisp_Object kmaps, map, remap; 2618 && !NILP (Fcommand_remapping (definition, Qnil, keymaps)))
2600 2619 RETURN_UNGCPRO (Qnil);
2601 for (kmaps = maps; !NILP (kmaps); kmaps = Fcdr (kmaps))
2602 if (map = Fcdr (Fcar (kmaps)), KEYMAPP (map))
2603 {
2604 ASET (command_remapping_vector, 1, definition);
2605 remap = Flookup_key (map, command_remapping_vector, Qnil);
2606 if (!NILP (remap) && !INTEGERP (remap))
2607 RETURN_UNGCPRO (Qnil);
2608 }
2609 }
2610 2620
2611 for (; !NILP (maps); maps = Fcdr (maps)) 2621 for (; !NILP (maps); maps = Fcdr (maps))
2612 { 2622 {