aboutsummaryrefslogtreecommitdiffstats
path: root/src/keymap.c
diff options
context:
space:
mode:
authorMiles Bader2007-04-11 00:17:47 +0000
committerMiles Bader2007-04-11 00:17:47 +0000
commit57cb2e6f261bb0aad81a9f7e6f3017b54adee068 (patch)
tree6ceb46f2e3bf08f16468d77f4fbfd201f637596a /src/keymap.c
parent3bd1d328e94787ac52ef6ba5dfec3b94ba23917a (diff)
parentc429815a6b9d271a57eed4956125f6bc89d1d72b (diff)
downloademacs-57cb2e6f261bb0aad81a9f7e6f3017b54adee068.tar.gz
emacs-57cb2e6f261bb0aad81a9f7e6f3017b54adee068.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 675-697) - Update from CVS - Merge from gnus--rel--5.10 - Release ERC 5.2. * gnus--rel--5.10 (patch 211-215) - Update from CVS - Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-189
Diffstat (limited to 'src/keymap.c')
-rw-r--r--src/keymap.c55
1 files changed, 37 insertions, 18 deletions
diff --git a/src/keymap.c b/src/keymap.c
index a612b0d5c6c..d953df008d7 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1257,23 +1257,42 @@ binding KEY to DEF is added at the front of KEYMAP. */)
1257 1257
1258/* This function may GC (it calls Fkey_binding). */ 1258/* This function may GC (it calls Fkey_binding). */
1259 1259
1260DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 2, 0, 1260DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 3, 0,
1261 doc: /* Return the remapping for command COMMAND in current keymaps. 1261 doc: /* Return the remapping for command COMMAND.
1262Returns nil if COMMAND is not remapped (or not a symbol). 1262Returns nil if COMMAND is not remapped (or not a symbol).
1263 1263
1264If the optional argument POSITION is non-nil, it specifies a mouse 1264If the optional argument POSITION is non-nil, it specifies a mouse
1265position as returned by `event-start' and `event-end', and the 1265position as returned by `event-start' and `event-end', and the
1266remapping occurs in the keymaps associated with it. It can also be a 1266remapping occurs in the keymaps associated with it. It can also be a
1267number or marker, in which case the keymap properties at the specified 1267number or marker, in which case the keymap properties at the specified
1268buffer position instead of point are used. */) 1268buffer position instead of point are used. The KEYMAPS argument is
1269 (command, position) 1269ignored if POSITION is non-nil.
1270 Lisp_Object command, position; 1270
1271If the optional argument KEYMAPS is non-nil, it should be a list of
1272keymaps to search for command remapping. Otherwise, search for the
1273remapping in all currently active keymaps. */)
1274 (command, position, keymaps)
1275 Lisp_Object command, position, keymaps;
1271{ 1276{
1272 if (!SYMBOLP (command)) 1277 if (!SYMBOLP (command))
1273 return Qnil; 1278 return Qnil;
1274 1279
1275 ASET (command_remapping_vector, 1, command); 1280 ASET (command_remapping_vector, 1, command);
1276 return Fkey_binding (command_remapping_vector, Qnil, Qt, position); 1281
1282 if (NILP (keymaps))
1283 return Fkey_binding (command_remapping_vector, Qnil, Qt, position);
1284 else
1285 {
1286 Lisp_Object maps, binding;
1287
1288 for (maps = keymaps; !NILP (maps); maps = Fcdr (maps))
1289 {
1290 binding = Flookup_key (Fcar (maps), command_remapping_vector, Qnil);
1291 if (!NILP (binding) && !INTEGERP (binding))
1292 return binding;
1293 }
1294 return Qnil;
1295 }
1277} 1296}
1278 1297
1279/* Value is number if KEY is too long; nil if valid but has no definition. */ 1298/* Value is number if KEY is too long; nil if valid but has no definition. */
@@ -1434,8 +1453,10 @@ silly_event_symbol_error (c)
1434static Lisp_Object *cmm_modes = NULL, *cmm_maps = NULL; 1453static Lisp_Object *cmm_modes = NULL, *cmm_maps = NULL;
1435static int cmm_size = 0; 1454static int cmm_size = 0;
1436 1455
1437/* Store a pointer to an array of the keymaps of the currently active 1456/* Store a pointer to an array of the currently active minor modes in
1438 minor modes in *buf, and return the number of maps it contains. 1457 *modeptr, a pointer to an array of the keymaps of the currently
1458 active minor modes in *mapptr, and return the number of maps
1459 *mapptr contains.
1439 1460
1440 This function always returns a pointer to the same buffer, and may 1461 This function always returns a pointer to the same buffer, and may
1441 free or reallocate it, so if you want to keep it for a long time or 1462 free or reallocate it, so if you want to keep it for a long time or
@@ -1801,7 +1822,7 @@ specified buffer position instead of point are used.
1801 if (NILP (no_remap) && SYMBOLP (value)) 1822 if (NILP (no_remap) && SYMBOLP (value))
1802 { 1823 {
1803 Lisp_Object value1; 1824 Lisp_Object value1;
1804 if (value1 = Fcommand_remapping (value, position), !NILP (value1)) 1825 if (value1 = Fcommand_remapping (value, position, Qnil), !NILP (value1))
1805 value = value1; 1826 value = value1;
1806 } 1827 }
1807 1828
@@ -2546,15 +2567,6 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap)
2546 /* 1 means ignore all menu bindings entirely. */ 2567 /* 1 means ignore all menu bindings entirely. */
2547 int nomenus = !NILP (firstonly) && !EQ (firstonly, Qnon_ascii); 2568 int nomenus = !NILP (firstonly) && !EQ (firstonly, Qnon_ascii);
2548 2569
2549 /* If this command is remapped, then it has no key bindings
2550 of its own. */
2551 if (NILP (no_remap) && SYMBOLP (definition))
2552 {
2553 Lisp_Object tem;
2554 if (tem = Fcommand_remapping (definition, Qnil), !NILP (tem))
2555 return Qnil;
2556 }
2557
2558 found = keymaps; 2570 found = keymaps;
2559 while (CONSP (found)) 2571 while (CONSP (found))
2560 { 2572 {
@@ -2568,6 +2580,13 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap)
2568 found = Qnil; 2580 found = Qnil;
2569 sequences = Qnil; 2581 sequences = Qnil;
2570 2582
2583 /* If this command is remapped, then it has no key bindings
2584 of its own. */
2585 if (NILP (no_remap)
2586 && SYMBOLP (definition)
2587 && !NILP (Fcommand_remapping (definition, Qnil, keymaps)))
2588 RETURN_UNGCPRO (Qnil);
2589
2571 for (; !NILP (maps); maps = Fcdr (maps)) 2590 for (; !NILP (maps); maps = Fcdr (maps))
2572 { 2591 {
2573 /* Key sequence to reach map, and the map that it reaches */ 2592 /* Key sequence to reach map, and the map that it reaches */