diff options
| author | Stefan Kangas | 2020-09-10 01:32:24 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2020-09-13 15:05:02 +0200 |
| commit | 1b0a922a19bf7b380abe89a4e92176c779c26c2d (patch) | |
| tree | e4997e73bc598d8c333a7e5fa67393cbb51c2436 | |
| parent | 9ca83cdd79747fb09f714593243060b17b34e039 (diff) | |
| download | emacs-1b0a922a19bf7b380abe89a4e92176c779c26c2d.tar.gz emacs-1b0a922a19bf7b380abe89a4e92176c779c26c2d.zip | |
Make M-x show obsolete commands (Bug#43300)
* lisp/simple.el (read-extended-command): Don't hide obsolete
commands.
(read-extended-command--annotation): Show an annotation for obsolete
commands that says what their new name is.
| -rw-r--r-- | lisp/simple.el | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index b5002dd1898..16ff8637b95 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -1881,22 +1881,17 @@ to get different commands to edit and resubmit." | |||
| 1881 | '(metadata | 1881 | '(metadata |
| 1882 | (annotation-function . read-extended-command--annotation) | 1882 | (annotation-function . read-extended-command--annotation) |
| 1883 | (category . command)) | 1883 | (category . command)) |
| 1884 | (let ((pred | 1884 | (complete-with-action action obarray string pred))) |
| 1885 | (if (memq action '(nil t)) | ||
| 1886 | ;; Exclude obsolete commands from completions. | ||
| 1887 | (lambda (sym) | ||
| 1888 | (and (funcall pred sym) | ||
| 1889 | (or (equal string (symbol-name sym)) | ||
| 1890 | (not (get sym 'byte-obsolete-info))))) | ||
| 1891 | pred))) | ||
| 1892 | (complete-with-action action obarray string pred)))) | ||
| 1893 | #'commandp t nil 'extended-command-history))) | 1885 | #'commandp t nil 'extended-command-history))) |
| 1894 | 1886 | ||
| 1895 | (defun read-extended-command--annotation (command-name) | 1887 | (defun read-extended-command--annotation (command-name) |
| 1896 | (let* ((function (and (stringp command-name) (intern-soft command-name))) | 1888 | (let* ((fun (and (stringp command-name) (intern-soft command-name))) |
| 1897 | (binding (where-is-internal function overriding-local-map t))) | 1889 | (binding (where-is-internal fun overriding-local-map t)) |
| 1898 | (when (and binding (not (stringp binding))) | 1890 | (obsolete (get fun 'byte-obsolete-info))) |
| 1899 | (format " (%s)" (key-description binding))))) | 1891 | (cond (obsolete |
| 1892 | (format " (%s)" (car obsolete))) | ||
| 1893 | ((and binding (not (stringp binding))) | ||
| 1894 | (format " (%s)" (key-description binding)))))) | ||
| 1900 | 1895 | ||
| 1901 | (defcustom suggest-key-bindings t | 1896 | (defcustom suggest-key-bindings t |
| 1902 | "Non-nil means show the equivalent key-binding when M-x command has one. | 1897 | "Non-nil means show the equivalent key-binding when M-x command has one. |