diff options
| author | Joakim Verona | 2010-08-27 10:58:44 +0200 |
|---|---|---|
| committer | Joakim Verona | 2010-08-27 10:58:44 +0200 |
| commit | 362120833bcbbaea94976b6701633e2ed75f6051 (patch) | |
| tree | 632690a24a934bb51a32303add5172d63b6b9e00 /src/keymap.c | |
| parent | 1800c4865b15a9e1154bf1f03d87d1aaf750a527 (diff) | |
| parent | 1a868076f51b5d6f1cf78117463e6f9c614551ec (diff) | |
| download | emacs-362120833bcbbaea94976b6701633e2ed75f6051.tar.gz emacs-362120833bcbbaea94976b6701633e2ed75f6051.zip | |
merge from trunk, fix conflicts
Diffstat (limited to 'src/keymap.c')
| -rw-r--r-- | src/keymap.c | 333 |
1 files changed, 110 insertions, 223 deletions
diff --git a/src/keymap.c b/src/keymap.c index c3a9d9e5cc0..cc25d350d44 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -103,32 +103,25 @@ static Lisp_Object exclude_keys; | |||
| 103 | /* Pre-allocated 2-element vector for Fcommand_remapping to use. */ | 103 | /* Pre-allocated 2-element vector for Fcommand_remapping to use. */ |
| 104 | static Lisp_Object command_remapping_vector; | 104 | static Lisp_Object command_remapping_vector; |
| 105 | 105 | ||
| 106 | /* A char with the CHAR_META bit set in a vector or the 0200 bit set | ||
| 107 | in a string key sequence is equivalent to prefixing with this | ||
| 108 | character. */ | ||
| 109 | extern Lisp_Object meta_prefix_char; | ||
| 110 | |||
| 111 | extern Lisp_Object Voverriding_local_map; | ||
| 112 | |||
| 113 | /* Hash table used to cache a reverse-map to speed up calls to where-is. */ | 106 | /* Hash table used to cache a reverse-map to speed up calls to where-is. */ |
| 114 | static Lisp_Object where_is_cache; | 107 | static Lisp_Object where_is_cache; |
| 115 | /* Which keymaps are reverse-stored in the cache. */ | 108 | /* Which keymaps are reverse-stored in the cache. */ |
| 116 | static Lisp_Object where_is_cache_keymaps; | 109 | static Lisp_Object where_is_cache_keymaps; |
| 117 | 110 | ||
| 118 | static Lisp_Object store_in_keymap P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); | 111 | static Lisp_Object store_in_keymap (Lisp_Object, Lisp_Object, Lisp_Object); |
| 119 | static void fix_submap_inheritance P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); | 112 | static void fix_submap_inheritance (Lisp_Object, Lisp_Object, Lisp_Object); |
| 120 | 113 | ||
| 121 | static Lisp_Object define_as_prefix P_ ((Lisp_Object, Lisp_Object)); | 114 | static Lisp_Object define_as_prefix (Lisp_Object, Lisp_Object); |
| 122 | static void describe_command P_ ((Lisp_Object, Lisp_Object)); | 115 | static void describe_command (Lisp_Object, Lisp_Object); |
| 123 | static void describe_translation P_ ((Lisp_Object, Lisp_Object)); | 116 | static void describe_translation (Lisp_Object, Lisp_Object); |
| 124 | static void describe_map P_ ((Lisp_Object, Lisp_Object, | 117 | static void describe_map (Lisp_Object, Lisp_Object, |
| 125 | void (*) P_ ((Lisp_Object, Lisp_Object)), | 118 | void (*) (Lisp_Object, Lisp_Object), |
| 126 | int, Lisp_Object, Lisp_Object*, int, int)); | 119 | int, Lisp_Object, Lisp_Object*, int, int); |
| 127 | static void describe_vector P_ ((Lisp_Object, Lisp_Object, Lisp_Object, | 120 | static void describe_vector (Lisp_Object, Lisp_Object, Lisp_Object, |
| 128 | void (*) (Lisp_Object, Lisp_Object), int, | 121 | void (*) (Lisp_Object, Lisp_Object), int, |
| 129 | Lisp_Object, Lisp_Object, int *, | 122 | Lisp_Object, Lisp_Object, int *, |
| 130 | int, int, int)); | 123 | int, int, int); |
| 131 | static void silly_event_symbol_error P_ ((Lisp_Object)); | 124 | static void silly_event_symbol_error (Lisp_Object); |
| 132 | 125 | ||
| 133 | /* Keymap object support - constructors and predicates. */ | 126 | /* Keymap object support - constructors and predicates. */ |
| 134 | 127 | ||
| @@ -142,8 +135,7 @@ input stream. Initially, ALIST is nil. | |||
| 142 | 135 | ||
| 143 | The optional arg STRING supplies a menu name for the keymap | 136 | The optional arg STRING supplies a menu name for the keymap |
| 144 | in case you use it as a menu with `x-popup-menu'. */) | 137 | in case you use it as a menu with `x-popup-menu'. */) |
| 145 | (string) | 138 | (Lisp_Object string) |
| 146 | Lisp_Object string; | ||
| 147 | { | 139 | { |
| 148 | Lisp_Object tail; | 140 | Lisp_Object tail; |
| 149 | if (!NILP (string)) | 141 | if (!NILP (string)) |
| @@ -163,8 +155,7 @@ Initially the alist is nil. | |||
| 163 | 155 | ||
| 164 | The optional arg STRING supplies a menu name for the keymap | 156 | The optional arg STRING supplies a menu name for the keymap |
| 165 | in case you use it as a menu with `x-popup-menu'. */) | 157 | in case you use it as a menu with `x-popup-menu'. */) |
| 166 | (string) | 158 | (Lisp_Object string) |
| 167 | Lisp_Object string; | ||
| 168 | { | 159 | { |
| 169 | if (!NILP (string)) | 160 | if (!NILP (string)) |
| 170 | { | 161 | { |
| @@ -183,19 +174,13 @@ in case you use it as a menu with `x-popup-menu'. */) | |||
| 183 | initial_define_key (control_x_map, Ctl('X'), "exchange-point-and-mark"); */ | 174 | initial_define_key (control_x_map, Ctl('X'), "exchange-point-and-mark"); */ |
| 184 | 175 | ||
| 185 | void | 176 | void |
| 186 | initial_define_key (keymap, key, defname) | 177 | initial_define_key (Lisp_Object keymap, int key, const char *defname) |
| 187 | Lisp_Object keymap; | ||
| 188 | int key; | ||
| 189 | char *defname; | ||
| 190 | { | 178 | { |
| 191 | store_in_keymap (keymap, make_number (key), intern_c_string (defname)); | 179 | store_in_keymap (keymap, make_number (key), intern_c_string (defname)); |
| 192 | } | 180 | } |
| 193 | 181 | ||
| 194 | void | 182 | void |
| 195 | initial_define_lispy_key (keymap, keyname, defname) | 183 | initial_define_lispy_key (Lisp_Object keymap, const char *keyname, const char *defname) |
| 196 | Lisp_Object keymap; | ||
| 197 | char *keyname; | ||
| 198 | char *defname; | ||
| 199 | { | 184 | { |
| 200 | store_in_keymap (keymap, intern_c_string (keyname), intern_c_string (defname)); | 185 | store_in_keymap (keymap, intern_c_string (keyname), intern_c_string (defname)); |
| 201 | } | 186 | } |
| @@ -208,8 +193,7 @@ or a symbol whose function definition is itself a keymap. | |||
| 208 | ALIST elements look like (CHAR . DEFN) or (SYMBOL . DEFN); | 193 | ALIST elements look like (CHAR . DEFN) or (SYMBOL . DEFN); |
| 209 | a vector of densely packed bindings for small character codes | 194 | a vector of densely packed bindings for small character codes |
| 210 | is also allowed as an element. */) | 195 | is also allowed as an element. */) |
| 211 | (object) | 196 | (Lisp_Object object) |
| 212 | Lisp_Object object; | ||
| 213 | { | 197 | { |
| 214 | return (KEYMAPP (object) ? Qt : Qnil); | 198 | return (KEYMAPP (object) ? Qt : Qnil); |
| 215 | } | 199 | } |
| @@ -218,8 +202,7 @@ DEFUN ("keymap-prompt", Fkeymap_prompt, Skeymap_prompt, 1, 1, 0, | |||
| 218 | doc: /* Return the prompt-string of a keymap MAP. | 202 | doc: /* Return the prompt-string of a keymap MAP. |
| 219 | If non-nil, the prompt is shown in the echo-area | 203 | If non-nil, the prompt is shown in the echo-area |
| 220 | when reading a key-sequence to be looked-up in this keymap. */) | 204 | when reading a key-sequence to be looked-up in this keymap. */) |
| 221 | (map) | 205 | (Lisp_Object map) |
| 222 | Lisp_Object map; | ||
| 223 | { | 206 | { |
| 224 | map = get_keymap (map, 0, 0); | 207 | map = get_keymap (map, 0, 0); |
| 225 | while (CONSP (map)) | 208 | while (CONSP (map)) |
| @@ -255,9 +238,7 @@ when reading a key-sequence to be looked-up in this keymap. */) | |||
| 255 | do_autoload which can GC. */ | 238 | do_autoload which can GC. */ |
| 256 | 239 | ||
| 257 | Lisp_Object | 240 | Lisp_Object |
| 258 | get_keymap (object, error, autoload) | 241 | get_keymap (Lisp_Object object, int error, int autoload) |
| 259 | Lisp_Object object; | ||
| 260 | int error, autoload; | ||
| 261 | { | 242 | { |
| 262 | Lisp_Object tem; | 243 | Lisp_Object tem; |
| 263 | 244 | ||
| @@ -309,9 +290,7 @@ get_keymap (object, error, autoload) | |||
| 309 | We assume that KEYMAP is a valid keymap. */ | 290 | We assume that KEYMAP is a valid keymap. */ |
| 310 | 291 | ||
| 311 | Lisp_Object | 292 | Lisp_Object |
| 312 | keymap_parent (keymap, autoload) | 293 | keymap_parent (Lisp_Object keymap, int autoload) |
| 313 | Lisp_Object keymap; | ||
| 314 | int autoload; | ||
| 315 | { | 294 | { |
| 316 | Lisp_Object list; | 295 | Lisp_Object list; |
| 317 | 296 | ||
| @@ -332,16 +311,14 @@ keymap_parent (keymap, autoload) | |||
| 332 | DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0, | 311 | DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0, |
| 333 | doc: /* Return the parent keymap of KEYMAP. | 312 | doc: /* Return the parent keymap of KEYMAP. |
| 334 | If KEYMAP has no parent, return nil. */) | 313 | If KEYMAP has no parent, return nil. */) |
| 335 | (keymap) | 314 | (Lisp_Object keymap) |
| 336 | Lisp_Object keymap; | ||
| 337 | { | 315 | { |
| 338 | return keymap_parent (keymap, 1); | 316 | return keymap_parent (keymap, 1); |
| 339 | } | 317 | } |
| 340 | 318 | ||
| 341 | /* Check whether MAP is one of MAPS parents. */ | 319 | /* Check whether MAP is one of MAPS parents. */ |
| 342 | int | 320 | int |
| 343 | keymap_memberp (map, maps) | 321 | keymap_memberp (Lisp_Object map, Lisp_Object maps) |
| 344 | Lisp_Object map, maps; | ||
| 345 | { | 322 | { |
| 346 | if (NILP (map)) return 0; | 323 | if (NILP (map)) return 0; |
| 347 | while (KEYMAPP (maps) && !EQ (map, maps)) | 324 | while (KEYMAPP (maps) && !EQ (map, maps)) |
| @@ -354,8 +331,7 @@ keymap_memberp (map, maps) | |||
| 354 | DEFUN ("set-keymap-parent", Fset_keymap_parent, Sset_keymap_parent, 2, 2, 0, | 331 | DEFUN ("set-keymap-parent", Fset_keymap_parent, Sset_keymap_parent, 2, 2, 0, |
| 355 | doc: /* Modify KEYMAP to set its parent map to PARENT. | 332 | doc: /* Modify KEYMAP to set its parent map to PARENT. |
| 356 | Return PARENT. PARENT should be nil or another keymap. */) | 333 | Return PARENT. PARENT should be nil or another keymap. */) |
| 357 | (keymap, parent) | 334 | (Lisp_Object keymap, Lisp_Object parent) |
| 358 | Lisp_Object keymap, parent; | ||
| 359 | { | 335 | { |
| 360 | Lisp_Object list, prev; | 336 | Lisp_Object list, prev; |
| 361 | struct gcpro gcpro1, gcpro2; | 337 | struct gcpro gcpro1, gcpro2; |
| @@ -437,8 +413,7 @@ Return PARENT. PARENT should be nil or another keymap. */) | |||
| 437 | make sure that SUBMAP inherits that definition as its own parent. */ | 413 | make sure that SUBMAP inherits that definition as its own parent. */ |
| 438 | 414 | ||
| 439 | static void | 415 | static void |
| 440 | fix_submap_inheritance (map, event, submap) | 416 | fix_submap_inheritance (Lisp_Object map, Lisp_Object event, Lisp_Object submap) |
| 441 | Lisp_Object map, event, submap; | ||
| 442 | { | 417 | { |
| 443 | Lisp_Object map_parent, parent_entry; | 418 | Lisp_Object map_parent, parent_entry; |
| 444 | 419 | ||
| @@ -500,12 +475,7 @@ fix_submap_inheritance (map, event, submap) | |||
| 500 | If NOINHERIT, don't accept a subkeymap found in an inherited keymap. */ | 475 | If NOINHERIT, don't accept a subkeymap found in an inherited keymap. */ |
| 501 | 476 | ||
| 502 | Lisp_Object | 477 | Lisp_Object |
| 503 | access_keymap (map, idx, t_ok, noinherit, autoload) | 478 | access_keymap (Lisp_Object map, Lisp_Object idx, int t_ok, int noinherit, int autoload) |
| 504 | Lisp_Object map; | ||
| 505 | Lisp_Object idx; | ||
| 506 | int t_ok; | ||
| 507 | int noinherit; | ||
| 508 | int autoload; | ||
| 509 | { | 479 | { |
| 510 | Lisp_Object val; | 480 | Lisp_Object val; |
| 511 | 481 | ||
| @@ -634,10 +604,7 @@ access_keymap (map, idx, t_ok, noinherit, autoload) | |||
| 634 | } | 604 | } |
| 635 | 605 | ||
| 636 | static void | 606 | static void |
| 637 | map_keymap_item (fun, args, key, val, data) | 607 | map_keymap_item (map_keymap_function_t fun, Lisp_Object args, Lisp_Object key, Lisp_Object val, void *data) |
| 638 | map_keymap_function_t fun; | ||
| 639 | Lisp_Object args, key, val; | ||
| 640 | void *data; | ||
| 641 | { | 608 | { |
| 642 | /* We should maybe try to detect bindings shadowed by previous | 609 | /* We should maybe try to detect bindings shadowed by previous |
| 643 | ones and things like that. */ | 610 | ones and things like that. */ |
| @@ -647,8 +614,7 @@ map_keymap_item (fun, args, key, val, data) | |||
| 647 | } | 614 | } |
| 648 | 615 | ||
| 649 | static void | 616 | static void |
| 650 | map_keymap_char_table_item (args, key, val) | 617 | map_keymap_char_table_item (Lisp_Object args, Lisp_Object key, Lisp_Object val) |
| 651 | Lisp_Object args, key, val; | ||
| 652 | { | 618 | { |
| 653 | if (!NILP (val)) | 619 | if (!NILP (val)) |
| 654 | { | 620 | { |
| @@ -707,9 +673,7 @@ map_keymap_internal (Lisp_Object map, | |||
| 707 | } | 673 | } |
| 708 | 674 | ||
| 709 | static void | 675 | static void |
| 710 | map_keymap_call (key, val, fun, dummy) | 676 | map_keymap_call (Lisp_Object key, Lisp_Object val, Lisp_Object fun, void *dummy) |
| 711 | Lisp_Object key, val, fun; | ||
| 712 | void *dummy; | ||
| 713 | { | 677 | { |
| 714 | call2 (fun, key, val); | 678 | call2 (fun, key, val); |
| 715 | } | 679 | } |
| @@ -717,11 +681,7 @@ map_keymap_call (key, val, fun, dummy) | |||
| 717 | /* Same as map_keymap_internal, but doesn't traverses parent keymaps as well. | 681 | /* Same as map_keymap_internal, but doesn't traverses parent keymaps as well. |
| 718 | A non-zero AUTOLOAD indicates that autoloaded keymaps should be loaded. */ | 682 | A non-zero AUTOLOAD indicates that autoloaded keymaps should be loaded. */ |
| 719 | void | 683 | void |
| 720 | map_keymap (map, fun, args, data, autoload) | 684 | map_keymap (Lisp_Object map, map_keymap_function_t fun, Lisp_Object args, void *data, int autoload) |
| 721 | map_keymap_function_t fun; | ||
| 722 | Lisp_Object map, args; | ||
| 723 | void *data; | ||
| 724 | int autoload; | ||
| 725 | { | 685 | { |
| 726 | struct gcpro gcpro1; | 686 | struct gcpro gcpro1; |
| 727 | GCPRO1 (args); | 687 | GCPRO1 (args); |
| @@ -739,10 +699,7 @@ Lisp_Object Qkeymap_canonicalize; | |||
| 739 | /* Same as map_keymap, but does it right, properly eliminating duplicate | 699 | /* Same as map_keymap, but does it right, properly eliminating duplicate |
| 740 | bindings due to inheritance. */ | 700 | bindings due to inheritance. */ |
| 741 | void | 701 | void |
| 742 | map_keymap_canonical (map, fun, args, data) | 702 | map_keymap_canonical (Lisp_Object map, map_keymap_function_t fun, Lisp_Object args, void *data) |
| 743 | map_keymap_function_t fun; | ||
| 744 | Lisp_Object map, args; | ||
| 745 | void *data; | ||
| 746 | { | 703 | { |
| 747 | struct gcpro gcpro1; | 704 | struct gcpro gcpro1; |
| 748 | GCPRO1 (args); | 705 | GCPRO1 (args); |
| @@ -759,8 +716,7 @@ DEFUN ("map-keymap-internal", Fmap_keymap_internal, Smap_keymap_internal, 2, 2, | |||
| 759 | FUNCTION is called with two arguments: the event that is bound, and | 716 | FUNCTION is called with two arguments: the event that is bound, and |
| 760 | the definition it is bound to. The event may be a character range. | 717 | the definition it is bound to. The event may be a character range. |
| 761 | If KEYMAP has a parent, this function returns it without processing it. */) | 718 | If KEYMAP has a parent, this function returns it without processing it. */) |
| 762 | (function, keymap) | 719 | (Lisp_Object function, Lisp_Object keymap) |
| 763 | Lisp_Object function, keymap; | ||
| 764 | { | 720 | { |
| 765 | struct gcpro gcpro1; | 721 | struct gcpro gcpro1; |
| 766 | GCPRO1 (function); | 722 | GCPRO1 (function); |
| @@ -779,8 +735,7 @@ If KEYMAP has a parent, the parent's bindings are included as well. | |||
| 779 | This works recursively: if the parent has itself a parent, then the | 735 | This works recursively: if the parent has itself a parent, then the |
| 780 | grandparent's bindings are also included and so on. | 736 | grandparent's bindings are also included and so on. |
| 781 | usage: (map-keymap FUNCTION KEYMAP) */) | 737 | usage: (map-keymap FUNCTION KEYMAP) */) |
| 782 | (function, keymap, sort_first) | 738 | (Lisp_Object function, Lisp_Object keymap, Lisp_Object sort_first) |
| 783 | Lisp_Object function, keymap, sort_first; | ||
| 784 | { | 739 | { |
| 785 | if (! NILP (sort_first)) | 740 | if (! NILP (sort_first)) |
| 786 | return call2 (intern ("map-keymap-sorted"), function, keymap); | 741 | return call2 (intern ("map-keymap-sorted"), function, keymap); |
| @@ -804,9 +759,7 @@ usage: (map-keymap FUNCTION KEYMAP) */) | |||
| 804 | This can GC because menu_item_eval_property calls Feval. */ | 759 | This can GC because menu_item_eval_property calls Feval. */ |
| 805 | 760 | ||
| 806 | Lisp_Object | 761 | Lisp_Object |
| 807 | get_keyelt (object, autoload) | 762 | get_keyelt (Lisp_Object object, int autoload) |
| 808 | Lisp_Object object; | ||
| 809 | int autoload; | ||
| 810 | { | 763 | { |
| 811 | while (1) | 764 | while (1) |
| 812 | { | 765 | { |
| @@ -886,10 +839,7 @@ get_keyelt (object, autoload) | |||
| 886 | } | 839 | } |
| 887 | 840 | ||
| 888 | static Lisp_Object | 841 | static Lisp_Object |
| 889 | store_in_keymap (keymap, idx, def) | 842 | store_in_keymap (Lisp_Object keymap, register Lisp_Object idx, Lisp_Object def) |
| 890 | Lisp_Object keymap; | ||
| 891 | register Lisp_Object idx; | ||
| 892 | Lisp_Object def; | ||
| 893 | { | 843 | { |
| 894 | /* Flush any reverse-map cache. */ | 844 | /* Flush any reverse-map cache. */ |
| 895 | where_is_cache = Qnil; | 845 | where_is_cache = Qnil; |
| @@ -1044,8 +994,7 @@ store_in_keymap (keymap, idx, def) | |||
| 1044 | EXFUN (Fcopy_keymap, 1); | 994 | EXFUN (Fcopy_keymap, 1); |
| 1045 | 995 | ||
| 1046 | Lisp_Object | 996 | Lisp_Object |
| 1047 | copy_keymap_item (elt) | 997 | copy_keymap_item (Lisp_Object elt) |
| 1048 | Lisp_Object elt; | ||
| 1049 | { | 998 | { |
| 1050 | Lisp_Object res, tem; | 999 | Lisp_Object res, tem; |
| 1051 | 1000 | ||
| @@ -1118,8 +1067,7 @@ copy_keymap_item (elt) | |||
| 1118 | } | 1067 | } |
| 1119 | 1068 | ||
| 1120 | static void | 1069 | static void |
| 1121 | copy_keymap_1 (chartable, idx, elt) | 1070 | copy_keymap_1 (Lisp_Object chartable, Lisp_Object idx, Lisp_Object elt) |
| 1122 | Lisp_Object chartable, idx, elt; | ||
| 1123 | { | 1071 | { |
| 1124 | Fset_char_table_range (chartable, idx, copy_keymap_item (elt)); | 1072 | Fset_char_table_range (chartable, idx, copy_keymap_item (elt)); |
| 1125 | } | 1073 | } |
| @@ -1131,8 +1079,7 @@ but changing either the copy or KEYMAP does not affect the other. | |||
| 1131 | Any key definitions that are subkeymaps are recursively copied. | 1079 | Any key definitions that are subkeymaps are recursively copied. |
| 1132 | However, a key definition which is a symbol whose definition is a keymap | 1080 | However, a key definition which is a symbol whose definition is a keymap |
| 1133 | is not copied. */) | 1081 | is not copied. */) |
| 1134 | (keymap) | 1082 | (Lisp_Object keymap) |
| 1135 | Lisp_Object keymap; | ||
| 1136 | { | 1083 | { |
| 1137 | register Lisp_Object copy, tail; | 1084 | register Lisp_Object copy, tail; |
| 1138 | keymap = get_keymap (keymap, 1, 0); | 1085 | keymap = get_keymap (keymap, 1, 0); |
| @@ -1172,11 +1119,13 @@ DEFUN ("define-key", Fdefine_key, Sdefine_key, 3, 3, 0, | |||
| 1172 | doc: /* In KEYMAP, define key sequence KEY as DEF. | 1119 | doc: /* In KEYMAP, define key sequence KEY as DEF. |
| 1173 | KEYMAP is a keymap. | 1120 | KEYMAP is a keymap. |
| 1174 | 1121 | ||
| 1175 | KEY is a string or a vector of symbols and characters meaning a | 1122 | KEY is a string or a vector of symbols and characters, representing a |
| 1176 | sequence of keystrokes and events. Non-ASCII characters with codes | 1123 | sequence of keystrokes and events. Non-ASCII characters with codes |
| 1177 | above 127 (such as ISO Latin-1) can be included if you use a vector. | 1124 | above 127 (such as ISO Latin-1) can be represented by vectors. |
| 1178 | Using [t] for KEY creates a default definition, which applies to any | 1125 | Two types of vector have special meanings: |
| 1179 | event type that has no other definition in this keymap. | 1126 | [remap COMMAND] remaps any key binding for COMMAND. |
| 1127 | [t] creates a default definition, which applies to any event with no | ||
| 1128 | other definition in KEYMAP. | ||
| 1180 | 1129 | ||
| 1181 | DEF is anything that can be a key's definition: | 1130 | DEF is anything that can be a key's definition: |
| 1182 | nil (means key is undefined in this keymap), | 1131 | nil (means key is undefined in this keymap), |
| @@ -1195,10 +1144,7 @@ DEF is anything that can be a key's definition: | |||
| 1195 | If KEYMAP is a sparse keymap with a binding for KEY, the existing | 1144 | If KEYMAP is a sparse keymap with a binding for KEY, the existing |
| 1196 | binding is altered. If there is no binding for KEY, the new pair | 1145 | binding is altered. If there is no binding for KEY, the new pair |
| 1197 | binding KEY to DEF is added at the front of KEYMAP. */) | 1146 | binding KEY to DEF is added at the front of KEYMAP. */) |
| 1198 | (keymap, key, def) | 1147 | (Lisp_Object keymap, Lisp_Object key, Lisp_Object def) |
| 1199 | Lisp_Object keymap; | ||
| 1200 | Lisp_Object key; | ||
| 1201 | Lisp_Object def; | ||
| 1202 | { | 1148 | { |
| 1203 | register int idx; | 1149 | register int idx; |
| 1204 | register Lisp_Object c; | 1150 | register Lisp_Object c; |
| @@ -1275,7 +1221,7 @@ binding KEY to DEF is added at the front of KEYMAP. */) | |||
| 1275 | && (!CONSP (c) | 1221 | && (!CONSP (c) |
| 1276 | /* If C is a range, it must be a leaf. */ | 1222 | /* If C is a range, it must be a leaf. */ |
| 1277 | || (INTEGERP (XCAR (c)) && idx != length))) | 1223 | || (INTEGERP (XCAR (c)) && idx != length))) |
| 1278 | error ("Key sequence contains invalid event"); | 1224 | message_with_string ("Key sequence contains invalid event %s", c, 1); |
| 1279 | 1225 | ||
| 1280 | if (idx == length) | 1226 | if (idx == length) |
| 1281 | RETURN_UNGCPRO (store_in_keymap (keymap, c, def)); | 1227 | RETURN_UNGCPRO (store_in_keymap (keymap, c, def)); |
| @@ -1314,8 +1260,7 @@ ignored if POSITION is non-nil. | |||
| 1314 | If the optional argument KEYMAPS is non-nil, it should be a list of | 1260 | If the optional argument KEYMAPS is non-nil, it should be a list of |
| 1315 | keymaps to search for command remapping. Otherwise, search for the | 1261 | keymaps to search for command remapping. Otherwise, search for the |
| 1316 | remapping in all currently active keymaps. */) | 1262 | remapping in all currently active keymaps. */) |
| 1317 | (command, position, keymaps) | 1263 | (Lisp_Object command, Lisp_Object position, Lisp_Object keymaps) |
| 1318 | Lisp_Object command, position, keymaps; | ||
| 1319 | { | 1264 | { |
| 1320 | if (!SYMBOLP (command)) | 1265 | if (!SYMBOLP (command)) |
| 1321 | return Qnil; | 1266 | return Qnil; |
| @@ -1357,10 +1302,7 @@ bindings, used when nothing else in the keymap applies; this makes it | |||
| 1357 | usable as a general function for probing keymaps. However, if the | 1302 | usable as a general function for probing keymaps. However, if the |
| 1358 | third optional argument ACCEPT-DEFAULT is non-nil, `lookup-key' will | 1303 | third optional argument ACCEPT-DEFAULT is non-nil, `lookup-key' will |
| 1359 | recognize the default bindings, just as `read-key-sequence' does. */) | 1304 | recognize the default bindings, just as `read-key-sequence' does. */) |
| 1360 | (keymap, key, accept_default) | 1305 | (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default) |
| 1361 | Lisp_Object keymap; | ||
| 1362 | Lisp_Object key; | ||
| 1363 | Lisp_Object accept_default; | ||
| 1364 | { | 1306 | { |
| 1365 | register int idx; | 1307 | register int idx; |
| 1366 | register Lisp_Object cmd; | 1308 | register Lisp_Object cmd; |
| @@ -1393,7 +1335,7 @@ recognize the default bindings, just as `read-key-sequence' does. */) | |||
| 1393 | /* Allow string since binding for `menu-bar-select-buffer' | 1335 | /* Allow string since binding for `menu-bar-select-buffer' |
| 1394 | includes the buffer name in the key sequence. */ | 1336 | includes the buffer name in the key sequence. */ |
| 1395 | if (!INTEGERP (c) && !SYMBOLP (c) && !CONSP (c) && !STRINGP (c)) | 1337 | if (!INTEGERP (c) && !SYMBOLP (c) && !CONSP (c) && !STRINGP (c)) |
| 1396 | error ("Key sequence contains invalid event"); | 1338 | message_with_string ("Key sequence contains invalid event %s", c, 1); |
| 1397 | 1339 | ||
| 1398 | cmd = access_keymap (keymap, c, t_ok, 0, 1); | 1340 | cmd = access_keymap (keymap, c, t_ok, 0, 1); |
| 1399 | if (idx == length) | 1341 | if (idx == length) |
| @@ -1412,8 +1354,7 @@ recognize the default bindings, just as `read-key-sequence' does. */) | |||
| 1412 | Return the keymap. */ | 1354 | Return the keymap. */ |
| 1413 | 1355 | ||
| 1414 | static Lisp_Object | 1356 | static Lisp_Object |
| 1415 | define_as_prefix (keymap, c) | 1357 | define_as_prefix (Lisp_Object keymap, Lisp_Object c) |
| 1416 | Lisp_Object keymap, c; | ||
| 1417 | { | 1358 | { |
| 1418 | Lisp_Object cmd; | 1359 | Lisp_Object cmd; |
| 1419 | 1360 | ||
| @@ -1430,8 +1371,7 @@ define_as_prefix (keymap, c) | |||
| 1430 | /* Append a key to the end of a key sequence. We always make a vector. */ | 1371 | /* Append a key to the end of a key sequence. We always make a vector. */ |
| 1431 | 1372 | ||
| 1432 | Lisp_Object | 1373 | Lisp_Object |
| 1433 | append_key (key_sequence, key) | 1374 | append_key (Lisp_Object key_sequence, Lisp_Object key) |
| 1434 | Lisp_Object key_sequence, key; | ||
| 1435 | { | 1375 | { |
| 1436 | Lisp_Object args[2]; | 1376 | Lisp_Object args[2]; |
| 1437 | 1377 | ||
| @@ -1445,8 +1385,7 @@ append_key (key_sequence, key) | |||
| 1445 | signal an error if is a mistake such as RET or M-RET or C-DEL, etc. */ | 1385 | signal an error if is a mistake such as RET or M-RET or C-DEL, etc. */ |
| 1446 | 1386 | ||
| 1447 | static void | 1387 | static void |
| 1448 | silly_event_symbol_error (c) | 1388 | silly_event_symbol_error (Lisp_Object c) |
| 1449 | Lisp_Object c; | ||
| 1450 | { | 1389 | { |
| 1451 | Lisp_Object parsed, base, name, assoc; | 1390 | Lisp_Object parsed, base, name, assoc; |
| 1452 | int modifiers; | 1391 | int modifiers; |
| @@ -1515,8 +1454,7 @@ static int cmm_size = 0; | |||
| 1515 | list, let the key sequence be read, and hope some other piece of | 1454 | list, let the key sequence be read, and hope some other piece of |
| 1516 | code signals the error. */ | 1455 | code signals the error. */ |
| 1517 | int | 1456 | int |
| 1518 | current_minor_maps (modeptr, mapptr) | 1457 | current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr) |
| 1519 | Lisp_Object **modeptr, **mapptr; | ||
| 1520 | { | 1458 | { |
| 1521 | int i = 0; | 1459 | int i = 0; |
| 1522 | int list_number = 0; | 1460 | int list_number = 0; |
| @@ -1575,7 +1513,8 @@ current_minor_maps (modeptr, mapptr) | |||
| 1575 | { | 1513 | { |
| 1576 | if (cmm_modes) | 1514 | if (cmm_modes) |
| 1577 | { | 1515 | { |
| 1578 | bcopy (cmm_modes, newmodes, cmm_size * sizeof cmm_modes[0]); | 1516 | memcpy (newmodes, cmm_modes, |
| 1517 | cmm_size * sizeof cmm_modes[0]); | ||
| 1579 | free (cmm_modes); | 1518 | free (cmm_modes); |
| 1580 | } | 1519 | } |
| 1581 | cmm_modes = newmodes; | 1520 | cmm_modes = newmodes; |
| @@ -1586,7 +1525,8 @@ current_minor_maps (modeptr, mapptr) | |||
| 1586 | { | 1525 | { |
| 1587 | if (cmm_maps) | 1526 | if (cmm_maps) |
| 1588 | { | 1527 | { |
| 1589 | bcopy (cmm_maps, newmaps, cmm_size * sizeof cmm_maps[0]); | 1528 | memcpy (newmaps, cmm_maps, |
| 1529 | cmm_size * sizeof cmm_maps[0]); | ||
| 1590 | free (cmm_maps); | 1530 | free (cmm_maps); |
| 1591 | } | 1531 | } |
| 1592 | cmm_maps = newmaps; | 1532 | cmm_maps = newmaps; |
| @@ -1620,8 +1560,7 @@ DEFUN ("current-active-maps", Fcurrent_active_maps, Scurrent_active_maps, | |||
| 1620 | OLP if non-nil indicates that we should obey `overriding-local-map' and | 1560 | OLP if non-nil indicates that we should obey `overriding-local-map' and |
| 1621 | `overriding-terminal-local-map'. POSITION can specify a click position | 1561 | `overriding-terminal-local-map'. POSITION can specify a click position |
| 1622 | like in the respective argument of `key-binding'. */) | 1562 | like in the respective argument of `key-binding'. */) |
| 1623 | (olp, position) | 1563 | (Lisp_Object olp, Lisp_Object position) |
| 1624 | Lisp_Object olp, position; | ||
| 1625 | { | 1564 | { |
| 1626 | int count = SPECPDL_INDEX (); | 1565 | int count = SPECPDL_INDEX (); |
| 1627 | 1566 | ||
| @@ -1784,8 +1723,7 @@ occurs in the keymaps associated with it instead of KEY. It can also | |||
| 1784 | be a number or marker, in which case the keymap properties at the | 1723 | be a number or marker, in which case the keymap properties at the |
| 1785 | specified buffer position instead of point are used. | 1724 | specified buffer position instead of point are used. |
| 1786 | */) | 1725 | */) |
| 1787 | (key, accept_default, no_remap, position) | 1726 | (Lisp_Object key, Lisp_Object accept_default, Lisp_Object no_remap, Lisp_Object position) |
| 1788 | Lisp_Object key, accept_default, no_remap, position; | ||
| 1789 | { | 1727 | { |
| 1790 | Lisp_Object *maps, value; | 1728 | Lisp_Object *maps, value; |
| 1791 | int nmaps, i; | 1729 | int nmaps, i; |
| @@ -1975,8 +1913,7 @@ The binding is probably a symbol with a function definition. | |||
| 1975 | 1913 | ||
| 1976 | If optional argument ACCEPT-DEFAULT is non-nil, recognize default | 1914 | If optional argument ACCEPT-DEFAULT is non-nil, recognize default |
| 1977 | bindings; see the description of `lookup-key' for more details about this. */) | 1915 | bindings; see the description of `lookup-key' for more details about this. */) |
| 1978 | (keys, accept_default) | 1916 | (Lisp_Object keys, Lisp_Object accept_default) |
| 1979 | Lisp_Object keys, accept_default; | ||
| 1980 | { | 1917 | { |
| 1981 | register Lisp_Object map; | 1918 | register Lisp_Object map; |
| 1982 | map = current_buffer->keymap; | 1919 | map = current_buffer->keymap; |
| @@ -1996,8 +1933,7 @@ This function's return values are the same as those of `lookup-key' | |||
| 1996 | 1933 | ||
| 1997 | If optional argument ACCEPT-DEFAULT is non-nil, recognize default | 1934 | If optional argument ACCEPT-DEFAULT is non-nil, recognize default |
| 1998 | bindings; see the description of `lookup-key' for more details about this. */) | 1935 | bindings; see the description of `lookup-key' for more details about this. */) |
| 1999 | (keys, accept_default) | 1936 | (Lisp_Object keys, Lisp_Object accept_default) |
| 2000 | Lisp_Object keys, accept_default; | ||
| 2001 | { | 1937 | { |
| 2002 | return Flookup_key (current_global_map, keys, accept_default); | 1938 | return Flookup_key (current_global_map, keys, accept_default); |
| 2003 | } | 1939 | } |
| @@ -2016,8 +1952,7 @@ that come after prefix bindings. | |||
| 2016 | 1952 | ||
| 2017 | If optional argument ACCEPT-DEFAULT is non-nil, recognize default | 1953 | If optional argument ACCEPT-DEFAULT is non-nil, recognize default |
| 2018 | bindings; see the description of `lookup-key' for more details about this. */) | 1954 | bindings; see the description of `lookup-key' for more details about this. */) |
| 2019 | (key, accept_default) | 1955 | (Lisp_Object key, Lisp_Object accept_default) |
| 2020 | Lisp_Object key, accept_default; | ||
| 2021 | { | 1956 | { |
| 2022 | Lisp_Object *modes, *maps; | 1957 | Lisp_Object *modes, *maps; |
| 2023 | int nmaps; | 1958 | int nmaps; |
| @@ -2056,8 +1991,7 @@ as a function. | |||
| 2056 | The third optional argument NAME, if given, supplies a menu name | 1991 | The third optional argument NAME, if given, supplies a menu name |
| 2057 | string for the map. This is required to use the keymap as a menu. | 1992 | string for the map. This is required to use the keymap as a menu. |
| 2058 | This function returns COMMAND. */) | 1993 | This function returns COMMAND. */) |
| 2059 | (command, mapvar, name) | 1994 | (Lisp_Object command, Lisp_Object mapvar, Lisp_Object name) |
| 2060 | Lisp_Object command, mapvar, name; | ||
| 2061 | { | 1995 | { |
| 2062 | Lisp_Object map; | 1996 | Lisp_Object map; |
| 2063 | map = Fmake_sparse_keymap (name); | 1997 | map = Fmake_sparse_keymap (name); |
| @@ -2071,8 +2005,7 @@ This function returns COMMAND. */) | |||
| 2071 | 2005 | ||
| 2072 | DEFUN ("use-global-map", Fuse_global_map, Suse_global_map, 1, 1, 0, | 2006 | DEFUN ("use-global-map", Fuse_global_map, Suse_global_map, 1, 1, 0, |
| 2073 | doc: /* Select KEYMAP as the global keymap. */) | 2007 | doc: /* Select KEYMAP as the global keymap. */) |
| 2074 | (keymap) | 2008 | (Lisp_Object keymap) |
| 2075 | Lisp_Object keymap; | ||
| 2076 | { | 2009 | { |
| 2077 | keymap = get_keymap (keymap, 1, 1); | 2010 | keymap = get_keymap (keymap, 1, 1); |
| 2078 | current_global_map = keymap; | 2011 | current_global_map = keymap; |
| @@ -2083,8 +2016,7 @@ DEFUN ("use-global-map", Fuse_global_map, Suse_global_map, 1, 1, 0, | |||
| 2083 | DEFUN ("use-local-map", Fuse_local_map, Suse_local_map, 1, 1, 0, | 2016 | DEFUN ("use-local-map", Fuse_local_map, Suse_local_map, 1, 1, 0, |
| 2084 | doc: /* Select KEYMAP as the local keymap. | 2017 | doc: /* Select KEYMAP as the local keymap. |
| 2085 | If KEYMAP is nil, that means no local keymap. */) | 2018 | If KEYMAP is nil, that means no local keymap. */) |
| 2086 | (keymap) | 2019 | (Lisp_Object keymap) |
| 2087 | Lisp_Object keymap; | ||
| 2088 | { | 2020 | { |
| 2089 | if (!NILP (keymap)) | 2021 | if (!NILP (keymap)) |
| 2090 | keymap = get_keymap (keymap, 1, 1); | 2022 | keymap = get_keymap (keymap, 1, 1); |
| @@ -2097,21 +2029,21 @@ If KEYMAP is nil, that means no local keymap. */) | |||
| 2097 | DEFUN ("current-local-map", Fcurrent_local_map, Scurrent_local_map, 0, 0, 0, | 2029 | DEFUN ("current-local-map", Fcurrent_local_map, Scurrent_local_map, 0, 0, 0, |
| 2098 | doc: /* Return current buffer's local keymap, or nil if it has none. | 2030 | doc: /* Return current buffer's local keymap, or nil if it has none. |
| 2099 | Normally the local keymap is set by the major mode with `use-local-map'. */) | 2031 | Normally the local keymap is set by the major mode with `use-local-map'. */) |
| 2100 | () | 2032 | (void) |
| 2101 | { | 2033 | { |
| 2102 | return current_buffer->keymap; | 2034 | return current_buffer->keymap; |
| 2103 | } | 2035 | } |
| 2104 | 2036 | ||
| 2105 | DEFUN ("current-global-map", Fcurrent_global_map, Scurrent_global_map, 0, 0, 0, | 2037 | DEFUN ("current-global-map", Fcurrent_global_map, Scurrent_global_map, 0, 0, 0, |
| 2106 | doc: /* Return the current global keymap. */) | 2038 | doc: /* Return the current global keymap. */) |
| 2107 | () | 2039 | (void) |
| 2108 | { | 2040 | { |
| 2109 | return current_global_map; | 2041 | return current_global_map; |
| 2110 | } | 2042 | } |
| 2111 | 2043 | ||
| 2112 | DEFUN ("current-minor-mode-maps", Fcurrent_minor_mode_maps, Scurrent_minor_mode_maps, 0, 0, 0, | 2044 | DEFUN ("current-minor-mode-maps", Fcurrent_minor_mode_maps, Scurrent_minor_mode_maps, 0, 0, 0, |
| 2113 | doc: /* Return a list of keymaps for the minor modes of the current buffer. */) | 2045 | doc: /* Return a list of keymaps for the minor modes of the current buffer. */) |
| 2114 | () | 2046 | (void) |
| 2115 | { | 2047 | { |
| 2116 | Lisp_Object *maps; | 2048 | Lisp_Object *maps; |
| 2117 | int nmaps = current_minor_maps (0, &maps); | 2049 | int nmaps = current_minor_maps (0, &maps); |
| @@ -2128,10 +2060,8 @@ struct accessible_keymaps_data { | |||
| 2128 | }; | 2060 | }; |
| 2129 | 2061 | ||
| 2130 | static void | 2062 | static void |
| 2131 | accessible_keymaps_1 (key, cmd, args, data) | 2063 | accessible_keymaps_1 (Lisp_Object key, Lisp_Object cmd, Lisp_Object args, void *data) |
| 2132 | Lisp_Object key, cmd, args; | 2064 | /* Use void* data to be compatible with map_keymap_function_t. */ |
| 2133 | /* Use void* to be compatible with map_keymap_function_t. */ | ||
| 2134 | void *data; | ||
| 2135 | { | 2065 | { |
| 2136 | struct accessible_keymaps_data *d = data; /* Cast! */ | 2066 | struct accessible_keymaps_data *d = data; /* Cast! */ |
| 2137 | Lisp_Object maps = d->maps; | 2067 | Lisp_Object maps = d->maps; |
| @@ -2201,8 +2131,7 @@ KEYS starting from KEYMAP gets you to MAP. These elements are ordered | |||
| 2201 | so that the KEYS increase in length. The first element is ([] . KEYMAP). | 2131 | so that the KEYS increase in length. The first element is ([] . KEYMAP). |
| 2202 | An optional argument PREFIX, if non-nil, should be a key sequence; | 2132 | An optional argument PREFIX, if non-nil, should be a key sequence; |
| 2203 | then the value includes only maps for prefixes that start with PREFIX. */) | 2133 | then the value includes only maps for prefixes that start with PREFIX. */) |
| 2204 | (keymap, prefix) | 2134 | (Lisp_Object keymap, Lisp_Object prefix) |
| 2205 | Lisp_Object keymap, prefix; | ||
| 2206 | { | 2135 | { |
| 2207 | Lisp_Object maps, tail; | 2136 | Lisp_Object maps, tail; |
| 2208 | int prefixlen = XINT (Flength (prefix)); | 2137 | int prefixlen = XINT (Flength (prefix)); |
| @@ -2290,8 +2219,7 @@ DEFUN ("key-description", Fkey_description, Skey_description, 1, 2, 0, | |||
| 2290 | Optional arg PREFIX is the sequence of keys leading up to KEYS. | 2219 | Optional arg PREFIX is the sequence of keys leading up to KEYS. |
| 2291 | Control characters turn into "C-foo" sequences, meta into "M-foo", | 2220 | Control characters turn into "C-foo" sequences, meta into "M-foo", |
| 2292 | spaces are put between sequence elements, etc. */) | 2221 | spaces are put between sequence elements, etc. */) |
| 2293 | (keys, prefix) | 2222 | (Lisp_Object keys, Lisp_Object prefix) |
| 2294 | Lisp_Object keys, prefix; | ||
| 2295 | { | 2223 | { |
| 2296 | int len = 0; | 2224 | int len = 0; |
| 2297 | int i, i_byte; | 2225 | int i, i_byte; |
| @@ -2389,10 +2317,7 @@ spaces are put between sequence elements, etc. */) | |||
| 2389 | 2317 | ||
| 2390 | 2318 | ||
| 2391 | char * | 2319 | char * |
| 2392 | push_key_description (c, p, force_multibyte) | 2320 | push_key_description (register unsigned int c, register char *p, int force_multibyte) |
| 2393 | register unsigned int c; | ||
| 2394 | register char *p; | ||
| 2395 | int force_multibyte; | ||
| 2396 | { | 2321 | { |
| 2397 | unsigned c2; | 2322 | unsigned c2; |
| 2398 | 2323 | ||
| @@ -2514,8 +2439,7 @@ DEFUN ("single-key-description", Fsingle_key_description, | |||
| 2514 | Control characters turn into C-whatever, etc. | 2439 | Control characters turn into C-whatever, etc. |
| 2515 | Optional argument NO-ANGLES non-nil means don't put angle brackets | 2440 | Optional argument NO-ANGLES non-nil means don't put angle brackets |
| 2516 | around function keys and event symbols. */) | 2441 | around function keys and event symbols. */) |
| 2517 | (key, no_angles) | 2442 | (Lisp_Object key, Lisp_Object no_angles) |
| 2518 | Lisp_Object key, no_angles; | ||
| 2519 | { | 2443 | { |
| 2520 | if (CONSP (key) && lucid_event_type_list_p (key)) | 2444 | if (CONSP (key) && lucid_event_type_list_p (key)) |
| 2521 | key = Fevent_convert_list (key); | 2445 | key = Fevent_convert_list (key); |
| @@ -2549,9 +2473,7 @@ around function keys and event symbols. */) | |||
| 2549 | } | 2473 | } |
| 2550 | 2474 | ||
| 2551 | char * | 2475 | char * |
| 2552 | push_text_char_description (c, p) | 2476 | push_text_char_description (register unsigned int c, register char *p) |
| 2553 | register unsigned int c; | ||
| 2554 | register char *p; | ||
| 2555 | { | 2477 | { |
| 2556 | if (c >= 0200) | 2478 | if (c >= 0200) |
| 2557 | { | 2479 | { |
| @@ -2583,8 +2505,7 @@ Control characters turn into "^char", etc. This differs from | |||
| 2583 | Also, this function recognizes the 2**7 bit as the Meta character, | 2505 | Also, this function recognizes the 2**7 bit as the Meta character, |
| 2584 | whereas `single-key-description' uses the 2**27 bit for Meta. | 2506 | whereas `single-key-description' uses the 2**27 bit for Meta. |
| 2585 | See Info node `(elisp)Describing Characters' for examples. */) | 2507 | See Info node `(elisp)Describing Characters' for examples. */) |
| 2586 | (character) | 2508 | (Lisp_Object character) |
| 2587 | Lisp_Object character; | ||
| 2588 | { | 2509 | { |
| 2589 | /* Currently MAX_MULTIBYTE_LENGTH is 4 (< 6). */ | 2510 | /* Currently MAX_MULTIBYTE_LENGTH is 4 (< 6). */ |
| 2590 | unsigned char str[6]; | 2511 | unsigned char str[6]; |
| @@ -2611,8 +2532,7 @@ static int where_is_preferred_modifier; | |||
| 2611 | Else, return 2 if SEQ uses the where_is_preferred_modifier, | 2532 | Else, return 2 if SEQ uses the where_is_preferred_modifier, |
| 2612 | and 1 otherwise. */ | 2533 | and 1 otherwise. */ |
| 2613 | static int | 2534 | static int |
| 2614 | preferred_sequence_p (seq) | 2535 | preferred_sequence_p (Lisp_Object seq) |
| 2615 | Lisp_Object seq; | ||
| 2616 | { | 2536 | { |
| 2617 | int i; | 2537 | int i; |
| 2618 | int len = XINT (Flength (seq)); | 2538 | int len = XINT (Flength (seq)); |
| @@ -2643,8 +2563,8 @@ preferred_sequence_p (seq) | |||
| 2643 | 2563 | ||
| 2644 | /* where-is - finding a command in a set of keymaps. */ | 2564 | /* where-is - finding a command in a set of keymaps. */ |
| 2645 | 2565 | ||
| 2646 | static void where_is_internal_1 P_ ((Lisp_Object key, Lisp_Object binding, | 2566 | static void where_is_internal_1 (Lisp_Object key, Lisp_Object binding, |
| 2647 | Lisp_Object args, void *data)); | 2567 | Lisp_Object args, void *data); |
| 2648 | 2568 | ||
| 2649 | /* Like Flookup_key, but uses a list of keymaps SHADOW instead of a single map. | 2569 | /* Like Flookup_key, but uses a list of keymaps SHADOW instead of a single map. |
| 2650 | Returns the first non-nil binding found in any of those maps. | 2570 | Returns the first non-nil binding found in any of those maps. |
| @@ -2814,9 +2734,7 @@ indirect definition itself. | |||
| 2814 | If optional 5th arg NO-REMAP is non-nil, don't search for key sequences | 2734 | If optional 5th arg NO-REMAP is non-nil, don't search for key sequences |
| 2815 | that invoke a command which is remapped to DEFINITION, but include the | 2735 | that invoke a command which is remapped to DEFINITION, but include the |
| 2816 | remapped command in the returned list. */) | 2736 | remapped command in the returned list. */) |
| 2817 | (definition, keymap, firstonly, noindirect, no_remap) | 2737 | (Lisp_Object definition, Lisp_Object keymap, Lisp_Object firstonly, Lisp_Object noindirect, Lisp_Object no_remap) |
| 2818 | Lisp_Object definition, keymap; | ||
| 2819 | Lisp_Object firstonly, noindirect, no_remap; | ||
| 2820 | { | 2738 | { |
| 2821 | /* The keymaps in which to search. */ | 2739 | /* The keymaps in which to search. */ |
| 2822 | Lisp_Object keymaps; | 2740 | Lisp_Object keymaps; |
| @@ -2982,9 +2900,7 @@ remapped command in the returned list. */) | |||
| 2982 | /* This function can GC because get_keyelt can. */ | 2900 | /* This function can GC because get_keyelt can. */ |
| 2983 | 2901 | ||
| 2984 | static void | 2902 | static void |
| 2985 | where_is_internal_1 (key, binding, args, data) | 2903 | where_is_internal_1 (Lisp_Object key, Lisp_Object binding, Lisp_Object args, void *data) |
| 2986 | Lisp_Object key, binding, args; | ||
| 2987 | void *data; | ||
| 2988 | { | 2904 | { |
| 2989 | struct where_is_internal_data *d = data; /* Cast! */ | 2905 | struct where_is_internal_data *d = data; /* Cast! */ |
| 2990 | Lisp_Object definition = d->definition; | 2906 | Lisp_Object definition = d->definition; |
| @@ -3039,15 +2955,14 @@ The optional argument PREFIX, if non-nil, should be a key sequence; | |||
| 3039 | then we display only bindings that start with that prefix. | 2955 | then we display only bindings that start with that prefix. |
| 3040 | The optional argument MENUS, if non-nil, says to mention menu bindings. | 2956 | The optional argument MENUS, if non-nil, says to mention menu bindings. |
| 3041 | \(Ordinarily these are omitted from the output.) */) | 2957 | \(Ordinarily these are omitted from the output.) */) |
| 3042 | (buffer, prefix, menus) | 2958 | (Lisp_Object buffer, Lisp_Object prefix, Lisp_Object menus) |
| 3043 | Lisp_Object buffer, prefix, menus; | ||
| 3044 | { | 2959 | { |
| 3045 | Lisp_Object outbuf, shadow; | 2960 | Lisp_Object outbuf, shadow; |
| 3046 | int nomenu = NILP (menus); | 2961 | int nomenu = NILP (menus); |
| 3047 | register Lisp_Object start1; | 2962 | register Lisp_Object start1; |
| 3048 | struct gcpro gcpro1; | 2963 | struct gcpro gcpro1; |
| 3049 | 2964 | ||
| 3050 | char *alternate_heading | 2965 | const char *alternate_heading |
| 3051 | = "\ | 2966 | = "\ |
| 3052 | Keyboard translations:\n\n\ | 2967 | Keyboard translations:\n\n\ |
| 3053 | You type Translation\n\ | 2968 | You type Translation\n\ |
| @@ -3151,12 +3066,12 @@ You type Translation\n\ | |||
| 3151 | *p++ = '\f'; | 3066 | *p++ = '\f'; |
| 3152 | *p++ = '\n'; | 3067 | *p++ = '\n'; |
| 3153 | *p++ = '`'; | 3068 | *p++ = '`'; |
| 3154 | bcopy (SDATA (SYMBOL_NAME (modes[i])), p, | 3069 | memcpy (p, SDATA (SYMBOL_NAME (modes[i])), |
| 3155 | SCHARS (SYMBOL_NAME (modes[i]))); | 3070 | SCHARS (SYMBOL_NAME (modes[i]))); |
| 3156 | p += SCHARS (SYMBOL_NAME (modes[i])); | 3071 | p += SCHARS (SYMBOL_NAME (modes[i])); |
| 3157 | *p++ = '\''; | 3072 | *p++ = '\''; |
| 3158 | bcopy (" Minor Mode Bindings", p, sizeof (" Minor Mode Bindings") - 1); | 3073 | memcpy (p, " Minor Mode Bindings", strlen (" Minor Mode Bindings")); |
| 3159 | p += sizeof (" Minor Mode Bindings") - 1; | 3074 | p += strlen (" Minor Mode Bindings"); |
| 3160 | *p = 0; | 3075 | *p = 0; |
| 3161 | 3076 | ||
| 3162 | describe_map_tree (maps[i], 1, shadow, prefix, | 3077 | describe_map_tree (maps[i], 1, shadow, prefix, |
| @@ -3218,20 +3133,14 @@ You type Translation\n\ | |||
| 3218 | don't omit it; instead, mention it but say it is shadowed. */ | 3133 | don't omit it; instead, mention it but say it is shadowed. */ |
| 3219 | 3134 | ||
| 3220 | void | 3135 | void |
| 3221 | describe_map_tree (startmap, partial, shadow, prefix, title, nomenu, transl, | 3136 | describe_map_tree (Lisp_Object startmap, int partial, Lisp_Object shadow, |
| 3222 | always_title, mention_shadow) | 3137 | Lisp_Object prefix, const char *title, int nomenu, int transl, |
| 3223 | Lisp_Object startmap, shadow, prefix; | 3138 | int always_title, int mention_shadow) |
| 3224 | int partial; | ||
| 3225 | char *title; | ||
| 3226 | int nomenu; | ||
| 3227 | int transl; | ||
| 3228 | int always_title; | ||
| 3229 | int mention_shadow; | ||
| 3230 | { | 3139 | { |
| 3231 | Lisp_Object maps, orig_maps, seen, sub_shadows; | 3140 | Lisp_Object maps, orig_maps, seen, sub_shadows; |
| 3232 | struct gcpro gcpro1, gcpro2, gcpro3; | 3141 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 3233 | int something = 0; | 3142 | int something = 0; |
| 3234 | char *key_heading | 3143 | const char *key_heading |
| 3235 | = "\ | 3144 | = "\ |
| 3236 | key binding\n\ | 3145 | key binding\n\ |
| 3237 | --- -------\n"; | 3146 | --- -------\n"; |
| @@ -3342,8 +3251,7 @@ key binding\n\ | |||
| 3342 | static int previous_description_column; | 3251 | static int previous_description_column; |
| 3343 | 3252 | ||
| 3344 | static void | 3253 | static void |
| 3345 | describe_command (definition, args) | 3254 | describe_command (Lisp_Object definition, Lisp_Object args) |
| 3346 | Lisp_Object definition, args; | ||
| 3347 | { | 3255 | { |
| 3348 | register Lisp_Object tem1; | 3256 | register Lisp_Object tem1; |
| 3349 | int column = (int) current_column (); /* iftc */ | 3257 | int column = (int) current_column (); /* iftc */ |
| @@ -3379,8 +3287,7 @@ describe_command (definition, args) | |||
| 3379 | } | 3287 | } |
| 3380 | 3288 | ||
| 3381 | static void | 3289 | static void |
| 3382 | describe_translation (definition, args) | 3290 | describe_translation (Lisp_Object definition, Lisp_Object args) |
| 3383 | Lisp_Object definition, args; | ||
| 3384 | { | 3291 | { |
| 3385 | register Lisp_Object tem1; | 3292 | register Lisp_Object tem1; |
| 3386 | 3293 | ||
| @@ -3413,8 +3320,7 @@ struct describe_map_elt { Lisp_Object event; Lisp_Object definition; int shadowe | |||
| 3413 | the event field. */ | 3320 | the event field. */ |
| 3414 | 3321 | ||
| 3415 | static int | 3322 | static int |
| 3416 | describe_map_compare (aa, bb) | 3323 | describe_map_compare (const void *aa, const void *bb) |
| 3417 | const void *aa, *bb; | ||
| 3418 | { | 3324 | { |
| 3419 | const struct describe_map_elt *a = aa, *b = bb; | 3325 | const struct describe_map_elt *a = aa, *b = bb; |
| 3420 | if (INTEGERP (a->event) && INTEGERP (b->event)) | 3326 | if (INTEGERP (a->event) && INTEGERP (b->event)) |
| @@ -3436,16 +3342,10 @@ describe_map_compare (aa, bb) | |||
| 3436 | PARTIAL, SHADOW, NOMENU are as in `describe_map_tree' above. */ | 3342 | PARTIAL, SHADOW, NOMENU are as in `describe_map_tree' above. */ |
| 3437 | 3343 | ||
| 3438 | static void | 3344 | static void |
| 3439 | describe_map (map, prefix, elt_describer, partial, shadow, | 3345 | describe_map (Lisp_Object map, Lisp_Object prefix, |
| 3440 | seen, nomenu, mention_shadow) | 3346 | void (*elt_describer) (Lisp_Object, Lisp_Object), |
| 3441 | register Lisp_Object map; | 3347 | int partial, Lisp_Object shadow, |
| 3442 | Lisp_Object prefix; | 3348 | Lisp_Object *seen, int nomenu, int mention_shadow) |
| 3443 | void (*elt_describer) P_ ((Lisp_Object, Lisp_Object)); | ||
| 3444 | int partial; | ||
| 3445 | Lisp_Object shadow; | ||
| 3446 | Lisp_Object *seen; | ||
| 3447 | int nomenu; | ||
| 3448 | int mention_shadow; | ||
| 3449 | { | 3349 | { |
| 3450 | Lisp_Object tail, definition, event; | 3350 | Lisp_Object tail, definition, event; |
| 3451 | Lisp_Object tem; | 3351 | Lisp_Object tem; |
| @@ -3624,8 +3524,7 @@ describe_map (map, prefix, elt_describer, partial, shadow, | |||
| 3624 | } | 3524 | } |
| 3625 | 3525 | ||
| 3626 | static void | 3526 | static void |
| 3627 | describe_vector_princ (elt, fun) | 3527 | describe_vector_princ (Lisp_Object elt, Lisp_Object fun) |
| 3628 | Lisp_Object elt, fun; | ||
| 3629 | { | 3528 | { |
| 3630 | Findent_to (make_number (16), make_number (1)); | 3529 | Findent_to (make_number (16), make_number (1)); |
| 3631 | call1 (fun, elt); | 3530 | call1 (fun, elt); |
| @@ -3636,8 +3535,7 @@ DEFUN ("describe-vector", Fdescribe_vector, Sdescribe_vector, 1, 2, 0, | |||
| 3636 | doc: /* Insert a description of contents of VECTOR. | 3535 | doc: /* Insert a description of contents of VECTOR. |
| 3637 | This is text showing the elements of vector matched against indices. | 3536 | This is text showing the elements of vector matched against indices. |
| 3638 | DESCRIBER is the output function used; nil means use `princ'. */) | 3537 | DESCRIBER is the output function used; nil means use `princ'. */) |
| 3639 | (vector, describer) | 3538 | (Lisp_Object vector, Lisp_Object describer) |
| 3640 | Lisp_Object vector, describer; | ||
| 3641 | { | 3539 | { |
| 3642 | int count = SPECPDL_INDEX (); | 3540 | int count = SPECPDL_INDEX (); |
| 3643 | if (NILP (describer)) | 3541 | if (NILP (describer)) |
| @@ -3686,20 +3584,11 @@ DESCRIBER is the output function used; nil means use `princ'. */) | |||
| 3686 | ARGS is simply passed as the second argument to ELT_DESCRIBER. */ | 3584 | ARGS is simply passed as the second argument to ELT_DESCRIBER. */ |
| 3687 | 3585 | ||
| 3688 | static void | 3586 | static void |
| 3689 | describe_vector (vector, prefix, args, elt_describer, | 3587 | describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args, |
| 3690 | partial, shadow, entire_map, | 3588 | void (*elt_describer) (Lisp_Object, Lisp_Object), |
| 3691 | indices, char_table_depth, keymap_p, | 3589 | int partial, Lisp_Object shadow, Lisp_Object entire_map, |
| 3692 | mention_shadow) | 3590 | int *indices, int char_table_depth, int keymap_p, |
| 3693 | register Lisp_Object vector; | 3591 | int mention_shadow) |
| 3694 | Lisp_Object prefix, args; | ||
| 3695 | void (*elt_describer) P_ ((Lisp_Object, Lisp_Object)); | ||
| 3696 | int partial; | ||
| 3697 | Lisp_Object shadow; | ||
| 3698 | Lisp_Object entire_map; | ||
| 3699 | int *indices; | ||
| 3700 | int char_table_depth; | ||
| 3701 | int keymap_p; | ||
| 3702 | int mention_shadow; | ||
| 3703 | { | 3592 | { |
| 3704 | Lisp_Object definition; | 3593 | Lisp_Object definition; |
| 3705 | Lisp_Object tem2; | 3594 | Lisp_Object tem2; |
| @@ -3893,8 +3782,7 @@ static Lisp_Object apropos_predicate; | |||
| 3893 | static Lisp_Object apropos_accumulate; | 3782 | static Lisp_Object apropos_accumulate; |
| 3894 | 3783 | ||
| 3895 | static void | 3784 | static void |
| 3896 | apropos_accum (symbol, string) | 3785 | apropos_accum (Lisp_Object symbol, Lisp_Object string) |
| 3897 | Lisp_Object symbol, string; | ||
| 3898 | { | 3786 | { |
| 3899 | register Lisp_Object tem; | 3787 | register Lisp_Object tem; |
| 3900 | 3788 | ||
| @@ -3910,8 +3798,7 @@ DEFUN ("apropos-internal", Fapropos_internal, Sapropos_internal, 1, 2, 0, | |||
| 3910 | If optional 2nd arg PREDICATE is non-nil, (funcall PREDICATE SYMBOL) is done | 3798 | If optional 2nd arg PREDICATE is non-nil, (funcall PREDICATE SYMBOL) is done |
| 3911 | for each symbol and a symbol is mentioned only if that returns non-nil. | 3799 | for each symbol and a symbol is mentioned only if that returns non-nil. |
| 3912 | Return list of symbols found. */) | 3800 | Return list of symbols found. */) |
| 3913 | (regexp, predicate) | 3801 | (Lisp_Object regexp, Lisp_Object predicate) |
| 3914 | Lisp_Object regexp, predicate; | ||
| 3915 | { | 3802 | { |
| 3916 | Lisp_Object tem; | 3803 | Lisp_Object tem; |
| 3917 | CHECK_STRING (regexp); | 3804 | CHECK_STRING (regexp); |
| @@ -3925,7 +3812,7 @@ Return list of symbols found. */) | |||
| 3925 | } | 3812 | } |
| 3926 | 3813 | ||
| 3927 | void | 3814 | void |
| 3928 | syms_of_keymap () | 3815 | syms_of_keymap (void) |
| 3929 | { | 3816 | { |
| 3930 | Qkeymap = intern_c_string ("keymap"); | 3817 | Qkeymap = intern_c_string ("keymap"); |
| 3931 | staticpro (&Qkeymap); | 3818 | staticpro (&Qkeymap); |
| @@ -4119,7 +4006,7 @@ preferred. */); | |||
| 4119 | } | 4006 | } |
| 4120 | 4007 | ||
| 4121 | void | 4008 | void |
| 4122 | keys_of_keymap () | 4009 | keys_of_keymap (void) |
| 4123 | { | 4010 | { |
| 4124 | initial_define_key (global_map, 033, "ESC-prefix"); | 4011 | initial_define_key (global_map, 033, "ESC-prefix"); |
| 4125 | initial_define_key (global_map, Ctl ('X'), "Control-X-prefix"); | 4012 | initial_define_key (global_map, Ctl ('X'), "Control-X-prefix"); |