diff options
| author | Karl Heuer | 1995-05-29 06:07:34 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-05-29 06:07:34 +0000 |
| commit | 32bfcae1d2e74a7f362091f8fcf0d5711d2145a3 (patch) | |
| tree | 8b44e5d578891cc3f0f103671ec128c6d0f59bdf /src | |
| parent | 5588734e1a87f2cf9ad3d146cd01ecfad74f8969 (diff) | |
| download | emacs-32bfcae1d2e74a7f362091f8fcf0d5711d2145a3.tar.gz emacs-32bfcae1d2e74a7f362091f8fcf0d5711d2145a3.zip | |
(describe_vector): New arg entire_map.
Don't show bindings shadowed earlier on in the same map.
(Fdescribe_vector, describe_map): Pass new arg.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keymap.c | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/src/keymap.c b/src/keymap.c index ca57dde121c..31e6c9c4d69 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -2108,7 +2108,7 @@ describe_map (map, keys, elt_describer, partial, shadow, seen) | |||
| 2108 | 2108 | ||
| 2109 | if (VECTORP (XCONS (tail)->car)) | 2109 | if (VECTORP (XCONS (tail)->car)) |
| 2110 | describe_vector (XCONS (tail)->car, | 2110 | describe_vector (XCONS (tail)->car, |
| 2111 | elt_prefix, elt_describer, partial, shadow); | 2111 | elt_prefix, elt_describer, partial, shadow, map); |
| 2112 | else if (CONSP (XCONS (tail)->car)) | 2112 | else if (CONSP (XCONS (tail)->car)) |
| 2113 | { | 2113 | { |
| 2114 | event = XCONS (XCONS (tail)->car)->car; | 2114 | event = XCONS (XCONS (tail)->car)->car; |
| @@ -2193,34 +2193,37 @@ This is text showing the elements of vector matched against indices.") | |||
| 2193 | 2193 | ||
| 2194 | specbind (Qstandard_output, Fcurrent_buffer ()); | 2194 | specbind (Qstandard_output, Fcurrent_buffer ()); |
| 2195 | CHECK_VECTOR (vector, 0); | 2195 | CHECK_VECTOR (vector, 0); |
| 2196 | describe_vector (vector, Qnil, describe_vector_princ, 0, Qnil); | 2196 | describe_vector (vector, Qnil, describe_vector_princ, 0, Qnil, Qnil); |
| 2197 | 2197 | ||
| 2198 | return unbind_to (count, Qnil); | 2198 | return unbind_to (count, Qnil); |
| 2199 | } | 2199 | } |
| 2200 | 2200 | ||
| 2201 | describe_vector (vector, elt_prefix, elt_describer, partial, shadow) | 2201 | describe_vector (vector, elt_prefix, elt_describer, |
| 2202 | partial, shadow, entire_map) | ||
| 2202 | register Lisp_Object vector; | 2203 | register Lisp_Object vector; |
| 2203 | Lisp_Object elt_prefix; | 2204 | Lisp_Object elt_prefix; |
| 2204 | int (*elt_describer) (); | 2205 | int (*elt_describer) (); |
| 2205 | int partial; | 2206 | int partial; |
| 2206 | Lisp_Object shadow; | 2207 | Lisp_Object shadow; |
| 2208 | Lisp_Object entire_map; | ||
| 2207 | { | 2209 | { |
| 2208 | Lisp_Object this; | 2210 | Lisp_Object this; |
| 2209 | Lisp_Object dummy; | 2211 | Lisp_Object dummy; |
| 2210 | Lisp_Object tem1, tem2; | 2212 | Lisp_Object definition; |
| 2213 | Lisp_Object tem2; | ||
| 2211 | register int i; | 2214 | register int i; |
| 2212 | Lisp_Object suppress; | 2215 | Lisp_Object suppress; |
| 2213 | Lisp_Object kludge; | 2216 | Lisp_Object kludge; |
| 2214 | int first = 1; | 2217 | int first = 1; |
| 2215 | struct gcpro gcpro1, gcpro2, gcpro3; | 2218 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 2216 | 2219 | ||
| 2217 | tem1 = Qnil; | 2220 | definition = Qnil; |
| 2218 | 2221 | ||
| 2219 | /* This vector gets used to present single keys to Flookup_key. Since | 2222 | /* This vector gets used to present single keys to Flookup_key. Since |
| 2220 | that is done once per vector element, we don't want to cons up a | 2223 | that is done once per vector element, we don't want to cons up a |
| 2221 | fresh vector every time. */ | 2224 | fresh vector every time. */ |
| 2222 | kludge = Fmake_vector (make_number (1), Qnil); | 2225 | kludge = Fmake_vector (make_number (1), Qnil); |
| 2223 | GCPRO3 (elt_prefix, tem1, kludge); | 2226 | GCPRO3 (elt_prefix, definition, kludge); |
| 2224 | 2227 | ||
| 2225 | if (partial) | 2228 | if (partial) |
| 2226 | suppress = intern ("suppress-keymap"); | 2229 | suppress = intern ("suppress-keymap"); |
| @@ -2228,20 +2231,19 @@ describe_vector (vector, elt_prefix, elt_describer, partial, shadow) | |||
| 2228 | for (i = 0; i < XVECTOR (vector)->size; i++) | 2231 | for (i = 0; i < XVECTOR (vector)->size; i++) |
| 2229 | { | 2232 | { |
| 2230 | QUIT; | 2233 | QUIT; |
| 2231 | tem1 = get_keyelt (XVECTOR (vector)->contents[i], 0); | 2234 | definition = get_keyelt (XVECTOR (vector)->contents[i], 0); |
| 2232 | 2235 | ||
| 2233 | if (NILP (tem1)) continue; | 2236 | if (NILP (definition)) continue; |
| 2234 | 2237 | ||
| 2235 | /* Don't mention suppressed commands. */ | 2238 | /* Don't mention suppressed commands. */ |
| 2236 | if (SYMBOLP (tem1) && partial) | 2239 | if (SYMBOLP (definition) && partial) |
| 2237 | { | 2240 | { |
| 2238 | this = Fget (tem1, suppress); | 2241 | this = Fget (definition, suppress); |
| 2239 | if (!NILP (this)) | 2242 | if (!NILP (this)) |
| 2240 | continue; | 2243 | continue; |
| 2241 | } | 2244 | } |
| 2242 | 2245 | ||
| 2243 | /* If this command in this map is shadowed by some other map, | 2246 | /* If this binding is shadowed by some other map, ignore it. */ |
| 2244 | ignore it. */ | ||
| 2245 | if (!NILP (shadow)) | 2247 | if (!NILP (shadow)) |
| 2246 | { | 2248 | { |
| 2247 | Lisp_Object tem; | 2249 | Lisp_Object tem; |
| @@ -2252,6 +2254,19 @@ describe_vector (vector, elt_prefix, elt_describer, partial, shadow) | |||
| 2252 | if (!NILP (tem)) continue; | 2254 | if (!NILP (tem)) continue; |
| 2253 | } | 2255 | } |
| 2254 | 2256 | ||
| 2257 | /* Ignore this definition if it is shadowed by an earlier | ||
| 2258 | one in the same keymap. */ | ||
| 2259 | if (!NILP (entire_map)) | ||
| 2260 | { | ||
| 2261 | Lisp_Object tem; | ||
| 2262 | |||
| 2263 | XVECTOR (kludge)->contents[0] = make_number (i); | ||
| 2264 | tem = Flookup_key (entire_map, kludge, Qt); | ||
| 2265 | |||
| 2266 | if (! EQ (tem, definition)) | ||
| 2267 | continue; | ||
| 2268 | } | ||
| 2269 | |||
| 2255 | if (first) | 2270 | if (first) |
| 2256 | { | 2271 | { |
| 2257 | insert ("\n", 1); | 2272 | insert ("\n", 1); |
| @@ -2272,7 +2287,7 @@ describe_vector (vector, elt_prefix, elt_describer, partial, shadow) | |||
| 2272 | /* Find all consecutive characters that have the same definition. */ | 2287 | /* Find all consecutive characters that have the same definition. */ |
| 2273 | while (i + 1 < XVECTOR (vector)->size | 2288 | while (i + 1 < XVECTOR (vector)->size |
| 2274 | && (tem2 = get_keyelt (XVECTOR (vector)->contents[i+1], 0), | 2289 | && (tem2 = get_keyelt (XVECTOR (vector)->contents[i+1], 0), |
| 2275 | EQ (tem2, tem1))) | 2290 | EQ (tem2, definition))) |
| 2276 | i++; | 2291 | i++; |
| 2277 | 2292 | ||
| 2278 | /* If we have a range of more than one character, | 2293 | /* If we have a range of more than one character, |
| @@ -2291,7 +2306,7 @@ describe_vector (vector, elt_prefix, elt_describer, partial, shadow) | |||
| 2291 | /* Print a description of the definition of this character. | 2306 | /* Print a description of the definition of this character. |
| 2292 | elt_describer will take care of spacing out far enough | 2307 | elt_describer will take care of spacing out far enough |
| 2293 | for alignment purposes. */ | 2308 | for alignment purposes. */ |
| 2294 | (*elt_describer) (tem1); | 2309 | (*elt_describer) (definition); |
| 2295 | } | 2310 | } |
| 2296 | 2311 | ||
| 2297 | UNGCPRO; | 2312 | UNGCPRO; |