diff options
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/simple.el | 33 |
2 files changed, 26 insertions, 10 deletions
| @@ -109,6 +109,9 @@ like cell phones, tablets or cameras. | |||
| 109 | 109 | ||
| 110 | * Incompatible Lisp Changes in Emacs 28.1 | 110 | * Incompatible Lisp Changes in Emacs 28.1 |
| 111 | 111 | ||
| 112 | ** When 'suggest-key-bindings' is non-nil, the completion list of M-x | ||
| 113 | shows equivalent key-bindings for all commands that have them. | ||
| 114 | |||
| 112 | ** 'equal' no longer examines some contents of window configurations. | 115 | ** 'equal' no longer examines some contents of window configurations. |
| 113 | Instead, it considers window configurations to be equal only if they | 116 | Instead, it considers window configurations to be equal only if they |
| 114 | are 'eq'. To compare contents, use 'compare-window-configurations' | 117 | are 'eq'. To compare contents, use 'compare-window-configurations' |
diff --git a/lisp/simple.el b/lisp/simple.el index 2ec3da680f8..09447900ded 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -1788,23 +1788,36 @@ to get different commands to edit and resubmit." | |||
| 1788 | ;; and it serves as a shorthand for "Extended command: ". | 1788 | ;; and it serves as a shorthand for "Extended command: ". |
| 1789 | "M-x ") | 1789 | "M-x ") |
| 1790 | (lambda (string pred action) | 1790 | (lambda (string pred action) |
| 1791 | (let ((pred | 1791 | (if (and suggest-key-bindings (eq action 'metadata)) |
| 1792 | (if (memq action '(nil t)) | 1792 | '(metadata |
| 1793 | ;; Exclude obsolete commands from completions. | 1793 | (annotation-function . read-extended-command--annotation) |
| 1794 | (lambda (sym) | 1794 | (category . command)) |
| 1795 | (and (funcall pred sym) | 1795 | (let ((pred |
| 1796 | (or (equal string (symbol-name sym)) | 1796 | (if (memq action '(nil t)) |
| 1797 | (not (get sym 'byte-obsolete-info))))) | 1797 | ;; Exclude obsolete commands from completions. |
| 1798 | pred))) | 1798 | (lambda (sym) |
| 1799 | (complete-with-action action obarray string pred))) | 1799 | (and (funcall pred sym) |
| 1800 | (or (equal string (symbol-name sym)) | ||
| 1801 | (not (get sym 'byte-obsolete-info))))) | ||
| 1802 | pred))) | ||
| 1803 | (complete-with-action action obarray string pred)))) | ||
| 1800 | #'commandp t nil 'extended-command-history))) | 1804 | #'commandp t nil 'extended-command-history))) |
| 1801 | 1805 | ||
| 1806 | (defun read-extended-command--annotation (command-name) | ||
| 1807 | (let* ((function (and (stringp command-name) (intern-soft command-name))) | ||
| 1808 | (binding (where-is-internal function overriding-local-map t))) | ||
| 1809 | (when (and binding (not (stringp binding))) | ||
| 1810 | (format " (%s)" (key-description binding))))) | ||
| 1811 | |||
| 1802 | (defcustom suggest-key-bindings t | 1812 | (defcustom suggest-key-bindings t |
| 1803 | "Non-nil means show the equivalent key-binding when M-x command has one. | 1813 | "Non-nil means show the equivalent key-binding when M-x command has one. |
| 1804 | The value can be a length of time to show the message for. | 1814 | The value can be a length of time to show the message for. |
| 1805 | If the value is non-nil and not a number, we wait 2 seconds. | 1815 | If the value is non-nil and not a number, we wait 2 seconds. |
| 1806 | 1816 | ||
| 1807 | Also see `extended-command-suggest-shorter'." | 1817 | Also see `extended-command-suggest-shorter'. |
| 1818 | |||
| 1819 | Equivalent key-bindings are also shown in the completion list of | ||
| 1820 | M-x for all commands that have them." | ||
| 1808 | :group 'keyboard | 1821 | :group 'keyboard |
| 1809 | :type '(choice (const :tag "off" nil) | 1822 | :type '(choice (const :tag "off" nil) |
| 1810 | (integer :tag "time" 2) | 1823 | (integer :tag "time" 2) |