diff --git a/lisp/simple.el b/lisp/simple.el index c309df11ad..f669996c2f 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1958,22 +1958,27 @@ read-extended-command (lambda (string pred action) (if (and suggest-key-bindings (eq action 'metadata)) '(metadata - (annotation-function . read-extended-command--annotation) + (affixation-function . read-extended-command--affixation) (category . command)) (complete-with-action action obarray string pred))) #'commandp t nil 'extended-command-history))) -(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)) - (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)))))) +(defun read-extended-command--affixation (command-names) + (with-selected-window (or (minibuffer-selected-window) (selected-window)) + (mapcar + (lambda (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)) + (alias (symbol-function fun)) + (suffix (cond ((symbolp alias) + (format " (%s)" alias)) + (obsolete + (format " (%s)" (car obsolete))) + ((and binding (not (stringp binding))) + (format " (%s)" (key-description binding)))))) + (if suffix (list command-name suffix) command-name))) + command-names))) (defcustom suggest-key-bindings t "Non-nil means show the equivalent key-binding when M-x command has one.