diff options
| -rw-r--r-- | lisp/help.el | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/lisp/help.el b/lisp/help.el index a544af59c84..aeffaf732a5 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -486,6 +486,7 @@ If INSERT (the prefix arg) is non-nil, insert the message in the buffer." | |||
| 486 | (let ((func (indirect-function definition)) | 486 | (let ((func (indirect-function definition)) |
| 487 | (defs nil) | 487 | (defs nil) |
| 488 | (standard-output (if insert (current-buffer) t))) | 488 | (standard-output (if insert (current-buffer) t))) |
| 489 | ;; In DEFS, find all symbols that are aliases for DEFINITION. | ||
| 489 | (mapatoms (lambda (symbol) | 490 | (mapatoms (lambda (symbol) |
| 490 | (and (fboundp symbol) | 491 | (and (fboundp symbol) |
| 491 | (not (eq symbol definition)) | 492 | (not (eq symbol definition)) |
| @@ -493,27 +494,37 @@ If INSERT (the prefix arg) is non-nil, insert the message in the buffer." | |||
| 493 | (indirect-function symbol) | 494 | (indirect-function symbol) |
| 494 | (error symbol))) | 495 | (error symbol))) |
| 495 | (push symbol defs)))) | 496 | (push symbol defs)))) |
| 496 | (princ (mapconcat | 497 | ;; Look at all the symbols--first DEFINITION, |
| 497 | #'(lambda (symbol) | 498 | ;; then its aliases. |
| 498 | (let* ((remapped (command-remapping symbol)) | 499 | (dolist (symbol (cons definition defs)) |
| 499 | (keys (where-is-internal | 500 | (let* ((remapped (command-remapping symbol)) |
| 500 | symbol overriding-local-map nil nil remapped)) | 501 | (keys (where-is-internal |
| 501 | (keys (mapconcat 'key-description keys ", "))) | 502 | symbol overriding-local-map nil nil remapped)) |
| 502 | (if insert | 503 | (keys (mapconcat 'key-description keys ", ")) |
| 503 | (if (> (length keys) 0) | 504 | string) |
| 504 | (if remapped | 505 | (setq string |
| 505 | (format "%s (%s) (remapped from %s)" | 506 | (if insert |
| 506 | keys remapped symbol) | 507 | (if (> (length keys) 0) |
| 507 | (format "%s (%s)" keys symbol)) | 508 | (if remapped |
| 508 | (format "M-x %s RET" symbol)) | 509 | (format "%s (%s) (remapped from %s)" |
| 509 | (if (> (length keys) 0) | 510 | keys remapped symbol) |
| 510 | (if remapped | 511 | (format "%s (%s)" keys symbol)) |
| 511 | (format "%s is remapped to %s which is on %s" | 512 | (format "M-x %s RET" symbol)) |
| 512 | definition symbol keys) | 513 | (if (> (length keys) 0) |
| 513 | (format "%s is on %s" symbol keys)) | 514 | (if remapped |
| 514 | (format "%s is not on any key" symbol))))) | 515 | (format "%s is remapped to %s which is on %s" |
| 515 | (cons definition defs) | 516 | definition symbol keys) |
| 516 | ";\nand "))) | 517 | (format "%s is on %s" symbol keys)) |
| 518 | ;; If this is the command the user asked about, | ||
| 519 | ;; and it is not on any key, say so. | ||
| 520 | ;; For other symbols, its aliases, say nothing | ||
| 521 | ;; about them unless they are on keys. | ||
| 522 | (if (eq symbol definition) | ||
| 523 | (format "%s is not on any key" symbol))))) | ||
| 524 | (when string | ||
| 525 | (unless (eq symbol definition) | ||
| 526 | (princ ";\n its alias ")) | ||
| 527 | (princ string))))) | ||
| 517 | nil) | 528 | nil) |
| 518 | 529 | ||
| 519 | (defun string-key-binding (key) | 530 | (defun string-key-binding (key) |