diff options
| author | Miles Bader | 2007-07-15 04:47:46 +0000 |
|---|---|---|
| committer | Miles Bader | 2007-07-15 04:47:46 +0000 |
| commit | 8c406a9bc42ee77fcbbb4201fe8bda855eafd832 (patch) | |
| tree | 14c8fa2e72341edd9db40b17079fd5208b1554c8 /src/keymap.c | |
| parent | 9bdeb5e9bedd773cc6845bc29a98e1e2a208f1ff (diff) | |
| parent | 6f8a87c027ebd6f9cfdac5c0df97d651227bec62 (diff) | |
| download | emacs-8c406a9bc42ee77fcbbb4201fe8bda855eafd832.tar.gz emacs-8c406a9bc42ee77fcbbb4201fe8bda855eafd832.zip | |
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 806-813)
- Merge from emacs--rel--22
- Update from CVS
* emacs--rel--22 (patch 51-58)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 233-236)
- Merge from emacs--devo--0
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-230
Diffstat (limited to 'src/keymap.c')
| -rw-r--r-- | src/keymap.c | 55 |
1 files changed, 30 insertions, 25 deletions
diff --git a/src/keymap.c b/src/keymap.c index 29898fe7a8e..413de76f7d5 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -1179,7 +1179,7 @@ binding KEY to DEF is added at the front of KEYMAP. */) | |||
| 1179 | if (SYMBOLP (def) && !EQ (Vdefine_key_rebound_commands, Qt)) | 1179 | if (SYMBOLP (def) && !EQ (Vdefine_key_rebound_commands, Qt)) |
| 1180 | Vdefine_key_rebound_commands = Fcons (def, Vdefine_key_rebound_commands); | 1180 | Vdefine_key_rebound_commands = Fcons (def, Vdefine_key_rebound_commands); |
| 1181 | 1181 | ||
| 1182 | meta_bit = (VECTORP (key) || STRINGP (key) && STRING_MULTIBYTE (key) | 1182 | meta_bit = (VECTORP (key) || (STRINGP (key) && STRING_MULTIBYTE (key)) |
| 1183 | ? meta_modifier : 0x80); | 1183 | ? meta_modifier : 0x80); |
| 1184 | 1184 | ||
| 1185 | if (VECTORP (def) && ASIZE (def) > 0 && CONSP (AREF (def, 0))) | 1185 | if (VECTORP (def) && ASIZE (def) > 0 && CONSP (AREF (def, 0))) |
| @@ -2079,12 +2079,23 @@ DEFUN ("current-minor-mode-maps", Fcurrent_minor_mode_maps, Scurrent_minor_mode_ | |||
| 2079 | 2079 | ||
| 2080 | /* Help functions for describing and documenting keymaps. */ | 2080 | /* Help functions for describing and documenting keymaps. */ |
| 2081 | 2081 | ||
| 2082 | struct accessible_keymaps_data { | ||
| 2083 | Lisp_Object maps, tail, thisseq; | ||
| 2084 | /* Does the current sequence end in the meta-prefix-char? */ | ||
| 2085 | int is_metized; | ||
| 2086 | }; | ||
| 2082 | 2087 | ||
| 2083 | static void | 2088 | static void |
| 2084 | accessible_keymaps_1 (key, cmd, maps, tail, thisseq, is_metized) | 2089 | accessible_keymaps_1 (key, cmd, args, data) |
| 2085 | Lisp_Object maps, tail, thisseq, key, cmd; | 2090 | Lisp_Object key, cmd, args; |
| 2086 | int is_metized; /* If 1, `key' is assumed to be INTEGERP. */ | 2091 | /* Use void* to be compatible with map_keymap_function_t. */ |
| 2092 | void *data; | ||
| 2087 | { | 2093 | { |
| 2094 | struct accessible_keymaps_data *d = data; /* Cast! */ | ||
| 2095 | Lisp_Object maps = d->maps; | ||
| 2096 | Lisp_Object tail = d->tail; | ||
| 2097 | Lisp_Object thisseq = d->thisseq; | ||
| 2098 | int is_metized = d->is_metized && INTEGERP (key); | ||
| 2088 | Lisp_Object tem; | 2099 | Lisp_Object tem; |
| 2089 | 2100 | ||
| 2090 | cmd = get_keymap (get_keyelt (cmd, 0), 0, 0); | 2101 | cmd = get_keymap (get_keyelt (cmd, 0), 0, 0); |
| @@ -2138,17 +2149,6 @@ accessible_keymaps_1 (key, cmd, maps, tail, thisseq, is_metized) | |||
| 2138 | } | 2149 | } |
| 2139 | } | 2150 | } |
| 2140 | 2151 | ||
| 2141 | static void | ||
| 2142 | accessible_keymaps_char_table (args, index, cmd) | ||
| 2143 | Lisp_Object args, index, cmd; | ||
| 2144 | { | ||
| 2145 | accessible_keymaps_1 (index, cmd, | ||
| 2146 | XCAR (XCAR (args)), | ||
| 2147 | XCAR (XCDR (args)), | ||
| 2148 | XCDR (XCDR (args)), | ||
| 2149 | XINT (XCDR (XCAR (args)))); | ||
| 2150 | } | ||
| 2151 | |||
| 2152 | /* This function cannot GC. */ | 2152 | /* This function cannot GC. */ |
| 2153 | 2153 | ||
| 2154 | DEFUN ("accessible-keymaps", Faccessible_keymaps, Saccessible_keymaps, | 2154 | DEFUN ("accessible-keymaps", Faccessible_keymaps, Saccessible_keymaps, |
| @@ -2163,14 +2163,11 @@ then the value includes only maps for prefixes that start with PREFIX. */) | |||
| 2163 | Lisp_Object keymap, prefix; | 2163 | Lisp_Object keymap, prefix; |
| 2164 | { | 2164 | { |
| 2165 | Lisp_Object maps, tail; | 2165 | Lisp_Object maps, tail; |
| 2166 | int prefixlen = 0; | 2166 | int prefixlen = XINT (Flength (prefix)); |
| 2167 | 2167 | ||
| 2168 | /* no need for gcpro because we don't autoload any keymaps. */ | 2168 | /* no need for gcpro because we don't autoload any keymaps. */ |
| 2169 | 2169 | ||
| 2170 | if (!NILP (prefix)) | 2170 | if (!NILP (prefix)) |
| 2171 | prefixlen = XINT (Flength (prefix)); | ||
| 2172 | |||
| 2173 | if (!NILP (prefix)) | ||
| 2174 | { | 2171 | { |
| 2175 | /* If a prefix was specified, start with the keymap (if any) for | 2172 | /* If a prefix was specified, start with the keymap (if any) for |
| 2176 | that prefix, so we don't waste time considering other prefixes. */ | 2173 | that prefix, so we don't waste time considering other prefixes. */ |
| @@ -2180,7 +2177,9 @@ then the value includes only maps for prefixes that start with PREFIX. */) | |||
| 2180 | if the prefix is not defined in this particular map. | 2177 | if the prefix is not defined in this particular map. |
| 2181 | It might even give us a list that isn't a keymap. */ | 2178 | It might even give us a list that isn't a keymap. */ |
| 2182 | tem = get_keymap (tem, 0, 0); | 2179 | tem = get_keymap (tem, 0, 0); |
| 2183 | if (CONSP (tem)) | 2180 | /* If the keymap is autoloaded `tem' is not a cons-cell, but we still |
| 2181 | want to return it. */ | ||
| 2182 | if (!NILP (tem)) | ||
| 2184 | { | 2183 | { |
| 2185 | /* Convert PREFIX to a vector now, so that later on | 2184 | /* Convert PREFIX to a vector now, so that later on |
| 2186 | we don't have to deal with the possibility of a string. */ | 2185 | we don't have to deal with the possibility of a string. */ |
| @@ -2620,8 +2619,8 @@ ascii_sequence_p (seq) | |||
| 2620 | /* where-is - finding a command in a set of keymaps. */ | 2619 | /* where-is - finding a command in a set of keymaps. */ |
| 2621 | 2620 | ||
| 2622 | static Lisp_Object where_is_internal (); | 2621 | static Lisp_Object where_is_internal (); |
| 2623 | static Lisp_Object where_is_internal_1 (); | 2622 | static void where_is_internal_1 P_ ((Lisp_Object key, Lisp_Object binding, |
| 2624 | static void where_is_internal_2 (); | 2623 | Lisp_Object args, void *data)); |
| 2625 | 2624 | ||
| 2626 | /* Like Flookup_key, but uses a list of keymaps SHADOW instead of a single map. | 2625 | /* Like Flookup_key, but uses a list of keymaps SHADOW instead of a single map. |
| 2627 | Returns the first non-nil binding found in any of those maps. */ | 2626 | Returns the first non-nil binding found in any of those maps. */ |
| @@ -2650,6 +2649,12 @@ shadow_lookup (shadow, key, flag) | |||
| 2650 | 2649 | ||
| 2651 | static Lisp_Object Vmouse_events; | 2650 | static Lisp_Object Vmouse_events; |
| 2652 | 2651 | ||
| 2652 | struct where_is_internal_data { | ||
| 2653 | Lisp_Object definition, noindirect, this, last; | ||
| 2654 | int last_is_meta; | ||
| 2655 | Lisp_Object sequences; | ||
| 2656 | }; | ||
| 2657 | |||
| 2653 | /* This function can GC if Flookup_key autoloads any keymaps. */ | 2658 | /* This function can GC if Flookup_key autoloads any keymaps. */ |
| 2654 | 2659 | ||
| 2655 | static Lisp_Object | 2660 | static Lisp_Object |
| @@ -2687,6 +2692,7 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap) | |||
| 2687 | { | 2692 | { |
| 2688 | /* Key sequence to reach map, and the map that it reaches */ | 2693 | /* Key sequence to reach map, and the map that it reaches */ |
| 2689 | register Lisp_Object this, map, tem; | 2694 | register Lisp_Object this, map, tem; |
| 2695 | struct where_is_internal_data data; | ||
| 2690 | 2696 | ||
| 2691 | /* In order to fold [META-PREFIX-CHAR CHAR] sequences into | 2697 | /* In order to fold [META-PREFIX-CHAR CHAR] sequences into |
| 2692 | [M-CHAR] sequences, check if last character of the sequence | 2698 | [M-CHAR] sequences, check if last character of the sequence |
| @@ -3059,7 +3065,7 @@ where_is_internal_1 (binding, key, definition, noindirect, this, last, | |||
| 3059 | || EQ (binding, definition) | 3065 | || EQ (binding, definition) |
| 3060 | || (CONSP (definition) && !NILP (Fequal (binding, definition))))) | 3066 | || (CONSP (definition) && !NILP (Fequal (binding, definition))))) |
| 3061 | /* Doesn't match. */ | 3067 | /* Doesn't match. */ |
| 3062 | return Qnil; | 3068 | return; |
| 3063 | 3069 | ||
| 3064 | /* We have found a match. Construct the key sequence where we found it. */ | 3070 | /* We have found a match. Construct the key sequence where we found it. */ |
| 3065 | if (INTEGERP (key) && last_is_meta) | 3071 | if (INTEGERP (key) && last_is_meta) |
| @@ -3074,10 +3080,9 @@ where_is_internal_1 (binding, key, definition, noindirect, this, last, | |||
| 3074 | { | 3080 | { |
| 3075 | Lisp_Object sequences = Fgethash (binding, where_is_cache, Qnil); | 3081 | Lisp_Object sequences = Fgethash (binding, where_is_cache, Qnil); |
| 3076 | Fputhash (binding, Fcons (sequence, sequences), where_is_cache); | 3082 | Fputhash (binding, Fcons (sequence, sequences), where_is_cache); |
| 3077 | return Qnil; | ||
| 3078 | } | 3083 | } |
| 3079 | else | 3084 | else |
| 3080 | return sequence; | 3085 | d->sequences = Fcons (sequence, d->sequences); |
| 3081 | } | 3086 | } |
| 3082 | 3087 | ||
| 3083 | /* describe-bindings - summarizing all the bindings in a set of keymaps. */ | 3088 | /* describe-bindings - summarizing all the bindings in a set of keymaps. */ |