comparison lisp/help.el @ 4335:4ba890988caa

Within #'describe-function, say what commands are bound to. 2007-12-18 Aidan Kehoe <kehoea@parhasard.net> * help.el (describe-function-1): Give details of bindings for commands, taking into account global-window-system-map and global-tty-map when bindings differ compared to the global map.
author Aidan Kehoe <kehoea@parhasard.net>
date Tue, 18 Dec 2007 21:28:12 +0100
parents 9fec7fedbf1b
children e7b3a3266356
comparison
equal deleted inserted replaced
4334:234b2c136e4d 4335:4ba890988caa
1482 (goto-char oldp standard-output) 1482 (goto-char oldp standard-output)
1483 (frob-help-extents standard-output) 1483 (frob-help-extents standard-output)
1484 (goto-char newp standard-output)) 1484 (goto-char newp standard-output))
1485 (unless (or (equal doc "") 1485 (unless (or (equal doc "")
1486 (eq ?\n (aref doc (1- (length doc))))) 1486 (eq ?\n (aref doc (1- (length doc)))))
1487 (terpri))))))))) 1487 (terpri)))
1488 (when (commandp function)
1489 (princ "\nInvoked with:\n")
1490 (let ((global-binding
1491 (where-is-internal function global-map))
1492 (global-tty-binding
1493 (where-is-internal function global-tty-map))
1494 (global-window-system-binding
1495 (where-is-internal function global-window-system-map)))
1496 (if (or global-binding global-tty-binding
1497 global-window-system-binding)
1498 (if (and (equal global-binding
1499 global-tty-binding)
1500 (equal global-binding
1501 global-window-system-binding))
1502 (princ
1503 (substitute-command-keys
1504 (format "\n\\[%s]" function)))
1505 (when (and global-window-system-binding
1506 (not (equal global-window-system-binding
1507 global-binding)))
1508 (princ
1509 (format
1510 "\n%s\n -- under window systems\n"
1511 (mapconcat #'key-description
1512 global-window-system-binding
1513 ", "))))
1514 (when (and global-tty-binding
1515 (not (equal global-tty-binding
1516 global-binding)))
1517 (princ
1518 (format
1519 "\n%s\n -- under TTYs\n"
1520 (mapconcat #'key-description
1521 global-tty-binding
1522 ", "))))
1523 (when global-binding
1524 (princ
1525 (format
1526 "\n%s\n -- generally (that is, unless\
1527 overridden by TTY- or
1528 window-system-specific mappings)\n"
1529 (mapconcat #'key-description
1530 global-binding
1531 ", ")))))
1532 (princ (substitute-command-keys
1533 (format "\n\\[%s]" function))))))))))))
1488 1534
1489 ;;; [Obnoxious, whining people who complain very LOUDLY on Usenet 1535 ;;; [Obnoxious, whining people who complain very LOUDLY on Usenet
1490 ;;; are binding this to keys.] 1536 ;;; are binding this to keys.]
1491 (defun describe-function-arglist (function) 1537 (defun describe-function-arglist (function)
1492 (interactive (list (or (function-at-point) 1538 (interactive (list (or (function-at-point)