486 |
(let ((func (indirect-function definition)) |
(let ((func (indirect-function definition)) |
487 |
(defs nil) |
(defs nil) |
488 |
(standard-output (if insert (current-buffer) t))) |
(standard-output (if insert (current-buffer) t))) |
489 |
|
;; In DEFS, find all symbols that are aliases for DEFINITION. |
490 |
(mapatoms (lambda (symbol) |
(mapatoms (lambda (symbol) |
491 |
(and (fboundp symbol) |
(and (fboundp symbol) |
492 |
(not (eq symbol definition)) |
(not (eq symbol definition)) |
494 |
(indirect-function symbol) |
(indirect-function symbol) |
495 |
(error symbol))) |
(error symbol))) |
496 |
(push symbol defs)))) |
(push symbol defs)))) |
497 |
(princ (mapconcat |
;; Look at all the symbols--first DEFINITION, |
498 |
#'(lambda (symbol) |
;; then its aliases. |
499 |
(let* ((remapped (command-remapping symbol)) |
(dolist (symbol (cons definition defs)) |
500 |
(keys (where-is-internal |
(let* ((remapped (command-remapping symbol)) |
501 |
symbol overriding-local-map nil nil remapped)) |
(keys (where-is-internal |
502 |
(keys (mapconcat 'key-description keys ", "))) |
symbol overriding-local-map nil nil remapped)) |
503 |
(if insert |
(keys (mapconcat 'key-description keys ", ")) |
504 |
(if (> (length keys) 0) |
string) |
505 |
(if remapped |
(setq string |
506 |
(format "%s (%s) (remapped from %s)" |
(if insert |
507 |
keys remapped symbol) |
(if (> (length keys) 0) |
508 |
(format "%s (%s)" keys symbol)) |
(if remapped |
509 |
(format "M-x %s RET" symbol)) |
(format "%s (%s) (remapped from %s)" |
510 |
(if (> (length keys) 0) |
keys remapped symbol) |
511 |
(if remapped |
(format "%s (%s)" keys symbol)) |
512 |
(format "%s is remapped to %s which is on %s" |
(format "M-x %s RET" symbol)) |
513 |
definition symbol keys) |
(if (> (length keys) 0) |
514 |
(format "%s is on %s" symbol keys)) |
(if remapped |
515 |
(format "%s is not on any key" symbol))))) |
(format "%s is remapped to %s which is on %s" |
516 |
(cons definition defs) |
definition symbol keys) |
517 |
";\nand "))) |
(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))))) |
528 |
nil) |
nil) |
529 |
|
|
530 |
(defun string-key-binding (key) |
(defun string-key-binding (key) |