[Top][All Lists]

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

master 1b0a922 1/2: Make M-x show obsolete commands (Bug#43300)

From: Stefan Kangas
Subject: master 1b0a922 1/2: Make M-x show obsolete commands (Bug#43300)
Date: Sun, 13 Sep 2020 09:06:16 -0400 (EDT)

branch: master
commit 1b0a922a19bf7b380abe89a4e92176c779c26c2d
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    Make M-x show obsolete commands (Bug#43300)
    * lisp/simple.el (read-extended-command): Don't hide obsolete
    (read-extended-command--annotation): Show an annotation for obsolete
    commands that says what their new name is.
 lisp/simple.el | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index b5002dd..16ff863 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1881,22 +1881,17 @@ to get different commands to edit and resubmit."
             (annotation-function . read-extended-command--annotation)
             (category . command))
-         (let ((pred
-                (if (memq action '(nil t))
-                    ;; Exclude obsolete commands from completions.
-                    (lambda (sym)
-                      (and (funcall pred sym)
-                           (or (equal string (symbol-name sym))
-                               (not (get sym 'byte-obsolete-info)))))
-                  pred)))
-           (complete-with-action action obarray string pred))))
+         (complete-with-action action obarray string pred)))
      #'commandp t nil 'extended-command-history)))
 (defun read-extended-command--annotation (command-name)
-  (let* ((function (and (stringp command-name) (intern-soft command-name)))
-         (binding (where-is-internal function overriding-local-map t)))
-    (when (and binding (not (stringp binding)))
-      (format " (%s)" (key-description binding)))))
+  (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)))
+    (cond (obsolete
+           (format " (%s)" (car obsolete)))
+          ((and binding (not (stringp binding)))
+           (format " (%s)" (key-description binding))))))
 (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]