emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 922e43a: Don't show minibuffer keybindings for suggestions in rea


From: Juri Linkov
Subject: master 922e43a: Don't show minibuffer keybindings for suggestions in read-extended-command
Date: Wed, 16 Dec 2020 16:27:23 -0500 (EST)

branch: master
commit 922e43ad7db2145f2a93ba66401289e420c129a5
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    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 6059c23..090162b 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]