comparison src/keymap.c @ 1120:0a486e1a45bc

* 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.
author Jim Blandy <jimb@redhat.com>
date Sun, 13 Sep 1992 12:33:23 +0000
parents 6578f07e9eb8
children f7b55bfe1c05
comparison
equal deleted inserted replaced
1119:5d315d54b8b4 1120:0a486e1a45bc
1377 describe_buffer_bindings (descbuf) 1377 describe_buffer_bindings (descbuf)
1378 Lisp_Object descbuf; 1378 Lisp_Object 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 = "\
1384 key binding\n\
1385 --- -------\n";
1386 char *alternate_heading
1387 = "\
1388 Alternate Characters (use anywhere the nominal character is listed):\n\
1389 nominal alternate\n\
1390 ------- ---------\n";
1384 1391
1385 Fset_buffer (Vstandard_output); 1392 Fset_buffer (Vstandard_output);
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 }
1386 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)
1395 { 1438 {
1396 insert_char ('`'); 1439 insert_char ('`');
1398 insert_char ('\''); 1441 insert_char ('\'');
1399 } 1442 }
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 }
1407 } 1450 }
1408 1451
1409 start1 = XBUFFER (descbuf)->keymap; 1452 start1 = XBUFFER (descbuf)->keymap;
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
1423 Fset_buffer (descbuf); 1467 Fset_buffer (descbuf);
1424 return Qnil; 1468 return Qnil;