diff options
| author | Miles Bader | 2007-04-11 00:17:47 +0000 |
|---|---|---|
| committer | Miles Bader | 2007-04-11 00:17:47 +0000 |
| commit | 57cb2e6f261bb0aad81a9f7e6f3017b54adee068 (patch) | |
| tree | 6ceb46f2e3bf08f16468d77f4fbfd201f637596a /src/keymap.c | |
| parent | 3bd1d328e94787ac52ef6ba5dfec3b94ba23917a (diff) | |
| parent | c429815a6b9d271a57eed4956125f6bc89d1d72b (diff) | |
| download | emacs-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.c | 55 |
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 | ||
| 1260 | DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 2, 0, | 1260 | DEFUN ("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. |
| 1262 | Returns nil if COMMAND is not remapped (or not a symbol). | 1262 | Returns nil if COMMAND is not remapped (or not a symbol). |
| 1263 | 1263 | ||
| 1264 | If the optional argument POSITION is non-nil, it specifies a mouse | 1264 | If the optional argument POSITION is non-nil, it specifies a mouse |
| 1265 | position as returned by `event-start' and `event-end', and the | 1265 | position as returned by `event-start' and `event-end', and the |
| 1266 | remapping occurs in the keymaps associated with it. It can also be a | 1266 | remapping occurs in the keymaps associated with it. It can also be a |
| 1267 | number or marker, in which case the keymap properties at the specified | 1267 | number or marker, in which case the keymap properties at the specified |
| 1268 | buffer position instead of point are used. */) | 1268 | buffer position instead of point are used. The KEYMAPS argument is |
| 1269 | (command, position) | 1269 | ignored if POSITION is non-nil. |
| 1270 | Lisp_Object command, position; | 1270 | |
| 1271 | If the optional argument KEYMAPS is non-nil, it should be a list of | ||
| 1272 | keymaps to search for command remapping. Otherwise, search for the | ||
| 1273 | remapping 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) | |||
| 1434 | static Lisp_Object *cmm_modes = NULL, *cmm_maps = NULL; | 1453 | static Lisp_Object *cmm_modes = NULL, *cmm_maps = NULL; |
| 1435 | static int cmm_size = 0; | 1454 | static 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 */ |