aboutsummaryrefslogtreecommitdiffstats
path: root/src/keymap.c
diff options
context:
space:
mode:
authorJim Blandy1992-09-13 12:33:23 +0000
committerJim Blandy1992-09-13 12:33:23 +0000
commit4726a9f1c0426008140ce2b43381fcc55da7cd33 (patch)
tree7b2a74a418707a5a4d609521f4e4a9df64d5a277 /src/keymap.c
parent2ce30ea2e6243413a878468d2ec81fdf371a30c6 (diff)
downloademacs-4726a9f1c0426008140ce2b43381fcc55da7cd33.tar.gz
emacs-4726a9f1c0426008140ce2b43381fcc55da7cd33.zip
* keymap.c (describe_buffer_bindings): Adjust key_heading to match
the format used by describe_map_tree. Also, don't reprint the "key binding" header above the global bindings if we've already printed it for the local bindings; it's clear enough that the columns mean the same thing as above. * keymap.c (describe_buffer_bindings): Declare buf and bufend... * keymap.c (describe_buffer_bindings): Set the current buffer to descbuf before calling current_minor_maps; that function's value depends on the values of buffer-local variables. Don't set the current buffer to Vstandard_output until afterwards. * keymap.c (describe_buffer_bindings): If Vkeyboard_translate_table is in effect, describe its effects.
Diffstat (limited to 'src/keymap.c')
-rw-r--r--src/keymap.c54
1 files changed, 49 insertions, 5 deletions
diff --git a/src/keymap.c b/src/keymap.c
index 954f816b689..e5439c435a0 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1379,16 +1379,59 @@ describe_buffer_bindings (descbuf)
1379{ 1379{
1380 register Lisp_Object start1, start2; 1380 register Lisp_Object start1, start2;
1381 1381
1382 char *heading 1382 char *key_heading
1383 = "key binding\n--- -------\n"; 1383 = "\
1384key binding\n\
1385--- -------\n";
1386 char *alternate_heading
1387 = "\
1388Alternate Characters (use anywhere the nominal character is listed):\n\
1389nominal alternate\n\
1390------- ---------\n";
1384 1391
1385 Fset_buffer (Vstandard_output); 1392 Fset_buffer (Vstandard_output);
1386 1393
1394 /* Report on alternates for keys. */
1395 if (XTYPE (Vkeyboard_translate_table) == Lisp_String)
1396 {
1397 int c;
1398 unsigned char *translate = XSTRING (Vkeyboard_translate_table)->data;
1399 int translate_len = XSTRING (Vkeyboard_translate_table)->size;
1400
1401 for (c = 0; c < translate_len; c++)
1402 if (translate[c] != c)
1403 {
1404 char buf[20];
1405 char *bufend;
1406
1407 if (alternate_heading)
1408 {
1409 insert_string (alternate_heading);
1410 alternate_heading = 0;
1411 }
1412
1413 bufend = push_key_description (translate[c], buf);
1414 insert (buf, bufend - buf);
1415 Findent_to (make_number (16), make_number (1));
1416 bufend = push_key_description (c, buf);
1417 insert (buf, bufend - buf);
1418
1419 insert ("\n", 1);
1420 }
1421
1422 insert ("\n", 1);
1423 }
1424
1387 { 1425 {
1388 int i, nmaps; 1426 int i, nmaps;
1389 Lisp_Object *modes, *maps; 1427 Lisp_Object *modes, *maps;
1390 1428
1429 /* Temporarily switch to descbuf, so that we can get that buffer's
1430 minor modes correctly. */
1431 Fset_buffer (descbuf);
1391 nmaps = current_minor_maps (&modes, &maps); 1432 nmaps = current_minor_maps (&modes, &maps);
1433 Fset_buffer (Vstandard_output);
1434
1392 for (i = 0; i < nmaps; i++) 1435 for (i = 0; i < nmaps; i++)
1393 { 1436 {
1394 if (XTYPE (modes[i]) == Lisp_Symbol) 1437 if (XTYPE (modes[i]) == Lisp_Symbol)
@@ -1400,7 +1443,7 @@ describe_buffer_bindings (descbuf)
1400 else 1443 else
1401 insert_string ("Strangely Named"); 1444 insert_string ("Strangely Named");
1402 insert_string (" Minor Mode Bindings:\n"); 1445 insert_string (" Minor Mode Bindings:\n");
1403 insert_string (heading); 1446 insert_string (key_heading);
1404 describe_map_tree (maps[i], 0, Qnil); 1447 describe_map_tree (maps[i], 0, Qnil);
1405 insert_char ('\n'); 1448 insert_char ('\n');
1406 } 1449 }
@@ -1410,13 +1453,14 @@ describe_buffer_bindings (descbuf)
1410 if (!NILP (start1)) 1453 if (!NILP (start1))
1411 { 1454 {
1412 insert_string ("Local Bindings:\n"); 1455 insert_string ("Local Bindings:\n");
1413 insert_string (heading); 1456 insert_string (key_heading);
1414 describe_map_tree (start1, 0, Qnil); 1457 describe_map_tree (start1, 0, Qnil);
1415 insert_string ("\n"); 1458 insert_string ("\n");
1416 } 1459 }
1417 1460
1418 insert_string ("Global Bindings:\n"); 1461 insert_string ("Global Bindings:\n");
1419 insert_string (heading); 1462 if (NILP (start1))
1463 insert_string (key_heading);
1420 1464
1421 describe_map_tree (current_global_map, 0, XBUFFER (descbuf)->keymap); 1465 describe_map_tree (current_global_map, 0, XBUFFER (descbuf)->keymap);
1422 1466