comparison src/keymap.c @ 40625:1248b61b7baf

(Fdescribe_buffer_bindings): Print character property bindings along with or instead of the buffer local map. Make the overriding maps override what they should.
author Richard M. Stallman <rms@gnu.org>
date Thu, 01 Nov 2001 19:55:42 +0000
parents a1bd6c5f0460
children cdfd4d09b79a
comparison
equal deleted inserted replaced
40624:eae4ef246746 40625:1248b61b7baf
2469 -------- -----------\n"; 2469 -------- -----------\n";
2470 2470
2471 shadow = Qnil; 2471 shadow = Qnil;
2472 GCPRO1 (shadow); 2472 GCPRO1 (shadow);
2473 2473
2474 outbuf = Fcurrent_buffer(); 2474 outbuf = Fcurrent_buffer ();
2475 2475
2476 /* Report on alternates for keys. */ 2476 /* Report on alternates for keys. */
2477 if (STRINGP (Vkeyboard_translate_table) && !NILP (prefix)) 2477 if (STRINGP (Vkeyboard_translate_table) && !NILP (prefix))
2478 { 2478 {
2479 int c; 2479 int c;
2506 2506
2507 if (!NILP (Vkey_translation_map)) 2507 if (!NILP (Vkey_translation_map))
2508 describe_map_tree (Vkey_translation_map, 0, Qnil, prefix, 2508 describe_map_tree (Vkey_translation_map, 0, Qnil, prefix,
2509 "Key translations", nomenu, 1, 0); 2509 "Key translations", nomenu, 1, 0);
2510 2510
2511 {
2512 int i, nmaps;
2513 Lisp_Object *modes, *maps;
2514
2515 /* Temporarily switch to `buffer', so that we can get that buffer's
2516 minor modes correctly. */
2517 Fset_buffer (buffer);
2518
2519 if (!NILP (current_kboard->Voverriding_terminal_local_map)
2520 || !NILP (Voverriding_local_map))
2521 nmaps = 0;
2522 else
2523 nmaps = current_minor_maps (&modes, &maps);
2524 Fset_buffer (outbuf);
2525
2526 /* Print the minor mode maps. */
2527 for (i = 0; i < nmaps; i++)
2528 {
2529 /* The title for a minor mode keymap
2530 is constructed at run time.
2531 We let describe_map_tree do the actual insertion
2532 because it takes care of other features when doing so. */
2533 char *title, *p;
2534
2535 if (!SYMBOLP (modes[i]))
2536 abort();
2537
2538 p = title = (char *) alloca (42 + XSYMBOL (modes[i])->name->size);
2539 *p++ = '\f';
2540 *p++ = '\n';
2541 *p++ = '`';
2542 bcopy (XSYMBOL (modes[i])->name->data, p,
2543 XSYMBOL (modes[i])->name->size);
2544 p += XSYMBOL (modes[i])->name->size;
2545 *p++ = '\'';
2546 bcopy (" Minor Mode Bindings", p, sizeof (" Minor Mode Bindings") - 1);
2547 p += sizeof (" Minor Mode Bindings") - 1;
2548 *p = 0;
2549
2550 describe_map_tree (maps[i], 1, shadow, prefix, title, nomenu, 0, 0);
2551 shadow = Fcons (maps[i], shadow);
2552 }
2553 }
2554 2511
2555 /* Print the (major mode) local map. */ 2512 /* Print the (major mode) local map. */
2513 start1 = Qnil;
2556 if (!NILP (current_kboard->Voverriding_terminal_local_map)) 2514 if (!NILP (current_kboard->Voverriding_terminal_local_map))
2557 start1 = current_kboard->Voverriding_terminal_local_map; 2515 start1 = current_kboard->Voverriding_terminal_local_map;
2558 else if (!NILP (Voverriding_local_map)) 2516 else if (!NILP (Voverriding_local_map))
2559 start1 = Voverriding_local_map; 2517 start1 = Voverriding_local_map;
2518
2519 if (!NILP (start1))
2520 {
2521 describe_map_tree (start1, 1, shadow, prefix,
2522 "\f\nOverriding Bindings", nomenu, 0, 0);
2523 shadow = Fcons (start1, shadow);
2524 }
2560 else 2525 else
2561 start1 = XBUFFER (buffer)->keymap; 2526 {
2562 2527 /* Print the minor mode and major mode keymaps. */
2563 if (!NILP (start1)) 2528 int i, nmaps;
2564 { 2529 Lisp_Object *modes, *maps;
2565 describe_map_tree (start1, 1, shadow, prefix, 2530
2566 "\f\nMajor Mode Bindings", nomenu, 0, 0); 2531 /* Temporarily switch to `buffer', so that we can get that buffer's
2567 shadow = Fcons (start1, shadow); 2532 minor modes correctly. */
2533 Fset_buffer (buffer);
2534
2535 nmaps = current_minor_maps (&modes, &maps);
2536 Fset_buffer (outbuf);
2537
2538 /* Print the minor mode maps. */
2539 for (i = 0; i < nmaps; i++)
2540 {
2541 /* The title for a minor mode keymap
2542 is constructed at run time.
2543 We let describe_map_tree do the actual insertion
2544 because it takes care of other features when doing so. */
2545 char *title, *p;
2546
2547 if (!SYMBOLP (modes[i]))
2548 abort();
2549
2550 p = title = (char *) alloca (42 + XSYMBOL (modes[i])->name->size);
2551 *p++ = '\f';
2552 *p++ = '\n';
2553 *p++ = '`';
2554 bcopy (XSYMBOL (modes[i])->name->data, p,
2555 XSYMBOL (modes[i])->name->size);
2556 p += XSYMBOL (modes[i])->name->size;
2557 *p++ = '\'';
2558 bcopy (" Minor Mode Bindings", p, sizeof (" Minor Mode Bindings") - 1);
2559 p += sizeof (" Minor Mode Bindings") - 1;
2560 *p = 0;
2561
2562 describe_map_tree (maps[i], 1, shadow, prefix, title, nomenu, 0, 0);
2563 shadow = Fcons (maps[i], shadow);
2564 }
2565
2566 start1 = get_local_map (BUF_PT (XBUFFER (buffer)),
2567 XBUFFER (buffer), Qkeymap);
2568 if (!NILP (start1))
2569 {
2570 describe_map_tree (start1, 1, shadow, prefix,
2571 "\f\nChar Property Bindings", nomenu, 0, 0);
2572 shadow = Fcons (start1, shadow);
2573 }
2574
2575 start1 = get_local_map (BUF_PT (XBUFFER (buffer)),
2576 XBUFFER (buffer), Qlocal_map);
2577 if (!NILP (start1))
2578 {
2579 if (EQ (start1, XBUFFER (buffer)->keymap))
2580 describe_map_tree (start1, 1, shadow, prefix,
2581 "\f\nMajor Mode Bindings", nomenu, 0, 0);
2582 else
2583 describe_map_tree (start1, 1, shadow, prefix,
2584 "\f\nChar Property Bindings", nomenu, 0, 0);
2585
2586 shadow = Fcons (start1, shadow);
2587 }
2568 } 2588 }
2569 2589
2570 describe_map_tree (current_global_map, 1, shadow, prefix, 2590 describe_map_tree (current_global_map, 1, shadow, prefix,
2571 "\f\nGlobal Bindings", nomenu, 0, 1); 2591 "\f\nGlobal Bindings", nomenu, 0, 1);
2572 2592