diff options
| author | Richard M. Stallman | 1994-02-04 23:11:34 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-02-04 23:11:34 +0000 |
| commit | f0148b5e8a42cdaf6e66e9d035dd1adcb6a7b94e (patch) | |
| tree | 5a21de76219aef6f58b33061cb9a06c1cf5b0e3b /src/keymap.c | |
| parent | 9a425dcb39e07b6cda4c7ba217162fdc9aa3aeb7 (diff) | |
| download | emacs-f0148b5e8a42cdaf6e66e9d035dd1adcb6a7b94e.tar.gz emacs-f0148b5e8a42cdaf6e66e9d035dd1adcb6a7b94e.zip | |
(Fwhere_is_internal): Take just one keymap arg.
(where_is_string): Pass Voverriding_local_map for that arg.
Diffstat (limited to 'src/keymap.c')
| -rw-r--r-- | src/keymap.c | 65 |
1 files changed, 46 insertions, 19 deletions
diff --git a/src/keymap.c b/src/keymap.c index 08d87a98f08..399292a1314 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Manipulation of keymaps | 1 | /* Manipulation of keymaps |
| 2 | Copyright (C) 1985, 1986, 1987, 1988, 1993 Free Software Foundation, Inc. | 2 | Copyright (C) 1985, 86, 87, 88, 93, 94 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is part of GNU Emacs. | 4 | This file is part of GNU Emacs. |
| 5 | 5 | ||
| @@ -1457,36 +1457,58 @@ ascii_sequence_p (seq) | |||
| 1457 | 1457 | ||
| 1458 | /* where-is - finding a command in a set of keymaps. */ | 1458 | /* where-is - finding a command in a set of keymaps. */ |
| 1459 | 1459 | ||
| 1460 | DEFUN ("where-is-internal", Fwhere_is_internal, Swhere_is_internal, 1, 5, 0, | 1460 | DEFUN ("where-is-internal", Fwhere_is_internal, Swhere_is_internal, 1, 4, 0, |
| 1461 | "Return list of keys that invoke DEFINITION in KEYMAP or KEYMAP1.\n\ | 1461 | "Return list of keys that invoke DEFINITION.\n\ |
| 1462 | If KEYMAP is nil, search only KEYMAP1.\n\ | 1462 | If KEYMAP is non-nil, search only KEYMAP and the global keymap.\n\ |
| 1463 | If KEYMAP1 is nil, use the current global map.\n\ | 1463 | If KEYMAP is nil, search all the currently active keymaps.\n\ |
| 1464 | \n\ | 1464 | \n\ |
| 1465 | If optional 4th arg FIRSTONLY is non-nil, return the first key sequence found,\n\ | 1465 | If optional 3rd arg FIRSTONLY is non-nil, return the first key sequence found,\n\ |
| 1466 | rather than a list of all possible key sequences.\n\ | 1466 | rather than a list of all possible key sequences.\n\ |
| 1467 | If FIRSTONLY is t, avoid key sequences which use non-ASCII\n\ | 1467 | If FIRSTONLY is t, avoid key sequences which use non-ASCII\n\ |
| 1468 | keys and therefore may not be usable on ASCII terminals. If FIRSTONLY\n\ | 1468 | keys and therefore may not be usable on ASCII terminals. If FIRSTONLY\n\ |
| 1469 | is the symbol `non-ascii', return the first binding found, no matter\n\ | 1469 | is the symbol `non-ascii', return the first binding found, no matter\n\ |
| 1470 | what its components.\n\ | 1470 | what its components.\n\ |
| 1471 | \n\ | 1471 | \n\ |
| 1472 | If optional 5th arg NOINDIRECT is non-nil, don't follow indirections\n\ | 1472 | If optional 4th arg NOINDIRECT is non-nil, don't follow indirections\n\ |
| 1473 | to other keymaps or slots. This makes it possible to search for an\n\ | 1473 | to other keymaps or slots. This makes it possible to search for an\n\ |
| 1474 | indirect definition itself.") | 1474 | indirect definition itself.") |
| 1475 | (definition, local_keymap, global_keymap, firstonly, noindirect) | 1475 | (definition, keymap, firstonly, noindirect) |
| 1476 | Lisp_Object definition, local_keymap, global_keymap; | 1476 | Lisp_Object definition, keymap; |
| 1477 | Lisp_Object firstonly, noindirect; | 1477 | Lisp_Object firstonly, noindirect; |
| 1478 | { | 1478 | { |
| 1479 | register Lisp_Object maps; | 1479 | register Lisp_Object maps; |
| 1480 | Lisp_Object found; | 1480 | Lisp_Object found; |
| 1481 | int keymap_specified = !NILP (keymap); | ||
| 1481 | 1482 | ||
| 1482 | if (NILP (global_keymap)) | 1483 | if (! keymap_specified) |
| 1483 | global_keymap = current_global_map; | 1484 | { |
| 1485 | #ifdef USE_TEXT_PROPERTIES | ||
| 1486 | keymap = get_local_map (PT, current_buffer); | ||
| 1487 | #else | ||
| 1488 | keymap = current_buffer->keymap; | ||
| 1489 | #endif | ||
| 1490 | } | ||
| 1484 | 1491 | ||
| 1485 | if (!NILP (local_keymap)) | 1492 | if (!NILP (keymap)) |
| 1486 | maps = nconc2 (Faccessible_keymaps (get_keymap (local_keymap), Qnil), | 1493 | maps = nconc2 (Faccessible_keymaps (get_keymap (keymap), Qnil), |
| 1487 | Faccessible_keymaps (get_keymap (global_keymap), Qnil)); | 1494 | Faccessible_keymaps (get_keymap (current_global_map), |
| 1495 | Qnil)); | ||
| 1488 | else | 1496 | else |
| 1489 | maps = Faccessible_keymaps (get_keymap (global_keymap), Qnil); | 1497 | maps = Faccessible_keymaps (get_keymap (current_global_map), Qnil); |
| 1498 | |||
| 1499 | /* Put the minor mode keymaps on the front. */ | ||
| 1500 | if (! keymap_specified) | ||
| 1501 | { | ||
| 1502 | Lisp_Object minors; | ||
| 1503 | minors = Fnreverse (Fcurrent_minor_mode_maps ()); | ||
| 1504 | while (!NILP (minors)) | ||
| 1505 | { | ||
| 1506 | maps = nconc2 (Faccessible_keymaps (get_keymap (XCONS (minors)->car), | ||
| 1507 | Qnil), | ||
| 1508 | maps); | ||
| 1509 | minors = XCONS (minors)->cdr; | ||
| 1510 | } | ||
| 1511 | } | ||
| 1490 | 1512 | ||
| 1491 | found = Qnil; | 1513 | found = Qnil; |
| 1492 | 1514 | ||
| @@ -1596,9 +1618,9 @@ indirect definition itself.") | |||
| 1596 | 1618 | ||
| 1597 | Either nil or number as value from Flookup_key | 1619 | Either nil or number as value from Flookup_key |
| 1598 | means undefined. */ | 1620 | means undefined. */ |
| 1599 | if (!NILP (local_keymap)) | 1621 | if (keymap_specified) |
| 1600 | { | 1622 | { |
| 1601 | binding = Flookup_key (local_keymap, sequence, Qnil); | 1623 | binding = Flookup_key (keymap, sequence, Qnil); |
| 1602 | if (!NILP (binding) && XTYPE (binding) != Lisp_Int) | 1624 | if (!NILP (binding) && XTYPE (binding) != Lisp_Int) |
| 1603 | { | 1625 | { |
| 1604 | if (XTYPE (definition) == Lisp_Cons) | 1626 | if (XTYPE (definition) == Lisp_Cons) |
| @@ -1613,6 +1635,12 @@ indirect definition itself.") | |||
| 1613 | continue; | 1635 | continue; |
| 1614 | } | 1636 | } |
| 1615 | } | 1637 | } |
| 1638 | else | ||
| 1639 | { | ||
| 1640 | binding = Fkey_binding (sequence, Qnil); | ||
| 1641 | if (!EQ (binding, definition)) | ||
| 1642 | continue; | ||
| 1643 | } | ||
| 1616 | 1644 | ||
| 1617 | /* It is a true unshadowed match. Record it. */ | 1645 | /* It is a true unshadowed match. Record it. */ |
| 1618 | found = Fcons (sequence, found); | 1646 | found = Fcons (sequence, found); |
| @@ -1647,8 +1675,7 @@ where_is_string (definition) | |||
| 1647 | { | 1675 | { |
| 1648 | register Lisp_Object keys, keys1; | 1676 | register Lisp_Object keys, keys1; |
| 1649 | 1677 | ||
| 1650 | keys = Fwhere_is_internal (definition, | 1678 | keys = Fwhere_is_internal (definition, Voverriding_local_map, Qnil, Qnil); |
| 1651 | current_buffer->keymap, Qnil, Qnil, Qnil); | ||
| 1652 | keys1 = Fmapconcat (Qkey_description, keys, build_string (", ")); | 1679 | keys1 = Fmapconcat (Qkey_description, keys, build_string (", ")); |
| 1653 | 1680 | ||
| 1654 | return keys1; | 1681 | return keys1; |