aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman2001-11-01 19:55:42 +0000
committerRichard M. Stallman2001-11-01 19:55:42 +0000
commit36ca6189c6d3194ceff8d52d52796e42f670c1b1 (patch)
treea38e109002bd0d7623d6b6f3e99cc284b927b1ca /src
parentbca8616b096f226e987b5b72b781870a117de99b (diff)
downloademacs-36ca6189c6d3194ceff8d52d52796e42f670c1b1.tar.gz
emacs-36ca6189c6d3194ceff8d52d52796e42f670c1b1.zip
(Fdescribe_buffer_bindings): Print character property
bindings along with or instead of the buffer local map. Make the overriding maps override what they should.
Diffstat (limited to 'src')
-rw-r--r--src/keymap.c114
1 files changed, 67 insertions, 47 deletions
diff --git a/src/keymap.c b/src/keymap.c
index 256f40d4a73..802c1413c75 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -2471,7 +2471,7 @@ You type Translation\n\
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))
@@ -2508,64 +2508,84 @@ You type Translation\n\
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;
2560 else
2561 start1 = XBUFFER (buffer)->keymap;
2562 2518
2563 if (!NILP (start1)) 2519 if (!NILP (start1))
2564 { 2520 {
2565 describe_map_tree (start1, 1, shadow, prefix, 2521 describe_map_tree (start1, 1, shadow, prefix,
2566 "\f\nMajor Mode Bindings", nomenu, 0, 0); 2522 "\f\nOverriding Bindings", nomenu, 0, 0);
2567 shadow = Fcons (start1, shadow); 2523 shadow = Fcons (start1, shadow);
2568 } 2524 }
2525 else
2526 {
2527 /* Print the minor mode and major mode keymaps. */
2528 int i, nmaps;
2529 Lisp_Object *modes, *maps;
2530
2531 /* Temporarily switch to `buffer', so that we can get that buffer's
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 }
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);