Mercurial > emacs
comparison src/keymap.c @ 13771:28790743a5a3
(Fkey_binding): Handle text-property keymaps.
Include puresize.h.
(store_in_keymap): Check PURE_P (def) and copy if nec.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Thu, 21 Dec 1995 17:10:27 +0000 |
parents | cc0f24bdfab1 |
children | 65488aa49b87 |
comparison
equal
deleted
inserted
replaced
13770:197ada595605 | 13771:28790743a5a3 |
---|---|
25 #include "commands.h" | 25 #include "commands.h" |
26 #include "buffer.h" | 26 #include "buffer.h" |
27 #include "keyboard.h" | 27 #include "keyboard.h" |
28 #include "termhooks.h" | 28 #include "termhooks.h" |
29 #include "blockinput.h" | 29 #include "blockinput.h" |
30 #include "puresize.h" | |
30 | 31 |
31 #define min(a, b) ((a) < (b) ? (a) : (b)) | 32 #define min(a, b) ((a) < (b) ? (a) : (b)) |
32 | 33 |
33 /* The number of elements in keymap vectors. */ | 34 /* The number of elements in keymap vectors. */ |
34 #define DENSE_TABLE_SIZE (0200) | 35 #define DENSE_TABLE_SIZE (0200) |
403 register Lisp_Object idx; | 404 register Lisp_Object idx; |
404 register Lisp_Object def; | 405 register Lisp_Object def; |
405 { | 406 { |
406 /* If we are preparing to dump, and DEF is a menu element | 407 /* If we are preparing to dump, and DEF is a menu element |
407 with a menu item string, copy it to ensure it is not pure. */ | 408 with a menu item string, copy it to ensure it is not pure. */ |
408 if (!NILP (Vpurify_flag) && CONSP (def) | 409 if (CONSP (def) && PURE_P (def) && STRINGP (XCONS (def)->car)) |
409 && STRINGP (XCONS (def)->car)) | |
410 def = Fcons (XCONS (def)->car, XCONS (def)->cdr); | 410 def = Fcons (XCONS (def)->car, XCONS (def)->cdr); |
411 | 411 |
412 if (!CONSP (keymap) || ! EQ (XCONS (keymap)->car, Qkeymap)) | 412 if (!CONSP (keymap) || ! EQ (XCONS (keymap)->car, Qkeymap)) |
413 error ("attempt to define a key in a non-keymap"); | 413 error ("attempt to define a key in a non-keymap"); |
414 | 414 |
929 if (! NILP (value) && !INTEGERP (value)) | 929 if (! NILP (value) && !INTEGERP (value)) |
930 RETURN_UNGCPRO (value); | 930 RETURN_UNGCPRO (value); |
931 } | 931 } |
932 else | 932 else |
933 { | 933 { |
934 Lisp_Object local; | |
935 | |
934 nmaps = current_minor_maps (0, &maps); | 936 nmaps = current_minor_maps (0, &maps); |
935 /* Note that all these maps are GCPRO'd | 937 /* Note that all these maps are GCPRO'd |
936 in the places where we found them. */ | 938 in the places where we found them. */ |
937 | 939 |
938 for (i = 0; i < nmaps; i++) | 940 for (i = 0; i < nmaps; i++) |
941 value = Flookup_key (maps[i], key, accept_default); | 943 value = Flookup_key (maps[i], key, accept_default); |
942 if (! NILP (value) && !INTEGERP (value)) | 944 if (! NILP (value) && !INTEGERP (value)) |
943 RETURN_UNGCPRO (value); | 945 RETURN_UNGCPRO (value); |
944 } | 946 } |
945 | 947 |
946 if (! NILP (current_buffer->keymap)) | 948 local = get_local_map (PT, current_buffer); |
947 { | 949 |
948 value = Flookup_key (current_buffer->keymap, key, accept_default); | 950 if (! NILP (local)) |
951 { | |
952 value = Flookup_key (local, key, accept_default); | |
949 if (! NILP (value) && !INTEGERP (value)) | 953 if (! NILP (value) && !INTEGERP (value)) |
950 RETURN_UNGCPRO (value); | 954 RETURN_UNGCPRO (value); |
951 } | 955 } |
952 } | 956 } |
953 | 957 |