diff options
Diffstat (limited to 'lisp/simple.el')
| -rw-r--r-- | lisp/simple.el | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 2a90a076315..aaed17cb9ea 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -2004,7 +2004,7 @@ This function uses the `read-extended-command-predicate' user option." | |||
| 2004 | (lambda (string pred action) | 2004 | (lambda (string pred action) |
| 2005 | (if (and suggest-key-bindings (eq action 'metadata)) | 2005 | (if (and suggest-key-bindings (eq action 'metadata)) |
| 2006 | '(metadata | 2006 | '(metadata |
| 2007 | (affixation-function . read-extended-command--affixation) | 2007 | (annotation-function . read-extended-command--annotation) |
| 2008 | (category . command)) | 2008 | (category . command)) |
| 2009 | (let ((pred | 2009 | (let ((pred |
| 2010 | (if (memq action '(nil t)) | 2010 | (if (memq action '(nil t)) |
| @@ -2093,25 +2093,24 @@ or (if one of MODES is a minor mode), if it is switched on in BUFFER." | |||
| 2093 | (and (get-text-property (point) 'button) | 2093 | (and (get-text-property (point) 'button) |
| 2094 | (eq (get-text-property (point) 'category) category)))) | 2094 | (eq (get-text-property (point) 'category) category)))) |
| 2095 | 2095 | ||
| 2096 | (defun read-extended-command--affixation (command-names) | 2096 | (defun read-extended-command--annotation (command-name) |
| 2097 | ;; why is this `with-selected-window' here? | ||
| 2097 | (with-selected-window (or (minibuffer-selected-window) (selected-window)) | 2098 | (with-selected-window (or (minibuffer-selected-window) (selected-window)) |
| 2098 | (mapcar | 2099 | (let* ((fun (and (stringp command-name) (intern-soft command-name))) |
| 2099 | (lambda (command-name) | 2100 | (binding (where-is-internal fun overriding-local-map t)) |
| 2100 | (let* ((fun (and (stringp command-name) (intern-soft command-name))) | 2101 | (obsolete (get fun 'byte-obsolete-info)) |
| 2101 | (binding (where-is-internal fun overriding-local-map t)) | 2102 | (alias (symbol-function fun)) |
| 2102 | (obsolete (get fun 'byte-obsolete-info)) | 2103 | (annotation (cond ((symbolp alias) |
| 2103 | (alias (symbol-function fun)) | 2104 | (format " (%s)" alias)) |
| 2104 | (suffix (cond ((symbolp alias) | 2105 | (obsolete |
| 2105 | (format " (%s)" alias)) | 2106 | (format " (%s)" (car obsolete))) |
| 2106 | (obsolete | 2107 | ((and binding (not (stringp binding))) |
| 2107 | (format " (%s)" (car obsolete))) | 2108 | (format " (%s)" (key-description binding))) |
| 2108 | ((and binding (not (stringp binding))) | 2109 | (t "")))) |
| 2109 | (format " (%s)" (key-description binding))) | 2110 | (put-text-property 0 (length annotation) |
| 2110 | (t "")))) | 2111 | 'face 'completions-annotations annotation) |
| 2111 | (put-text-property 0 (length suffix) | 2112 | (when annotation |
| 2112 | 'face 'completions-annotations suffix) | 2113 | (propertize annotation 'prefix "" 'suffix annotation))))) |
| 2113 | (list command-name "" suffix))) | ||
| 2114 | command-names))) | ||
| 2115 | 2114 | ||
| 2116 | (defcustom suggest-key-bindings t | 2115 | (defcustom suggest-key-bindings t |
| 2117 | "Non-nil means show the equivalent key-binding when M-x command has one. | 2116 | "Non-nil means show the equivalent key-binding when M-x command has one. |