Make M-x show what aliases point to (Bug#43300)

* lisp/simple.el (read-extended-command--annotation): Show an
annotation for aliases saying what it points to.
This commit is contained in:
Stefan Kangas 2020-09-10 01:42:53 +02:00
parent 1b0a922a19
commit 06d86b954d

View file

@ -1887,8 +1887,11 @@ to get different commands to edit and resubmit."
(defun read-extended-command--annotation (command-name)
(let* ((fun (and (stringp command-name) (intern-soft command-name)))
(binding (where-is-internal fun overriding-local-map t))
(obsolete (get fun 'byte-obsolete-info)))
(cond (obsolete
(obsolete (get fun 'byte-obsolete-info))
(alias (symbol-function fun)))
(cond ((symbolp alias)
(format " (%s)" alias))
(obsolete
(format " (%s)" (car obsolete)))
((and binding (not (stringp binding)))
(format " (%s)" (key-description binding))))))