Mercurial > emacs
comparison src/keymap.c @ 109351:c8a969d13eda
merge trunk
| author | Kenichi Handa <handa@etlken> |
|---|---|
| date | Fri, 09 Jul 2010 15:55:27 +0900 |
| parents | 8cfee7d2955f |
| children | 60516122d066 |
comparison
equal
deleted
inserted
replaced
| 109350:c11d07f3d731 | 109351:c8a969d13eda |
|---|---|
| 140 function keys, mouse events, and any other things that appear in the | 140 function keys, mouse events, and any other things that appear in the |
| 141 input stream. Initially, ALIST is nil. | 141 input stream. Initially, ALIST is nil. |
| 142 | 142 |
| 143 The optional arg STRING supplies a menu name for the keymap | 143 The optional arg STRING supplies a menu name for the keymap |
| 144 in case you use it as a menu with `x-popup-menu'. */) | 144 in case you use it as a menu with `x-popup-menu'. */) |
| 145 (string) | 145 (Lisp_Object string) |
| 146 Lisp_Object string; | |
| 147 { | 146 { |
| 148 Lisp_Object tail; | 147 Lisp_Object tail; |
| 149 if (!NILP (string)) | 148 if (!NILP (string)) |
| 150 tail = Fcons (string, Qnil); | 149 tail = Fcons (string, Qnil); |
| 151 else | 150 else |
| 161 which binds the function key or mouse event SYMBOL to DEFINITION. | 160 which binds the function key or mouse event SYMBOL to DEFINITION. |
| 162 Initially the alist is nil. | 161 Initially the alist is nil. |
| 163 | 162 |
| 164 The optional arg STRING supplies a menu name for the keymap | 163 The optional arg STRING supplies a menu name for the keymap |
| 165 in case you use it as a menu with `x-popup-menu'. */) | 164 in case you use it as a menu with `x-popup-menu'. */) |
| 166 (string) | 165 (Lisp_Object string) |
| 167 Lisp_Object string; | |
| 168 { | 166 { |
| 169 if (!NILP (string)) | 167 if (!NILP (string)) |
| 170 { | 168 { |
| 171 if (!NILP (Vpurify_flag)) | 169 if (!NILP (Vpurify_flag)) |
| 172 string = Fpurecopy (string); | 170 string = Fpurecopy (string); |
| 200 A keymap is a list (keymap . ALIST), | 198 A keymap is a list (keymap . ALIST), |
| 201 or a symbol whose function definition is itself a keymap. | 199 or a symbol whose function definition is itself a keymap. |
| 202 ALIST elements look like (CHAR . DEFN) or (SYMBOL . DEFN); | 200 ALIST elements look like (CHAR . DEFN) or (SYMBOL . DEFN); |
| 203 a vector of densely packed bindings for small character codes | 201 a vector of densely packed bindings for small character codes |
| 204 is also allowed as an element. */) | 202 is also allowed as an element. */) |
| 205 (object) | 203 (Lisp_Object object) |
| 206 Lisp_Object object; | |
| 207 { | 204 { |
| 208 return (KEYMAPP (object) ? Qt : Qnil); | 205 return (KEYMAPP (object) ? Qt : Qnil); |
| 209 } | 206 } |
| 210 | 207 |
| 211 DEFUN ("keymap-prompt", Fkeymap_prompt, Skeymap_prompt, 1, 1, 0, | 208 DEFUN ("keymap-prompt", Fkeymap_prompt, Skeymap_prompt, 1, 1, 0, |
| 212 doc: /* Return the prompt-string of a keymap MAP. | 209 doc: /* Return the prompt-string of a keymap MAP. |
| 213 If non-nil, the prompt is shown in the echo-area | 210 If non-nil, the prompt is shown in the echo-area |
| 214 when reading a key-sequence to be looked-up in this keymap. */) | 211 when reading a key-sequence to be looked-up in this keymap. */) |
| 215 (map) | 212 (Lisp_Object map) |
| 216 Lisp_Object map; | |
| 217 { | 213 { |
| 218 map = get_keymap (map, 0, 0); | 214 map = get_keymap (map, 0, 0); |
| 219 while (CONSP (map)) | 215 while (CONSP (map)) |
| 220 { | 216 { |
| 221 Lisp_Object tem = XCAR (map); | 217 Lisp_Object tem = XCAR (map); |
| 320 } | 316 } |
| 321 | 317 |
| 322 DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0, | 318 DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0, |
| 323 doc: /* Return the parent keymap of KEYMAP. | 319 doc: /* Return the parent keymap of KEYMAP. |
| 324 If KEYMAP has no parent, return nil. */) | 320 If KEYMAP has no parent, return nil. */) |
| 325 (keymap) | 321 (Lisp_Object keymap) |
| 326 Lisp_Object keymap; | |
| 327 { | 322 { |
| 328 return keymap_parent (keymap, 1); | 323 return keymap_parent (keymap, 1); |
| 329 } | 324 } |
| 330 | 325 |
| 331 /* Check whether MAP is one of MAPS parents. */ | 326 /* Check whether MAP is one of MAPS parents. */ |
| 341 /* Set the parent keymap of MAP to PARENT. */ | 336 /* Set the parent keymap of MAP to PARENT. */ |
| 342 | 337 |
| 343 DEFUN ("set-keymap-parent", Fset_keymap_parent, Sset_keymap_parent, 2, 2, 0, | 338 DEFUN ("set-keymap-parent", Fset_keymap_parent, Sset_keymap_parent, 2, 2, 0, |
| 344 doc: /* Modify KEYMAP to set its parent map to PARENT. | 339 doc: /* Modify KEYMAP to set its parent map to PARENT. |
| 345 Return PARENT. PARENT should be nil or another keymap. */) | 340 Return PARENT. PARENT should be nil or another keymap. */) |
| 346 (keymap, parent) | 341 (Lisp_Object keymap, Lisp_Object parent) |
| 347 Lisp_Object keymap, parent; | |
| 348 { | 342 { |
| 349 Lisp_Object list, prev; | 343 Lisp_Object list, prev; |
| 350 struct gcpro gcpro1, gcpro2; | 344 struct gcpro gcpro1, gcpro2; |
| 351 int i; | 345 int i; |
| 352 | 346 |
| 727 DEFUN ("map-keymap-internal", Fmap_keymap_internal, Smap_keymap_internal, 2, 2, 0, | 721 DEFUN ("map-keymap-internal", Fmap_keymap_internal, Smap_keymap_internal, 2, 2, 0, |
| 728 doc: /* Call FUNCTION once for each event binding in KEYMAP. | 722 doc: /* Call FUNCTION once for each event binding in KEYMAP. |
| 729 FUNCTION is called with two arguments: the event that is bound, and | 723 FUNCTION is called with two arguments: the event that is bound, and |
| 730 the definition it is bound to. The event may be a character range. | 724 the definition it is bound to. The event may be a character range. |
| 731 If KEYMAP has a parent, this function returns it without processing it. */) | 725 If KEYMAP has a parent, this function returns it without processing it. */) |
| 732 (function, keymap) | 726 (Lisp_Object function, Lisp_Object keymap) |
| 733 Lisp_Object function, keymap; | |
| 734 { | 727 { |
| 735 struct gcpro gcpro1; | 728 struct gcpro gcpro1; |
| 736 GCPRO1 (function); | 729 GCPRO1 (function); |
| 737 keymap = get_keymap (keymap, 1, 1); | 730 keymap = get_keymap (keymap, 1, 1); |
| 738 keymap = map_keymap_internal (keymap, map_keymap_call, function, NULL); | 731 keymap = map_keymap_internal (keymap, map_keymap_call, function, NULL); |
| 747 | 740 |
| 748 If KEYMAP has a parent, the parent's bindings are included as well. | 741 If KEYMAP has a parent, the parent's bindings are included as well. |
| 749 This works recursively: if the parent has itself a parent, then the | 742 This works recursively: if the parent has itself a parent, then the |
| 750 grandparent's bindings are also included and so on. | 743 grandparent's bindings are also included and so on. |
| 751 usage: (map-keymap FUNCTION KEYMAP) */) | 744 usage: (map-keymap FUNCTION KEYMAP) */) |
| 752 (function, keymap, sort_first) | 745 (Lisp_Object function, Lisp_Object keymap, Lisp_Object sort_first) |
| 753 Lisp_Object function, keymap, sort_first; | |
| 754 { | 746 { |
| 755 if (! NILP (sort_first)) | 747 if (! NILP (sort_first)) |
| 756 return call2 (intern ("map-keymap-sorted"), function, keymap); | 748 return call2 (intern ("map-keymap-sorted"), function, keymap); |
| 757 | 749 |
| 758 map_keymap (keymap, map_keymap_call, function, NULL, 1); | 750 map_keymap (keymap, map_keymap_call, function, NULL, 1); |
| 1092 The copy starts out with the same definitions of KEYMAP, | 1084 The copy starts out with the same definitions of KEYMAP, |
| 1093 but changing either the copy or KEYMAP does not affect the other. | 1085 but changing either the copy or KEYMAP does not affect the other. |
| 1094 Any key definitions that are subkeymaps are recursively copied. | 1086 Any key definitions that are subkeymaps are recursively copied. |
| 1095 However, a key definition which is a symbol whose definition is a keymap | 1087 However, a key definition which is a symbol whose definition is a keymap |
| 1096 is not copied. */) | 1088 is not copied. */) |
| 1097 (keymap) | 1089 (Lisp_Object keymap) |
| 1098 Lisp_Object keymap; | |
| 1099 { | 1090 { |
| 1100 register Lisp_Object copy, tail; | 1091 register Lisp_Object copy, tail; |
| 1101 keymap = get_keymap (keymap, 1, 0); | 1092 keymap = get_keymap (keymap, 1, 0); |
| 1102 copy = tail = Fcons (Qkeymap, Qnil); | 1093 copy = tail = Fcons (Qkeymap, Qnil); |
| 1103 keymap = XCDR (keymap); /* Skip the `keymap' symbol. */ | 1094 keymap = XCDR (keymap); /* Skip the `keymap' symbol. */ |
| 1156 (See info node `(elisp)Extended Menu Items'.) | 1147 (See info node `(elisp)Extended Menu Items'.) |
| 1157 | 1148 |
| 1158 If KEYMAP is a sparse keymap with a binding for KEY, the existing | 1149 If KEYMAP is a sparse keymap with a binding for KEY, the existing |
| 1159 binding is altered. If there is no binding for KEY, the new pair | 1150 binding is altered. If there is no binding for KEY, the new pair |
| 1160 binding KEY to DEF is added at the front of KEYMAP. */) | 1151 binding KEY to DEF is added at the front of KEYMAP. */) |
| 1161 (keymap, key, def) | 1152 (Lisp_Object keymap, Lisp_Object key, Lisp_Object def) |
| 1162 Lisp_Object keymap; | |
| 1163 Lisp_Object key; | |
| 1164 Lisp_Object def; | |
| 1165 { | 1153 { |
| 1166 register int idx; | 1154 register int idx; |
| 1167 register Lisp_Object c; | 1155 register Lisp_Object c; |
| 1168 register Lisp_Object cmd; | 1156 register Lisp_Object cmd; |
| 1169 int metized = 0; | 1157 int metized = 0; |
| 1275 ignored if POSITION is non-nil. | 1263 ignored if POSITION is non-nil. |
| 1276 | 1264 |
| 1277 If the optional argument KEYMAPS is non-nil, it should be a list of | 1265 If the optional argument KEYMAPS is non-nil, it should be a list of |
| 1278 keymaps to search for command remapping. Otherwise, search for the | 1266 keymaps to search for command remapping. Otherwise, search for the |
| 1279 remapping in all currently active keymaps. */) | 1267 remapping in all currently active keymaps. */) |
| 1280 (command, position, keymaps) | 1268 (Lisp_Object command, Lisp_Object position, Lisp_Object keymaps) |
| 1281 Lisp_Object command, position, keymaps; | |
| 1282 { | 1269 { |
| 1283 if (!SYMBOLP (command)) | 1270 if (!SYMBOLP (command)) |
| 1284 return Qnil; | 1271 return Qnil; |
| 1285 | 1272 |
| 1286 ASET (command_remapping_vector, 1, command); | 1273 ASET (command_remapping_vector, 1, command); |
| 1318 Normally, `lookup-key' ignores bindings for t, which act as default | 1305 Normally, `lookup-key' ignores bindings for t, which act as default |
| 1319 bindings, used when nothing else in the keymap applies; this makes it | 1306 bindings, used when nothing else in the keymap applies; this makes it |
| 1320 usable as a general function for probing keymaps. However, if the | 1307 usable as a general function for probing keymaps. However, if the |
| 1321 third optional argument ACCEPT-DEFAULT is non-nil, `lookup-key' will | 1308 third optional argument ACCEPT-DEFAULT is non-nil, `lookup-key' will |
| 1322 recognize the default bindings, just as `read-key-sequence' does. */) | 1309 recognize the default bindings, just as `read-key-sequence' does. */) |
| 1323 (keymap, key, accept_default) | 1310 (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default) |
| 1324 Lisp_Object keymap; | |
| 1325 Lisp_Object key; | |
| 1326 Lisp_Object accept_default; | |
| 1327 { | 1311 { |
| 1328 register int idx; | 1312 register int idx; |
| 1329 register Lisp_Object cmd; | 1313 register Lisp_Object cmd; |
| 1330 register Lisp_Object c; | 1314 register Lisp_Object c; |
| 1331 int length; | 1315 int length; |
| 1579 0, 2, 0, | 1563 0, 2, 0, |
| 1580 doc: /* Return a list of the currently active keymaps. | 1564 doc: /* Return a list of the currently active keymaps. |
| 1581 OLP if non-nil indicates that we should obey `overriding-local-map' and | 1565 OLP if non-nil indicates that we should obey `overriding-local-map' and |
| 1582 `overriding-terminal-local-map'. POSITION can specify a click position | 1566 `overriding-terminal-local-map'. POSITION can specify a click position |
| 1583 like in the respective argument of `key-binding'. */) | 1567 like in the respective argument of `key-binding'. */) |
| 1584 (olp, position) | 1568 (Lisp_Object olp, Lisp_Object position) |
| 1585 Lisp_Object olp, position; | |
| 1586 { | 1569 { |
| 1587 int count = SPECPDL_INDEX (); | 1570 int count = SPECPDL_INDEX (); |
| 1588 | 1571 |
| 1589 Lisp_Object keymaps; | 1572 Lisp_Object keymaps; |
| 1590 | 1573 |
| 1743 position as returned by `event-start' and `event-end', and the lookup | 1726 position as returned by `event-start' and `event-end', and the lookup |
| 1744 occurs in the keymaps associated with it instead of KEY. It can also | 1727 occurs in the keymaps associated with it instead of KEY. It can also |
| 1745 be a number or marker, in which case the keymap properties at the | 1728 be a number or marker, in which case the keymap properties at the |
| 1746 specified buffer position instead of point are used. | 1729 specified buffer position instead of point are used. |
| 1747 */) | 1730 */) |
| 1748 (key, accept_default, no_remap, position) | 1731 (Lisp_Object key, Lisp_Object accept_default, Lisp_Object no_remap, Lisp_Object position) |
| 1749 Lisp_Object key, accept_default, no_remap, position; | |
| 1750 { | 1732 { |
| 1751 Lisp_Object *maps, value; | 1733 Lisp_Object *maps, value; |
| 1752 int nmaps, i; | 1734 int nmaps, i; |
| 1753 struct gcpro gcpro1, gcpro2; | 1735 struct gcpro gcpro1, gcpro2; |
| 1754 int count = SPECPDL_INDEX (); | 1736 int count = SPECPDL_INDEX (); |
| 1934 KEYS is a string or vector, a sequence of keystrokes. | 1916 KEYS is a string or vector, a sequence of keystrokes. |
| 1935 The binding is probably a symbol with a function definition. | 1917 The binding is probably a symbol with a function definition. |
| 1936 | 1918 |
| 1937 If optional argument ACCEPT-DEFAULT is non-nil, recognize default | 1919 If optional argument ACCEPT-DEFAULT is non-nil, recognize default |
| 1938 bindings; see the description of `lookup-key' for more details about this. */) | 1920 bindings; see the description of `lookup-key' for more details about this. */) |
| 1939 (keys, accept_default) | 1921 (Lisp_Object keys, Lisp_Object accept_default) |
| 1940 Lisp_Object keys, accept_default; | |
| 1941 { | 1922 { |
| 1942 register Lisp_Object map; | 1923 register Lisp_Object map; |
| 1943 map = current_buffer->keymap; | 1924 map = current_buffer->keymap; |
| 1944 if (NILP (map)) | 1925 if (NILP (map)) |
| 1945 return Qnil; | 1926 return Qnil; |
| 1955 This function's return values are the same as those of `lookup-key' | 1936 This function's return values are the same as those of `lookup-key' |
| 1956 \(which see). | 1937 \(which see). |
| 1957 | 1938 |
| 1958 If optional argument ACCEPT-DEFAULT is non-nil, recognize default | 1939 If optional argument ACCEPT-DEFAULT is non-nil, recognize default |
| 1959 bindings; see the description of `lookup-key' for more details about this. */) | 1940 bindings; see the description of `lookup-key' for more details about this. */) |
| 1960 (keys, accept_default) | 1941 (Lisp_Object keys, Lisp_Object accept_default) |
| 1961 Lisp_Object keys, accept_default; | |
| 1962 { | 1942 { |
| 1963 return Flookup_key (current_global_map, keys, accept_default); | 1943 return Flookup_key (current_global_map, keys, accept_default); |
| 1964 } | 1944 } |
| 1965 | 1945 |
| 1966 /* GC is possible in this function if it autoloads a keymap. */ | 1946 /* GC is possible in this function if it autoloads a keymap. */ |
| 1975 be ignored. Similarly, the list doesn't include non-prefix bindings | 1955 be ignored. Similarly, the list doesn't include non-prefix bindings |
| 1976 that come after prefix bindings. | 1956 that come after prefix bindings. |
| 1977 | 1957 |
| 1978 If optional argument ACCEPT-DEFAULT is non-nil, recognize default | 1958 If optional argument ACCEPT-DEFAULT is non-nil, recognize default |
| 1979 bindings; see the description of `lookup-key' for more details about this. */) | 1959 bindings; see the description of `lookup-key' for more details about this. */) |
| 1980 (key, accept_default) | 1960 (Lisp_Object key, Lisp_Object accept_default) |
| 1981 Lisp_Object key, accept_default; | |
| 1982 { | 1961 { |
| 1983 Lisp_Object *modes, *maps; | 1962 Lisp_Object *modes, *maps; |
| 1984 int nmaps; | 1963 int nmaps; |
| 1985 Lisp_Object binding; | 1964 Lisp_Object binding; |
| 1986 int i, j; | 1965 int i, j; |
| 2015 its value instead of as COMMAND's value; but COMMAND is still defined | 1994 its value instead of as COMMAND's value; but COMMAND is still defined |
| 2016 as a function. | 1995 as a function. |
| 2017 The third optional argument NAME, if given, supplies a menu name | 1996 The third optional argument NAME, if given, supplies a menu name |
| 2018 string for the map. This is required to use the keymap as a menu. | 1997 string for the map. This is required to use the keymap as a menu. |
| 2019 This function returns COMMAND. */) | 1998 This function returns COMMAND. */) |
| 2020 (command, mapvar, name) | 1999 (Lisp_Object command, Lisp_Object mapvar, Lisp_Object name) |
| 2021 Lisp_Object command, mapvar, name; | |
| 2022 { | 2000 { |
| 2023 Lisp_Object map; | 2001 Lisp_Object map; |
| 2024 map = Fmake_sparse_keymap (name); | 2002 map = Fmake_sparse_keymap (name); |
| 2025 Ffset (command, map); | 2003 Ffset (command, map); |
| 2026 if (!NILP (mapvar)) | 2004 if (!NILP (mapvar)) |
| 2030 return command; | 2008 return command; |
| 2031 } | 2009 } |
| 2032 | 2010 |
| 2033 DEFUN ("use-global-map", Fuse_global_map, Suse_global_map, 1, 1, 0, | 2011 DEFUN ("use-global-map", Fuse_global_map, Suse_global_map, 1, 1, 0, |
| 2034 doc: /* Select KEYMAP as the global keymap. */) | 2012 doc: /* Select KEYMAP as the global keymap. */) |
| 2035 (keymap) | 2013 (Lisp_Object keymap) |
| 2036 Lisp_Object keymap; | |
| 2037 { | 2014 { |
| 2038 keymap = get_keymap (keymap, 1, 1); | 2015 keymap = get_keymap (keymap, 1, 1); |
| 2039 current_global_map = keymap; | 2016 current_global_map = keymap; |
| 2040 | 2017 |
| 2041 return Qnil; | 2018 return Qnil; |
| 2042 } | 2019 } |
| 2043 | 2020 |
| 2044 DEFUN ("use-local-map", Fuse_local_map, Suse_local_map, 1, 1, 0, | 2021 DEFUN ("use-local-map", Fuse_local_map, Suse_local_map, 1, 1, 0, |
| 2045 doc: /* Select KEYMAP as the local keymap. | 2022 doc: /* Select KEYMAP as the local keymap. |
| 2046 If KEYMAP is nil, that means no local keymap. */) | 2023 If KEYMAP is nil, that means no local keymap. */) |
| 2047 (keymap) | 2024 (Lisp_Object keymap) |
| 2048 Lisp_Object keymap; | |
| 2049 { | 2025 { |
| 2050 if (!NILP (keymap)) | 2026 if (!NILP (keymap)) |
| 2051 keymap = get_keymap (keymap, 1, 1); | 2027 keymap = get_keymap (keymap, 1, 1); |
| 2052 | 2028 |
| 2053 current_buffer->keymap = keymap; | 2029 current_buffer->keymap = keymap; |
| 2056 } | 2032 } |
| 2057 | 2033 |
| 2058 DEFUN ("current-local-map", Fcurrent_local_map, Scurrent_local_map, 0, 0, 0, | 2034 DEFUN ("current-local-map", Fcurrent_local_map, Scurrent_local_map, 0, 0, 0, |
| 2059 doc: /* Return current buffer's local keymap, or nil if it has none. | 2035 doc: /* Return current buffer's local keymap, or nil if it has none. |
| 2060 Normally the local keymap is set by the major mode with `use-local-map'. */) | 2036 Normally the local keymap is set by the major mode with `use-local-map'. */) |
| 2061 () | 2037 (void) |
| 2062 { | 2038 { |
| 2063 return current_buffer->keymap; | 2039 return current_buffer->keymap; |
| 2064 } | 2040 } |
| 2065 | 2041 |
| 2066 DEFUN ("current-global-map", Fcurrent_global_map, Scurrent_global_map, 0, 0, 0, | 2042 DEFUN ("current-global-map", Fcurrent_global_map, Scurrent_global_map, 0, 0, 0, |
| 2067 doc: /* Return the current global keymap. */) | 2043 doc: /* Return the current global keymap. */) |
| 2068 () | 2044 (void) |
| 2069 { | 2045 { |
| 2070 return current_global_map; | 2046 return current_global_map; |
| 2071 } | 2047 } |
| 2072 | 2048 |
| 2073 DEFUN ("current-minor-mode-maps", Fcurrent_minor_mode_maps, Scurrent_minor_mode_maps, 0, 0, 0, | 2049 DEFUN ("current-minor-mode-maps", Fcurrent_minor_mode_maps, Scurrent_minor_mode_maps, 0, 0, 0, |
| 2074 doc: /* Return a list of keymaps for the minor modes of the current buffer. */) | 2050 doc: /* Return a list of keymaps for the minor modes of the current buffer. */) |
| 2075 () | 2051 (void) |
| 2076 { | 2052 { |
| 2077 Lisp_Object *maps; | 2053 Lisp_Object *maps; |
| 2078 int nmaps = current_minor_maps (0, &maps); | 2054 int nmaps = current_minor_maps (0, &maps); |
| 2079 | 2055 |
| 2080 return Flist (nmaps, maps); | 2056 return Flist (nmaps, maps); |
| 2158 Returns a list of elements of the form (KEYS . MAP), where the sequence | 2134 Returns a list of elements of the form (KEYS . MAP), where the sequence |
| 2159 KEYS starting from KEYMAP gets you to MAP. These elements are ordered | 2135 KEYS starting from KEYMAP gets you to MAP. These elements are ordered |
| 2160 so that the KEYS increase in length. The first element is ([] . KEYMAP). | 2136 so that the KEYS increase in length. The first element is ([] . KEYMAP). |
| 2161 An optional argument PREFIX, if non-nil, should be a key sequence; | 2137 An optional argument PREFIX, if non-nil, should be a key sequence; |
| 2162 then the value includes only maps for prefixes that start with PREFIX. */) | 2138 then the value includes only maps for prefixes that start with PREFIX. */) |
| 2163 (keymap, prefix) | 2139 (Lisp_Object keymap, Lisp_Object prefix) |
| 2164 Lisp_Object keymap, prefix; | |
| 2165 { | 2140 { |
| 2166 Lisp_Object maps, tail; | 2141 Lisp_Object maps, tail; |
| 2167 int prefixlen = XINT (Flength (prefix)); | 2142 int prefixlen = XINT (Flength (prefix)); |
| 2168 | 2143 |
| 2169 /* no need for gcpro because we don't autoload any keymaps. */ | 2144 /* no need for gcpro because we don't autoload any keymaps. */ |
| 2247 DEFUN ("key-description", Fkey_description, Skey_description, 1, 2, 0, | 2222 DEFUN ("key-description", Fkey_description, Skey_description, 1, 2, 0, |
| 2248 doc: /* Return a pretty description of key-sequence KEYS. | 2223 doc: /* Return a pretty description of key-sequence KEYS. |
| 2249 Optional arg PREFIX is the sequence of keys leading up to KEYS. | 2224 Optional arg PREFIX is the sequence of keys leading up to KEYS. |
| 2250 Control characters turn into "C-foo" sequences, meta into "M-foo", | 2225 Control characters turn into "C-foo" sequences, meta into "M-foo", |
| 2251 spaces are put between sequence elements, etc. */) | 2226 spaces are put between sequence elements, etc. */) |
| 2252 (keys, prefix) | 2227 (Lisp_Object keys, Lisp_Object prefix) |
| 2253 Lisp_Object keys, prefix; | |
| 2254 { | 2228 { |
| 2255 int len = 0; | 2229 int len = 0; |
| 2256 int i, i_byte; | 2230 int i, i_byte; |
| 2257 Lisp_Object *args; | 2231 Lisp_Object *args; |
| 2258 int size = XINT (Flength (keys)); | 2232 int size = XINT (Flength (keys)); |
| 2468 Ssingle_key_description, 1, 2, 0, | 2442 Ssingle_key_description, 1, 2, 0, |
| 2469 doc: /* Return a pretty description of command character KEY. | 2443 doc: /* Return a pretty description of command character KEY. |
| 2470 Control characters turn into C-whatever, etc. | 2444 Control characters turn into C-whatever, etc. |
| 2471 Optional argument NO-ANGLES non-nil means don't put angle brackets | 2445 Optional argument NO-ANGLES non-nil means don't put angle brackets |
| 2472 around function keys and event symbols. */) | 2446 around function keys and event symbols. */) |
| 2473 (key, no_angles) | 2447 (Lisp_Object key, Lisp_Object no_angles) |
| 2474 Lisp_Object key, no_angles; | |
| 2475 { | 2448 { |
| 2476 if (CONSP (key) && lucid_event_type_list_p (key)) | 2449 if (CONSP (key) && lucid_event_type_list_p (key)) |
| 2477 key = Fevent_convert_list (key); | 2450 key = Fevent_convert_list (key); |
| 2478 | 2451 |
| 2479 key = EVENT_HEAD (key); | 2452 key = EVENT_HEAD (key); |
| 2535 Control characters turn into "^char", etc. This differs from | 2508 Control characters turn into "^char", etc. This differs from |
| 2536 `single-key-description' which turns them into "C-char". | 2509 `single-key-description' which turns them into "C-char". |
| 2537 Also, this function recognizes the 2**7 bit as the Meta character, | 2510 Also, this function recognizes the 2**7 bit as the Meta character, |
| 2538 whereas `single-key-description' uses the 2**27 bit for Meta. | 2511 whereas `single-key-description' uses the 2**27 bit for Meta. |
| 2539 See Info node `(elisp)Describing Characters' for examples. */) | 2512 See Info node `(elisp)Describing Characters' for examples. */) |
| 2540 (character) | 2513 (Lisp_Object character) |
| 2541 Lisp_Object character; | |
| 2542 { | 2514 { |
| 2543 /* Currently MAX_MULTIBYTE_LENGTH is 4 (< 6). */ | 2515 /* Currently MAX_MULTIBYTE_LENGTH is 4 (< 6). */ |
| 2544 unsigned char str[6]; | 2516 unsigned char str[6]; |
| 2545 int c; | 2517 int c; |
| 2546 | 2518 |
| 2765 indirect definition itself. | 2737 indirect definition itself. |
| 2766 | 2738 |
| 2767 If optional 5th arg NO-REMAP is non-nil, don't search for key sequences | 2739 If optional 5th arg NO-REMAP is non-nil, don't search for key sequences |
| 2768 that invoke a command which is remapped to DEFINITION, but include the | 2740 that invoke a command which is remapped to DEFINITION, but include the |
| 2769 remapped command in the returned list. */) | 2741 remapped command in the returned list. */) |
| 2770 (definition, keymap, firstonly, noindirect, no_remap) | 2742 (Lisp_Object definition, Lisp_Object keymap, Lisp_Object firstonly, Lisp_Object noindirect, Lisp_Object no_remap) |
| 2771 Lisp_Object definition, keymap; | |
| 2772 Lisp_Object firstonly, noindirect, no_remap; | |
| 2773 { | 2743 { |
| 2774 /* The keymaps in which to search. */ | 2744 /* The keymaps in which to search. */ |
| 2775 Lisp_Object keymaps; | 2745 Lisp_Object keymaps; |
| 2776 /* Potentially relevant bindings in "shortest to longest" order. */ | 2746 /* Potentially relevant bindings in "shortest to longest" order. */ |
| 2777 Lisp_Object sequences = Qnil; | 2747 Lisp_Object sequences = Qnil; |
| 2988 looked up in BUFFER. | 2958 looked up in BUFFER. |
| 2989 The optional argument PREFIX, if non-nil, should be a key sequence; | 2959 The optional argument PREFIX, if non-nil, should be a key sequence; |
| 2990 then we display only bindings that start with that prefix. | 2960 then we display only bindings that start with that prefix. |
| 2991 The optional argument MENUS, if non-nil, says to mention menu bindings. | 2961 The optional argument MENUS, if non-nil, says to mention menu bindings. |
| 2992 \(Ordinarily these are omitted from the output.) */) | 2962 \(Ordinarily these are omitted from the output.) */) |
| 2993 (buffer, prefix, menus) | 2963 (Lisp_Object buffer, Lisp_Object prefix, Lisp_Object menus) |
| 2994 Lisp_Object buffer, prefix, menus; | |
| 2995 { | 2964 { |
| 2996 Lisp_Object outbuf, shadow; | 2965 Lisp_Object outbuf, shadow; |
| 2997 int nomenu = NILP (menus); | 2966 int nomenu = NILP (menus); |
| 2998 register Lisp_Object start1; | 2967 register Lisp_Object start1; |
| 2999 struct gcpro gcpro1; | 2968 struct gcpro gcpro1; |
| 3581 | 3550 |
| 3582 DEFUN ("describe-vector", Fdescribe_vector, Sdescribe_vector, 1, 2, 0, | 3551 DEFUN ("describe-vector", Fdescribe_vector, Sdescribe_vector, 1, 2, 0, |
| 3583 doc: /* Insert a description of contents of VECTOR. | 3552 doc: /* Insert a description of contents of VECTOR. |
| 3584 This is text showing the elements of vector matched against indices. | 3553 This is text showing the elements of vector matched against indices. |
| 3585 DESCRIBER is the output function used; nil means use `princ'. */) | 3554 DESCRIBER is the output function used; nil means use `princ'. */) |
| 3586 (vector, describer) | 3555 (Lisp_Object vector, Lisp_Object describer) |
| 3587 Lisp_Object vector, describer; | |
| 3588 { | 3556 { |
| 3589 int count = SPECPDL_INDEX (); | 3557 int count = SPECPDL_INDEX (); |
| 3590 if (NILP (describer)) | 3558 if (NILP (describer)) |
| 3591 describer = intern ("princ"); | 3559 describer = intern ("princ"); |
| 3592 specbind (Qstandard_output, Fcurrent_buffer ()); | 3560 specbind (Qstandard_output, Fcurrent_buffer ()); |
| 3854 DEFUN ("apropos-internal", Fapropos_internal, Sapropos_internal, 1, 2, 0, | 3822 DEFUN ("apropos-internal", Fapropos_internal, Sapropos_internal, 1, 2, 0, |
| 3855 doc: /* Show all symbols whose names contain match for REGEXP. | 3823 doc: /* Show all symbols whose names contain match for REGEXP. |
| 3856 If optional 2nd arg PREDICATE is non-nil, (funcall PREDICATE SYMBOL) is done | 3824 If optional 2nd arg PREDICATE is non-nil, (funcall PREDICATE SYMBOL) is done |
| 3857 for each symbol and a symbol is mentioned only if that returns non-nil. | 3825 for each symbol and a symbol is mentioned only if that returns non-nil. |
| 3858 Return list of symbols found. */) | 3826 Return list of symbols found. */) |
| 3859 (regexp, predicate) | 3827 (Lisp_Object regexp, Lisp_Object predicate) |
| 3860 Lisp_Object regexp, predicate; | |
| 3861 { | 3828 { |
| 3862 Lisp_Object tem; | 3829 Lisp_Object tem; |
| 3863 CHECK_STRING (regexp); | 3830 CHECK_STRING (regexp); |
| 3864 apropos_predicate = predicate; | 3831 apropos_predicate = predicate; |
| 3865 apropos_accumulate = Qnil; | 3832 apropos_accumulate = Qnil; |
