GNU bug report logs - #43300
[PATCH] Make M-x show new commands for obsolete aliases

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefan <at> marxist.se>

Date: Thu, 10 Sep 2020 00:00:02 UTC

Severity: wishlist

Tags: fixed, patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #23 received at 43300 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Juri Linkov <juri <at> linkov.net>
Cc: 43300 <at> debbugs.gnu.org, Stefan Kangas <stefan <at> marxist.se>
Subject: Re: bug#43300: [PATCH] Make M-x show new commands for obsolete aliases
Date: Wed, 18 Nov 2020 12:43:51 +0000
[Message part 1 (text/plain, inline)]
Juri Linkov <juri <at> linkov.net> writes:

>> Please find attached two patches that tweaks how M-x
>> (execute-extended-command) works:
>>
>> 1. Show obsolete commands, and give their new name as an annotation.
>
> I noticed that some commands have " (nil)" appended as annotations
> in M-x completions, e.g. 'M-x browse- TAB'.  Looks like " (nil)"
> is returned in read-extended-command--annotation:
>
>           (obsolete
>            (format " (%s)" (car obsolete)))

Is the following sufficient?

[m-x.diff (text/x-diff, inline)]
diff --git a/lisp/simple.el b/lisp/simple.el
index bb28145502..2acceef6a1 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1964,13 +1964,14 @@ read-extended-command
      #'commandp t nil 'extended-command-history)))
 
 (defun read-extended-command--annotation (command-name)
-  (let* ((fun (and (stringp command-name) (intern-soft command-name)))
+  "Return annotation for COMMAND-NAME in M-x completion."
+  (let* ((fun (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
+          ((car obsolete)
            (format " (%s)" (car obsolete)))
           ((and binding (not (stringp binding)))
            (format " (%s)" (key-description binding))))))
[Message part 3 (text/plain, inline)]
Thanks,

-- 
Basil

This bug report was last modified 4 years and 5 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.