unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: Juri Linkov <juri@linkov.net>
Cc: 43300@debbugs.gnu.org, Stefan Kangas <stefan@marxist.se>
Subject: bug#43300: [PATCH] Make M-x show new commands for obsolete aliases
Date: Wed, 18 Nov 2020 12:43:51 +0000	[thread overview]
Message-ID: <87zh3ezvg8.fsf@tcd.ie> (raw)
In-Reply-To: <87ft576o5h.fsf@linkov.net> (Juri Linkov's message of "Wed, 18 Nov 2020 11:14:18 +0200")

[-- Attachment #1: Type: text/plain, Size: 498 bytes --]

Juri Linkov <juri@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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: m-x.diff --]
[-- Type: text/x-diff, Size: 879 bytes --]

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))))))

[-- Attachment #3: Type: text/plain, Size: 20 bytes --]


Thanks,

-- 
Basil

  reply	other threads:[~2020-11-18 12:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-09 23:59 bug#43300: [PATCH] Make M-x show new commands for obsolete aliases Stefan Kangas
2020-09-10 21:09 ` Lars Ingebrigtsen
2020-09-13 13:06   ` Stefan Kangas
2020-11-18  9:14 ` Juri Linkov
2020-11-18 12:43   ` Basil L. Contovounesios [this message]
2020-11-18 13:49     ` Stefan Kangas
2020-11-18 19:10       ` Juri Linkov
2020-11-18 21:51         ` Drew Adams
2020-11-18 22:06         ` Stefan Kangas
2021-02-16 15:35           ` Stefan Kangas
2021-02-16 16:23             ` Lars Ingebrigtsen
2021-02-16 17:32               ` Stefan Kangas
2021-02-16 17:36                 ` Lars Ingebrigtsen
2021-02-17  9:52                   ` Stefan Kangas
2021-02-17 11:16                     ` Lars Ingebrigtsen
2021-02-17 13:26                     ` Basil L. Contovounesios
2021-05-13 10:19                     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zh3ezvg8.fsf@tcd.ie \
    --to=contovob@tcd.ie \
    --cc=43300@debbugs.gnu.org \
    --cc=juri@linkov.net \
    --cc=stefan@marxist.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).