From 922e43ad7db2145f2a93ba66401289e420c129a5 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 16 Dec 2020 23:27:11 +0200 Subject: [PATCH] Don't show minibuffer keybindings for suggestions in read-extended-command * lisp/simple.el (read-extended-command): Use 'affixation-function' instead of 'annotation-function'. (Bug#45035) (read-extended-command--affixation): New function created from 'read-extended-command--annotation'. --- lisp/simple.el | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 6059c23a14e..090162b973a 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1958,22 +1958,27 @@ to get different commands to edit and resubmit." (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. -- 2.39.2