comparison src/keymap.c @ 20850:ffbaaba0bf76

(Fdescribe_bindings_internal): Renamed from Fdescribe_bindings. New arg NOMENU. (syms_of_keymap): Corresponding changes. (describe_buffer_bindings): Get NOMENU out of the arg list. Pass it along to describe_map_tree. Improve text of `alternate_heading'.
author Richard M. Stallman <rms@gnu.org>
date Thu, 05 Feb 1998 03:31:41 +0000
parents ed9ed828415e
children 4aeabf3b8f98
comparison
equal deleted inserted replaced
20849:3b2f72ed135c 20850:ffbaaba0bf76
2204 return sequence; 2204 return sequence;
2205 } 2205 }
2206 2206
2207 /* describe-bindings - summarizing all the bindings in a set of keymaps. */ 2207 /* describe-bindings - summarizing all the bindings in a set of keymaps. */
2208 2208
2209 DEFUN ("describe-bindings", Fdescribe_bindings, Sdescribe_bindings, 0, 1, "", 2209 DEFUN ("describe-bindings-internal", Fdescribe_bindings_internal, Sdescribe_bindings_internal, 0, 2, "",
2210 "Show a list of all defined keys, and their definitions.\n\ 2210 "Show a list of all defined keys, and their definitions.\n\
2211 The list is put in a buffer, which is displayed.\n\ 2211 We put that list in a buffer, and display the buffer.\n\
2212 An optional argument PREFIX, if non-nil, should be a key sequence;\n\ 2212 \n\
2213 The optional argument MENUS, if non-nil, says to mention menu bindings.\n\
2214 \(Ordinarily these are omitted from the output.)\n\
2215 The optional argument PREFIX, if non-nil, should be a key sequence;\n\
2213 then we display only bindings that start with that prefix.") 2216 then we display only bindings that start with that prefix.")
2214 (prefix) 2217 (menus, prefix)
2215 Lisp_Object prefix; 2218 Lisp_Object menus, prefix;
2216 { 2219 {
2217 register Lisp_Object thisbuf; 2220 register Lisp_Object thisbuf;
2218 XSETBUFFER (thisbuf, current_buffer); 2221 XSETBUFFER (thisbuf, current_buffer);
2219 internal_with_output_to_temp_buffer ("*Help*", 2222 internal_with_output_to_temp_buffer ("*Help*",
2220 describe_buffer_bindings, 2223 describe_buffer_bindings,
2221 Fcons (thisbuf, prefix)); 2224 list3 (thisbuf, prefix, menus));
2222 return Qnil; 2225 return Qnil;
2223 } 2226 }
2224 2227
2225 /* ARG is (BUFFER . PREFIX). */ 2228 /* ARG is (BUFFER PREFIX MENU-FLAG). */
2226 2229
2227 static Lisp_Object 2230 static Lisp_Object
2228 describe_buffer_bindings (arg) 2231 describe_buffer_bindings (arg)
2229 Lisp_Object arg; 2232 Lisp_Object arg;
2230 { 2233 {
2231 Lisp_Object descbuf, prefix, shadow; 2234 Lisp_Object descbuf, prefix, shadow;
2235 int nomenu;
2232 register Lisp_Object start1; 2236 register Lisp_Object start1;
2233 struct gcpro gcpro1; 2237 struct gcpro gcpro1;
2234 2238
2235 char *alternate_heading 2239 char *alternate_heading
2236 = "\ 2240 = "\
2237 Alternate Characters (use anywhere the nominal character is listed):\n\ 2241 Keyboard translations:\n\n\
2238 nominal alternate\n\ 2242 You type Translation\n\
2239 ------- ---------\n"; 2243 -------- -----------\n";
2240 2244
2241 descbuf = XCONS (arg)->car; 2245 descbuf = XCONS (arg)->car;
2242 prefix = XCONS (arg)->cdr; 2246 arg = XCONS (arg)->cdr;
2247 prefix = XCONS (arg)->car;
2248 arg = XCONS (arg)->cdr;
2249 nomenu = NILP (XCONS (arg)->car);
2250
2243 shadow = Qnil; 2251 shadow = Qnil;
2244 GCPRO1 (shadow); 2252 GCPRO1 (shadow);
2245 2253
2246 Fset_buffer (Vstandard_output); 2254 Fset_buffer (Vstandard_output);
2247 2255
2276 insert ("\n", 1); 2284 insert ("\n", 1);
2277 } 2285 }
2278 2286
2279 if (!NILP (Vkey_translation_map)) 2287 if (!NILP (Vkey_translation_map))
2280 describe_map_tree (Vkey_translation_map, 0, Qnil, prefix, 2288 describe_map_tree (Vkey_translation_map, 0, Qnil, prefix,
2281 "Key translations", 0, 1, 0); 2289 "Key translations", nomenu, 1, 0);
2282 2290
2283 { 2291 {
2284 int i, nmaps; 2292 int i, nmaps;
2285 Lisp_Object *modes, *maps; 2293 Lisp_Object *modes, *maps;
2286 2294
2315 *p++ = '\''; 2323 *p++ = '\'';
2316 bcopy (" Minor Mode Bindings", p, sizeof (" Minor Mode Bindings") - 1); 2324 bcopy (" Minor Mode Bindings", p, sizeof (" Minor Mode Bindings") - 1);
2317 p += sizeof (" Minor Mode Bindings") - 1; 2325 p += sizeof (" Minor Mode Bindings") - 1;
2318 *p = 0; 2326 *p = 0;
2319 2327
2320 describe_map_tree (maps[i], 1, shadow, prefix, title, 0, 0, 0); 2328 describe_map_tree (maps[i], 1, shadow, prefix, title, nomenu, 0, 0);
2321 shadow = Fcons (maps[i], shadow); 2329 shadow = Fcons (maps[i], shadow);
2322 } 2330 }
2323 } 2331 }
2324 2332
2325 /* Print the (major mode) local map. */ 2333 /* Print the (major mode) local map. */
2331 start1 = XBUFFER (descbuf)->keymap; 2339 start1 = XBUFFER (descbuf)->keymap;
2332 2340
2333 if (!NILP (start1)) 2341 if (!NILP (start1))
2334 { 2342 {
2335 describe_map_tree (start1, 1, shadow, prefix, 2343 describe_map_tree (start1, 1, shadow, prefix,
2336 "Major Mode Bindings", 0, 0, 0); 2344 "Major Mode Bindings", nomenu, 0, 0);
2337 shadow = Fcons (start1, shadow); 2345 shadow = Fcons (start1, shadow);
2338 } 2346 }
2339 2347
2340 describe_map_tree (current_global_map, 1, shadow, prefix, 2348 describe_map_tree (current_global_map, 1, shadow, prefix,
2341 "Global Bindings", 0, 0, 1); 2349 "Global Bindings", nomenu, 0, 1);
2342 2350
2343 /* Print the function-key-map translations under this prefix. */ 2351 /* Print the function-key-map translations under this prefix. */
2344 if (!NILP (Vfunction_key_map)) 2352 if (!NILP (Vfunction_key_map))
2345 describe_map_tree (Vfunction_key_map, 0, Qnil, prefix, 2353 describe_map_tree (Vfunction_key_map, 0, Qnil, prefix,
2346 "Function key map translations", 0, 1, 0); 2354 "Function key map translations", nomenu, 1, 0);
2347 2355
2348 call0 (intern ("help-mode")); 2356 call0 (intern ("help-mode"));
2349 Fset_buffer (descbuf); 2357 Fset_buffer (descbuf);
2350 UNGCPRO; 2358 UNGCPRO;
2351 return Qnil; 2359 return Qnil;
3211 defsubr (&Skey_description); 3219 defsubr (&Skey_description);
3212 defsubr (&Sdescribe_vector); 3220 defsubr (&Sdescribe_vector);
3213 defsubr (&Ssingle_key_description); 3221 defsubr (&Ssingle_key_description);
3214 defsubr (&Stext_char_description); 3222 defsubr (&Stext_char_description);
3215 defsubr (&Swhere_is_internal); 3223 defsubr (&Swhere_is_internal);
3216 defsubr (&Sdescribe_bindings); 3224 defsubr (&Sdescribe_bindings_internal);
3217 defsubr (&Sapropos_internal); 3225 defsubr (&Sapropos_internal);
3218 } 3226 }
3219 3227
3220 keys_of_keymap () 3228 keys_of_keymap ()
3221 { 3229 {