diff options
Diffstat (limited to 'src/keymap.c')
| -rw-r--r-- | src/keymap.c | 181 |
1 files changed, 83 insertions, 98 deletions
diff --git a/src/keymap.c b/src/keymap.c index 0f61304a8e5..ccb39da186f 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -33,7 +33,6 @@ Boston, MA 02111-1307, USA. */ | |||
| 33 | #include "intervals.h" | 33 | #include "intervals.h" |
| 34 | 34 | ||
| 35 | #define min(a, b) ((a) < (b) ? (a) : (b)) | 35 | #define min(a, b) ((a) < (b) ? (a) : (b)) |
| 36 | #define KEYMAPP(m) (!NILP (Fkeymapp (m))) | ||
| 37 | 36 | ||
| 38 | /* The number of elements in keymap vectors. */ | 37 | /* The number of elements in keymap vectors. */ |
| 39 | #define DENSE_TABLE_SIZE (0200) | 38 | #define DENSE_TABLE_SIZE (0200) |
| @@ -190,8 +189,7 @@ is also allowed as an element.") | |||
| 190 | (object) | 189 | (object) |
| 191 | Lisp_Object object; | 190 | Lisp_Object object; |
| 192 | { | 191 | { |
| 193 | /* FIXME: Maybe this should return t for autoloaded keymaps? -sm */ | 192 | return (KEYMAPP (object) ? Qt : Qnil); |
| 194 | return (NILP (get_keymap_1 (object, 0, 0)) ? Qnil : Qt); | ||
| 195 | } | 193 | } |
| 196 | 194 | ||
| 197 | /* Check that OBJECT is a keymap (after dereferencing through any | 195 | /* Check that OBJECT is a keymap (after dereferencing through any |
| @@ -201,6 +199,9 @@ is also allowed as an element.") | |||
| 201 | is an autoload form, do the autoload and try again. | 199 | is an autoload form, do the autoload and try again. |
| 202 | If AUTOLOAD is nonzero, callers must assume GC is possible. | 200 | If AUTOLOAD is nonzero, callers must assume GC is possible. |
| 203 | 201 | ||
| 202 | If the map needs to be autoloaded, but AUTOLOAD is zero (and ERROR | ||
| 203 | is zero as well), return Qt. | ||
| 204 | |||
| 204 | ERROR controls how we respond if OBJECT isn't a keymap. | 205 | ERROR controls how we respond if OBJECT isn't a keymap. |
| 205 | If ERROR is non-zero, signal an error; otherwise, just return Qnil. | 206 | If ERROR is non-zero, signal an error; otherwise, just return Qnil. |
| 206 | 207 | ||
| @@ -214,7 +215,7 @@ is also allowed as an element.") | |||
| 214 | do_autoload which can GC. */ | 215 | do_autoload which can GC. */ |
| 215 | 216 | ||
| 216 | Lisp_Object | 217 | Lisp_Object |
| 217 | get_keymap_1 (object, error, autoload) | 218 | get_keymap (object, error, autoload) |
| 218 | Lisp_Object object; | 219 | Lisp_Object object; |
| 219 | int error, autoload; | 220 | int error, autoload; |
| 220 | { | 221 | { |
| @@ -225,32 +226,35 @@ get_keymap_1 (object, error, autoload) | |||
| 225 | goto end; | 226 | goto end; |
| 226 | if (CONSP (object) && EQ (XCAR (object), Qkeymap)) | 227 | if (CONSP (object) && EQ (XCAR (object), Qkeymap)) |
| 227 | return object; | 228 | return object; |
| 228 | else | ||
| 229 | { | ||
| 230 | tem = indirect_function (object); | ||
| 231 | if (CONSP (tem) && EQ (XCAR (tem), Qkeymap)) | ||
| 232 | return tem; | ||
| 233 | } | ||
| 234 | 229 | ||
| 235 | /* Should we do an autoload? Autoload forms for keymaps have | 230 | tem = indirect_function (object); |
| 236 | Qkeymap as their fifth element. */ | 231 | if (CONSP (tem)) |
| 237 | if (autoload | ||
| 238 | && SYMBOLP (object) | ||
| 239 | && CONSP (tem) | ||
| 240 | && EQ (XCAR (tem), Qautoload)) | ||
| 241 | { | 232 | { |
| 242 | Lisp_Object tail; | 233 | if (EQ (XCAR (tem), Qkeymap)) |
| 234 | return tem; | ||
| 243 | 235 | ||
| 244 | tail = Fnth (make_number (4), tem); | 236 | /* Should we do an autoload? Autoload forms for keymaps have |
| 245 | if (EQ (tail, Qkeymap)) | 237 | Qkeymap as their fifth element. */ |
| 238 | if ((autoload || !error) && EQ (XCAR (tem), Qautoload)) | ||
| 246 | { | 239 | { |
| 247 | struct gcpro gcpro1, gcpro2; | 240 | Lisp_Object tail; |
| 248 | |||
| 249 | GCPRO2 (tem, object); | ||
| 250 | do_autoload (tem, object); | ||
| 251 | UNGCPRO; | ||
| 252 | 241 | ||
| 253 | goto autoload_retry; | 242 | tail = Fnth (make_number (4), tem); |
| 243 | if (EQ (tail, Qkeymap)) | ||
| 244 | { | ||
| 245 | if (autoload) | ||
| 246 | { | ||
| 247 | struct gcpro gcpro1, gcpro2; | ||
| 248 | |||
| 249 | GCPRO2 (tem, object); | ||
| 250 | do_autoload (tem, object); | ||
| 251 | UNGCPRO; | ||
| 252 | |||
| 253 | goto autoload_retry; | ||
| 254 | } | ||
| 255 | else | ||
| 256 | return Qt; | ||
| 257 | } | ||
| 254 | } | 258 | } |
| 255 | } | 259 | } |
| 256 | 260 | ||
| @@ -259,16 +263,6 @@ get_keymap_1 (object, error, autoload) | |||
| 259 | wrong_type_argument (Qkeymapp, object); | 263 | wrong_type_argument (Qkeymapp, object); |
| 260 | return Qnil; | 264 | return Qnil; |
| 261 | } | 265 | } |
| 262 | |||
| 263 | |||
| 264 | /* Follow any symbol chaining, and return the keymap denoted by OBJECT. | ||
| 265 | If OBJECT doesn't denote a keymap at all, signal an error. */ | ||
| 266 | Lisp_Object | ||
| 267 | get_keymap (object) | ||
| 268 | Lisp_Object object; | ||
| 269 | { | ||
| 270 | return get_keymap_1 (object, 1, 0); | ||
| 271 | } | ||
| 272 | 266 | ||
| 273 | /* Return the parent map of the keymap MAP, or nil if it has none. | 267 | /* Return the parent map of the keymap MAP, or nil if it has none. |
| 274 | We assume that MAP is a valid keymap. */ | 268 | We assume that MAP is a valid keymap. */ |
| @@ -280,7 +274,7 @@ DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0, | |||
| 280 | { | 274 | { |
| 281 | Lisp_Object list; | 275 | Lisp_Object list; |
| 282 | 276 | ||
| 283 | keymap = get_keymap_1 (keymap, 1, 1); | 277 | keymap = get_keymap (keymap, 1, 1); |
| 284 | 278 | ||
| 285 | /* Skip past the initial element `keymap'. */ | 279 | /* Skip past the initial element `keymap'. */ |
| 286 | list = XCDR (keymap); | 280 | list = XCDR (keymap); |
| @@ -291,7 +285,7 @@ DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0, | |||
| 291 | return list; | 285 | return list; |
| 292 | } | 286 | } |
| 293 | 287 | ||
| 294 | return get_keymap_1(list, 0, 1); | 288 | return get_keymap (list, 0, 1); |
| 295 | } | 289 | } |
| 296 | 290 | ||
| 297 | 291 | ||
| @@ -327,12 +321,12 @@ PARENT should be nil or another keymap.") | |||
| 327 | This is a very minor correctness (rather than safety) issue. */ | 321 | This is a very minor correctness (rather than safety) issue. */ |
| 328 | where_is_cache_keymaps = Qt; | 322 | where_is_cache_keymaps = Qt; |
| 329 | 323 | ||
| 330 | keymap = get_keymap_1 (keymap, 1, 1); | 324 | keymap = get_keymap (keymap, 1, 1); |
| 331 | GCPRO1 (keymap); | 325 | GCPRO1 (keymap); |
| 332 | 326 | ||
| 333 | if (!NILP (parent)) | 327 | if (!NILP (parent)) |
| 334 | { | 328 | { |
| 335 | parent = get_keymap_1 (parent, 1, 1); | 329 | parent = get_keymap (parent, 1, 1); |
| 336 | 330 | ||
| 337 | /* Check for cycles. */ | 331 | /* Check for cycles. */ |
| 338 | if (keymap_memberp (keymap, parent)) | 332 | if (keymap_memberp (keymap, parent)) |
| @@ -404,22 +398,22 @@ fix_submap_inheritance (map, event, submap) | |||
| 404 | /* SUBMAP is a cons that we found as a key binding. | 398 | /* SUBMAP is a cons that we found as a key binding. |
| 405 | Discard the other things found in a menu key binding. */ | 399 | Discard the other things found in a menu key binding. */ |
| 406 | 400 | ||
| 407 | submap = get_keymap_1 (get_keyelt (submap, 0), 0, 0); | 401 | submap = get_keymap (get_keyelt (submap, 0), 0, 0); |
| 408 | 402 | ||
| 409 | /* If it isn't a keymap now, there's no work to do. */ | 403 | /* If it isn't a keymap now, there's no work to do. */ |
| 410 | if (NILP (submap)) | 404 | if (!CONSP (submap)) |
| 411 | return; | 405 | return; |
| 412 | 406 | ||
| 413 | map_parent = Fkeymap_parent (map); | 407 | map_parent = Fkeymap_parent (map); |
| 414 | if (! NILP (map_parent)) | 408 | if (!NILP (map_parent)) |
| 415 | parent_entry = | 409 | parent_entry = |
| 416 | get_keymap_1 (access_keymap (map_parent, event, 0, 0, 0), 0, 0); | 410 | get_keymap (access_keymap (map_parent, event, 0, 0, 0), 0, 0); |
| 417 | else | 411 | else |
| 418 | parent_entry = Qnil; | 412 | parent_entry = Qnil; |
| 419 | 413 | ||
| 420 | /* If MAP's parent has something other than a keymap, | 414 | /* If MAP's parent has something other than a keymap, |
| 421 | our own submap shadows it completely. */ | 415 | our own submap shadows it completely. */ |
| 422 | if (NILP (parent_entry)) | 416 | if (!CONSP (parent_entry)) |
| 423 | return; | 417 | return; |
| 424 | 418 | ||
| 425 | if (! EQ (parent_entry, submap)) | 419 | if (! EQ (parent_entry, submap)) |
| @@ -489,10 +483,10 @@ access_keymap (map, idx, t_ok, noinherit, autoload) | |||
| 489 | /* See if there is a meta-map. If there's none, there is | 483 | /* See if there is a meta-map. If there's none, there is |
| 490 | no binding for IDX, unless a default binding exists in MAP. */ | 484 | no binding for IDX, unless a default binding exists in MAP. */ |
| 491 | Lisp_Object meta_map = | 485 | Lisp_Object meta_map = |
| 492 | get_keymap_1 (access_keymap (map, meta_prefix_char, | 486 | get_keymap (access_keymap (map, meta_prefix_char, |
| 493 | t_ok, noinherit, autoload), | 487 | t_ok, noinherit, autoload), |
| 494 | 0, autoload); | 488 | 0, autoload); |
| 495 | if (!NILP (meta_map)) | 489 | if (CONSP (meta_map)) |
| 496 | { | 490 | { |
| 497 | map = meta_map; | 491 | map = meta_map; |
| 498 | idx = make_number (XUINT (idx) & ~meta_modifier); | 492 | idx = make_number (XUINT (idx) & ~meta_modifier); |
| @@ -512,8 +506,7 @@ access_keymap (map, idx, t_ok, noinherit, autoload) | |||
| 512 | t_binding = Qnil; | 506 | t_binding = Qnil; |
| 513 | for (tail = XCDR (map); | 507 | for (tail = XCDR (map); |
| 514 | (CONSP (tail) | 508 | (CONSP (tail) |
| 515 | || (tail = get_keymap_1 (tail, 0, autoload), | 509 | || (tail = get_keymap (tail, 0, autoload), CONSP (tail))); |
| 516 | CONSP (tail))); | ||
| 517 | tail = XCDR (tail)) | 510 | tail = XCDR (tail)) |
| 518 | { | 511 | { |
| 519 | Lisp_Object binding; | 512 | Lisp_Object binding; |
| @@ -666,8 +659,8 @@ get_keyelt (object, autoload) | |||
| 666 | else | 659 | else |
| 667 | { | 660 | { |
| 668 | Lisp_Object map; | 661 | Lisp_Object map; |
| 669 | map = get_keymap_1 (Fcar_safe (object), 0, autoload); | 662 | map = get_keymap (Fcar_safe (object), 0, autoload); |
| 670 | return (NILP (map) ? object /* Invalid keymap */ | 663 | return (!CONSP (map) ? object /* Invalid keymap */ |
| 671 | : access_keymap (map, Fcdr (object), 0, 0, autoload)); | 664 | : access_keymap (map, Fcdr (object), 0, 0, autoload)); |
| 672 | } | 665 | } |
| 673 | } | 666 | } |
| @@ -780,7 +773,7 @@ void | |||
| 780 | copy_keymap_1 (chartable, idx, elt) | 773 | copy_keymap_1 (chartable, idx, elt) |
| 781 | Lisp_Object chartable, idx, elt; | 774 | Lisp_Object chartable, idx, elt; |
| 782 | { | 775 | { |
| 783 | if (!SYMBOLP (elt) && ! NILP (Fkeymapp (elt))) | 776 | if (CONSP (elt) && EQ (XCAR (elt), Qkeymap)) |
| 784 | Faset (chartable, idx, Fcopy_keymap (elt)); | 777 | Faset (chartable, idx, Fcopy_keymap (elt)); |
| 785 | } | 778 | } |
| 786 | 779 | ||
| @@ -796,7 +789,7 @@ is not copied.") | |||
| 796 | { | 789 | { |
| 797 | register Lisp_Object copy, tail; | 790 | register Lisp_Object copy, tail; |
| 798 | 791 | ||
| 799 | copy = Fcopy_alist (get_keymap (keymap)); | 792 | copy = Fcopy_alist (get_keymap (keymap, 1, 0)); |
| 800 | 793 | ||
| 801 | for (tail = copy; CONSP (tail); tail = XCDR (tail)) | 794 | for (tail = copy; CONSP (tail); tail = XCDR (tail)) |
| 802 | { | 795 | { |
| @@ -820,8 +813,7 @@ is not copied.") | |||
| 820 | XCAR (tail) = elt; | 813 | XCAR (tail) = elt; |
| 821 | 814 | ||
| 822 | for (i = 0; i < ASIZE (elt); i++) | 815 | for (i = 0; i < ASIZE (elt); i++) |
| 823 | if (!SYMBOLP (AREF (elt, i)) | 816 | if (CONSP (AREF (elt, i)) && EQ (XCAR (AREF (elt, i)), Qkeymap)) |
| 824 | && ! NILP (Fkeymapp (AREF (elt, i)))) | ||
| 825 | ASET (elt, i, Fcopy_keymap (AREF (elt, i))); | 817 | ASET (elt, i, Fcopy_keymap (AREF (elt, i))); |
| 826 | } | 818 | } |
| 827 | else if (CONSP (elt) && CONSP (XCDR (elt))) | 819 | else if (CONSP (elt) && CONSP (XCDR (elt))) |
| @@ -853,7 +845,7 @@ is not copied.") | |||
| 853 | = Fcons (XCAR (tem), XCDR (tem)); | 845 | = Fcons (XCAR (tem), XCDR (tem)); |
| 854 | elt = XCDR (elt); | 846 | elt = XCDR (elt); |
| 855 | tem = XCAR (elt); | 847 | tem = XCAR (elt); |
| 856 | if (!(SYMBOLP (tem) || NILP (Fkeymapp (tem)))) | 848 | if (CONSP (tem) && EQ (XCAR (tem), Qkeymap)) |
| 857 | XCAR (elt) = Fcopy_keymap (tem); | 849 | XCAR (elt) = Fcopy_keymap (tem); |
| 858 | tem = XCDR (elt); | 850 | tem = XCDR (elt); |
| 859 | if (CONSP (tem) && CONSP (XCAR (tem))) | 851 | if (CONSP (tem) && CONSP (XCAR (tem))) |
| @@ -890,8 +882,8 @@ is not copied.") | |||
| 890 | XCDR (elt) = XCDR (tem); | 882 | XCDR (elt) = XCDR (tem); |
| 891 | } | 883 | } |
| 892 | if (CONSP (elt) | 884 | if (CONSP (elt) |
| 893 | && ! SYMBOLP (XCDR (elt)) | 885 | && CONSP (XCDR (elt)) |
| 894 | && ! NILP (Fkeymapp (XCDR (elt)))) | 886 | && EQ (XCAR (XCDR (elt)), Qkeymap)) |
| 895 | XCDR (elt) = Fcopy_keymap (XCDR (elt)); | 887 | XCDR (elt) = Fcopy_keymap (XCDR (elt)); |
| 896 | } | 888 | } |
| 897 | 889 | ||
| @@ -938,7 +930,7 @@ the front of KEYMAP.") | |||
| 938 | int length; | 930 | int length; |
| 939 | struct gcpro gcpro1, gcpro2, gcpro3; | 931 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 940 | 932 | ||
| 941 | keymap = get_keymap_1 (keymap, 1, 1); | 933 | keymap = get_keymap (keymap, 1, 1); |
| 942 | 934 | ||
| 943 | if (!VECTORP (key) && !STRINGP (key)) | 935 | if (!VECTORP (key) && !STRINGP (key)) |
| 944 | key = wrong_type_argument (Qarrayp, key); | 936 | key = wrong_type_argument (Qarrayp, key); |
| @@ -993,8 +985,8 @@ the front of KEYMAP.") | |||
| 993 | if (NILP (cmd)) | 985 | if (NILP (cmd)) |
| 994 | cmd = define_as_prefix (keymap, c); | 986 | cmd = define_as_prefix (keymap, c); |
| 995 | 987 | ||
| 996 | keymap = get_keymap_1 (cmd, 0, 1); | 988 | keymap = get_keymap (cmd, 0, 1); |
| 997 | if (NILP (keymap)) | 989 | if (!CONSP (keymap)) |
| 998 | /* We must use Fkey_description rather than just passing key to | 990 | /* We must use Fkey_description rather than just passing key to |
| 999 | error; key might be a vector, not a string. */ | 991 | error; key might be a vector, not a string. */ |
| 1000 | error ("Key sequence %s uses invalid prefix characters", | 992 | error ("Key sequence %s uses invalid prefix characters", |
| @@ -1032,7 +1024,7 @@ recognize the default bindings, just as `read-key-sequence' does.") | |||
| 1032 | int t_ok = ! NILP (accept_default); | 1024 | int t_ok = ! NILP (accept_default); |
| 1033 | struct gcpro gcpro1; | 1025 | struct gcpro gcpro1; |
| 1034 | 1026 | ||
| 1035 | keymap = get_keymap_1 (keymap, 1, 1); | 1027 | keymap = get_keymap (keymap, 1, 1); |
| 1036 | 1028 | ||
| 1037 | if (!VECTORP (key) && !STRINGP (key)) | 1029 | if (!VECTORP (key) && !STRINGP (key)) |
| 1038 | key = wrong_type_argument (Qarrayp, key); | 1030 | key = wrong_type_argument (Qarrayp, key); |
| @@ -1059,8 +1051,8 @@ recognize the default bindings, just as `read-key-sequence' does.") | |||
| 1059 | if (idx == length) | 1051 | if (idx == length) |
| 1060 | RETURN_UNGCPRO (cmd); | 1052 | RETURN_UNGCPRO (cmd); |
| 1061 | 1053 | ||
| 1062 | keymap = get_keymap_1 (cmd, 0, 1); | 1054 | keymap = get_keymap (cmd, 0, 1); |
| 1063 | if (NILP (keymap)) | 1055 | if (!CONSP (keymap)) |
| 1064 | RETURN_UNGCPRO (make_number (idx)); | 1056 | RETURN_UNGCPRO (make_number (idx)); |
| 1065 | 1057 | ||
| 1066 | QUIT; | 1058 | QUIT; |
| @@ -1362,11 +1354,11 @@ bindings; see the description of `lookup-key' for more details about this.") | |||
| 1362 | GCPRO2 (key, binding); | 1354 | GCPRO2 (key, binding); |
| 1363 | 1355 | ||
| 1364 | for (i = j = 0; i < nmaps; i++) | 1356 | for (i = j = 0; i < nmaps; i++) |
| 1365 | if (! NILP (maps[i]) | 1357 | if (!NILP (maps[i]) |
| 1366 | && ! NILP (binding = Flookup_key (maps[i], key, accept_default)) | 1358 | && !NILP (binding = Flookup_key (maps[i], key, accept_default)) |
| 1367 | && !INTEGERP (binding)) | 1359 | && !INTEGERP (binding)) |
| 1368 | { | 1360 | { |
| 1369 | if (! NILP (get_keymap (binding))) | 1361 | if (KEYMAPP (binding)) |
| 1370 | maps[j++] = Fcons (modes[i], binding); | 1362 | maps[j++] = Fcons (modes[i], binding); |
| 1371 | else if (j == 0) | 1363 | else if (j == 0) |
| 1372 | RETURN_UNGCPRO (Fcons (Fcons (modes[i], binding), Qnil)); | 1364 | RETURN_UNGCPRO (Fcons (Fcons (modes[i], binding), Qnil)); |
| @@ -1402,7 +1394,7 @@ DEFUN ("use-global-map", Fuse_global_map, Suse_global_map, 1, 1, 0, | |||
| 1402 | (keymap) | 1394 | (keymap) |
| 1403 | Lisp_Object keymap; | 1395 | Lisp_Object keymap; |
| 1404 | { | 1396 | { |
| 1405 | keymap = get_keymap (keymap); | 1397 | keymap = get_keymap (keymap, 1, 1); |
| 1406 | current_global_map = keymap; | 1398 | current_global_map = keymap; |
| 1407 | 1399 | ||
| 1408 | return Qnil; | 1400 | return Qnil; |
| @@ -1415,7 +1407,7 @@ If KEYMAP is nil, that means no local keymap.") | |||
| 1415 | Lisp_Object keymap; | 1407 | Lisp_Object keymap; |
| 1416 | { | 1408 | { |
| 1417 | if (!NILP (keymap)) | 1409 | if (!NILP (keymap)) |
| 1418 | keymap = get_keymap (keymap); | 1410 | keymap = get_keymap (keymap, 1, 1); |
| 1419 | 1411 | ||
| 1420 | current_buffer->keymap = keymap; | 1412 | current_buffer->keymap = keymap; |
| 1421 | 1413 | ||
| @@ -1480,8 +1472,8 @@ then the value includes only maps for prefixes that start with PREFIX.") | |||
| 1480 | /* Flookup_key may give us nil, or a number, | 1472 | /* Flookup_key may give us nil, or a number, |
| 1481 | if the prefix is not defined in this particular map. | 1473 | if the prefix is not defined in this particular map. |
| 1482 | It might even give us a list that isn't a keymap. */ | 1474 | It might even give us a list that isn't a keymap. */ |
| 1483 | tem = get_keymap_1 (tem, 0, 0); | 1475 | tem = get_keymap (tem, 0, 0); |
| 1484 | if (!NILP (tem)) | 1476 | if (CONSP (tem)) |
| 1485 | { | 1477 | { |
| 1486 | /* Convert PREFIX to a vector now, so that later on | 1478 | /* Convert PREFIX to a vector now, so that later on |
| 1487 | we don't have to deal with the possibility of a string. */ | 1479 | we don't have to deal with the possibility of a string. */ |
| @@ -1509,7 +1501,7 @@ then the value includes only maps for prefixes that start with PREFIX.") | |||
| 1509 | } | 1501 | } |
| 1510 | else | 1502 | else |
| 1511 | maps = Fcons (Fcons (Fmake_vector (make_number (0), Qnil), | 1503 | maps = Fcons (Fcons (Fmake_vector (make_number (0), Qnil), |
| 1512 | get_keymap (keymap)), | 1504 | get_keymap (keymap, 1, 0)), |
| 1513 | Qnil); | 1505 | Qnil); |
| 1514 | 1506 | ||
| 1515 | /* For each map in the list maps, | 1507 | /* For each map in the list maps, |
| @@ -1562,10 +1554,10 @@ then the value includes only maps for prefixes that start with PREFIX.") | |||
| 1562 | 1554 | ||
| 1563 | cmd = get_keyelt (AREF (elt, i), 0); | 1555 | cmd = get_keyelt (AREF (elt, i), 0); |
| 1564 | if (NILP (cmd)) continue; | 1556 | if (NILP (cmd)) continue; |
| 1565 | tem = Fkeymapp (cmd); | 1557 | tem = get_keymap (cmd, 0, 0); |
| 1566 | if (!NILP (tem)) | 1558 | if (CONSP (tem)) |
| 1567 | { | 1559 | { |
| 1568 | cmd = get_keymap (cmd); | 1560 | cmd = tem; |
| 1569 | /* Ignore keymaps that are already added to maps. */ | 1561 | /* Ignore keymaps that are already added to maps. */ |
| 1570 | tem = Frassq (cmd, maps); | 1562 | tem = Frassq (cmd, maps); |
| 1571 | if (NILP (tem)) | 1563 | if (NILP (tem)) |
| @@ -1603,11 +1595,11 @@ then the value includes only maps for prefixes that start with PREFIX.") | |||
| 1603 | 1595 | ||
| 1604 | cmd = get_keyelt (XCDR (elt), 0); | 1596 | cmd = get_keyelt (XCDR (elt), 0); |
| 1605 | /* Ignore definitions that aren't keymaps themselves. */ | 1597 | /* Ignore definitions that aren't keymaps themselves. */ |
| 1606 | tem = Fkeymapp (cmd); | 1598 | tem = get_keymap (cmd, 0, 0); |
| 1607 | if (!NILP (tem)) | 1599 | if (CONSP (tem)) |
| 1608 | { | 1600 | { |
| 1609 | /* Ignore keymaps that have been seen already. */ | 1601 | /* Ignore keymaps that have been seen already. */ |
| 1610 | cmd = get_keymap (cmd); | 1602 | cmd = tem; |
| 1611 | tem = Frassq (cmd, maps); | 1603 | tem = Frassq (cmd, maps); |
| 1612 | if (NILP (tem)) | 1604 | if (NILP (tem)) |
| 1613 | { | 1605 | { |
| @@ -1687,10 +1679,10 @@ accessible_keymaps_char_table (args, index, cmd) | |||
| 1687 | tail = XCAR (XCDR (args)); | 1679 | tail = XCAR (XCDR (args)); |
| 1688 | thisseq = XCDR (XCDR (args)); | 1680 | thisseq = XCDR (XCDR (args)); |
| 1689 | 1681 | ||
| 1690 | tem = Fkeymapp (cmd); | 1682 | tem = get_keymap (cmd, 0, 0); |
| 1691 | if (!NILP (tem)) | 1683 | if (CONSP (tem)) |
| 1692 | { | 1684 | { |
| 1693 | cmd = get_keymap (cmd); | 1685 | cmd = tem; |
| 1694 | /* Ignore keymaps that are already added to maps. */ | 1686 | /* Ignore keymaps that are already added to maps. */ |
| 1695 | tem = Frassq (cmd, maps); | 1687 | tem = Frassq (cmd, maps); |
| 1696 | if (NILP (tem)) | 1688 | if (NILP (tem)) |
| @@ -2087,7 +2079,8 @@ where_is_internal (definition, keymaps, firstonly, noindirect) | |||
| 2087 | while (CONSP (found)) | 2079 | while (CONSP (found)) |
| 2088 | { | 2080 | { |
| 2089 | maps = | 2081 | maps = |
| 2090 | nconc2 (maps, Faccessible_keymaps (get_keymap (XCAR (found)), Qnil)); | 2082 | nconc2 (maps, |
| 2083 | Faccessible_keymaps (get_keymap (XCAR (found), 1, 0), Qnil)); | ||
| 2091 | found = XCDR (found); | 2084 | found = XCDR (found); |
| 2092 | } | 2085 | } |
| 2093 | 2086 | ||
| @@ -2667,7 +2660,7 @@ key binding\n\ | |||
| 2667 | /* If shmap is not nil and not a keymap, | 2660 | /* If shmap is not nil and not a keymap, |
| 2668 | it completely shadows this map, so don't | 2661 | it completely shadows this map, so don't |
| 2669 | describe this map at all. */ | 2662 | describe this map at all. */ |
| 2670 | if (!NILP (shmap) && NILP (Fkeymapp (shmap))) | 2663 | if (!NILP (shmap) && !KEYMAPP (shmap)) |
| 2671 | goto skip; | 2664 | goto skip; |
| 2672 | 2665 | ||
| 2673 | if (!NILP (shmap)) | 2666 | if (!NILP (shmap)) |
| @@ -2729,14 +2722,10 @@ describe_command (definition) | |||
| 2729 | } | 2722 | } |
| 2730 | else if (STRINGP (definition) || VECTORP (definition)) | 2723 | else if (STRINGP (definition) || VECTORP (definition)) |
| 2731 | insert_string ("Keyboard Macro\n"); | 2724 | insert_string ("Keyboard Macro\n"); |
| 2725 | else if (KEYMAPP (definition)) | ||
| 2726 | insert_string ("Prefix Command\n"); | ||
| 2732 | else | 2727 | else |
| 2733 | { | 2728 | insert_string ("??\n"); |
| 2734 | tem1 = Fkeymapp (definition); | ||
| 2735 | if (!NILP (tem1)) | ||
| 2736 | insert_string ("Prefix Command\n"); | ||
| 2737 | else | ||
| 2738 | insert_string ("??\n"); | ||
| 2739 | } | ||
| 2740 | } | 2729 | } |
| 2741 | 2730 | ||
| 2742 | static void | 2731 | static void |
| @@ -2758,14 +2747,10 @@ describe_translation (definition) | |||
| 2758 | insert1 (Fkey_description (definition)); | 2747 | insert1 (Fkey_description (definition)); |
| 2759 | insert_string ("\n"); | 2748 | insert_string ("\n"); |
| 2760 | } | 2749 | } |
| 2750 | else if (KEYMAPP (definition)) | ||
| 2751 | insert_string ("Prefix Command\n"); | ||
| 2761 | else | 2752 | else |
| 2762 | { | 2753 | insert_string ("??\n"); |
| 2763 | tem1 = Fkeymapp (definition); | ||
| 2764 | if (!NILP (tem1)) | ||
| 2765 | insert_string ("Prefix Command\n"); | ||
| 2766 | else | ||
| 2767 | insert_string ("??\n"); | ||
| 2768 | } | ||
| 2769 | } | 2754 | } |
| 2770 | 2755 | ||
| 2771 | /* Describe the contents of map MAP, assuming that this map itself is | 2756 | /* Describe the contents of map MAP, assuming that this map itself is |