From unknown Thu Sep 11 10:05:14 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#39035 <39035@debbugs.gnu.org> To: bug#39035 <39035@debbugs.gnu.org> Subject: Status: Show key bindings on M-x completion Reply-To: bug#39035 <39035@debbugs.gnu.org> Date: Thu, 11 Sep 2025 17:05:14 +0000 retitle 39035 Show key bindings on M-x completion reassign 39035 emacs submitter 39035 Stefan Kangas severity 39035 wishlist tag 39035 fixed thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 08 05:17:34 2020 Received: (at submit) by debbugs.gnu.org; 8 Jan 2020 10:17:34 +0000 Received: from localhost ([127.0.0.1]:49803 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ip8P8-0005Yf-2T for submit@debbugs.gnu.org; Wed, 08 Jan 2020 05:17:34 -0500 Received: from lists.gnu.org ([209.51.188.17]:36890) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ip8P6-0005XQ-DZ for submit@debbugs.gnu.org; Wed, 08 Jan 2020 05:17:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38069) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ip8P4-0000fL-UF for bug-gnu-emacs@gnu.org; Wed, 08 Jan 2020 05:17:32 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ip8P3-0004yp-NB for bug-gnu-emacs@gnu.org; Wed, 08 Jan 2020 05:17:30 -0500 Received: from mail-pg1-f171.google.com ([209.85.215.171]:35249) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ip8P3-0004yD-I1 for bug-gnu-emacs@gnu.org; Wed, 08 Jan 2020 05:17:29 -0500 Received: by mail-pg1-f171.google.com with SMTP id l24so1361248pgk.2 for ; Wed, 08 Jan 2020 02:17:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Jy5DY1yE9V+KTmQ6BOtofttkI5D2SjTvl6Hk+bQCDYU=; b=TC9ox1P4EvMg+h1CjBZCnIvAdVsq45pieA84thU/yWbE3MCDsw/FvmeDzV5iswruse vpbhwWdSs+LNhsGDtQUKe1jwXET9R+k8QddJTkXcmGLOHIMONhlvsa10WUsAj3REma9S EMJOmwx/eR6TxsO5VjyL7iGG+1k6lEs2FsZtkutDQV1GbkJQaVxc85GeFSHV9BQg63Zk gKFnOKwlyhrHVMQS3u/FCTyRooWZw0CLMjQsptGjxtoijfE0a+slpKGgfToKpOc2nBCx EMaxNurrjDTwJQNyxvVSLQNpzdRO503tpsWWTydY2Fb2C1nOw9fxrt8Kk1PwJ/TUYIVa w/kQ== X-Gm-Message-State: APjAAAUC52q7vJrSfGVDtI3US+ZKQbhlzqgLm9pm78hpBzuWmFvpGrxU 5Y1FHfdDu0hdebenmxY52wGOjBxB3kQM3+jz1wsX/klidXA= X-Google-Smtp-Source: APXvYqz3GMlVcag/oD3684Nluen2fu87TZYMVrIAU13GxqwvtPZ9qTc8Aus4Z4zEOYuYktwphe4Xht5U7hROeBXAxyY= X-Received: by 2002:a63:5f45:: with SMTP id t66mr4299792pgb.198.1578478648136; Wed, 08 Jan 2020 02:17:28 -0800 (PST) MIME-Version: 1.0 From: Stefan Kangas Date: Wed, 8 Jan 2020 11:17:16 +0100 Message-ID: Subject: Show key bindings on M-x completion To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset="UTF-8" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.215.171 X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Severity: wishlist In the completion interface for M-x, please add functionality to show the key bindings in parenthesis after the command. This functionality is already there in the highly popular helm and swiper compl [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: gnu.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stefankangas[at]gmail.com) 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [209.51.188.17 listed in list.dnswl.org] 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different 2.0 SPOOFED_FREEMAIL No description available. X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.8 (-) Severity: wishlist In the completion interface for M-x, please add functionality to show the key bindings in parenthesis after the command. This functionality is already there in the highly popular helm and swiper completion frameworks, which could be useful for reference. For example, when typing M-x kmacro TAB, one should see: kmacro-insert-counter (C-x C-k TAB) kmacro-set-counter (C-x C-k C-c) [...] Ideally, the keybinding should also use a different color from the command. This was discussed on emacs-devel, and Stefan Monnier suggested that it shouldn't be too hard to do: https://lists.gnu.org/archive/html/emacs-devel/2020-01/msg00115.html Best regards, Stefan Kangas From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 28 18:16:48 2020 Received: (at 39035) by debbugs.gnu.org; 28 Jan 2020 23:16:48 +0000 Received: from localhost ([127.0.0.1]:33018 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iwa6C-0001sC-9x for submit@debbugs.gnu.org; Tue, 28 Jan 2020 18:16:48 -0500 Received: from bonobo.elm.relay.mailchannels.net ([23.83.212.22]:15845) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iwa6A-0001s3-K9 for 39035@debbugs.gnu.org; Tue, 28 Jan 2020 18:16:47 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 6EEAD501BA9; Tue, 28 Jan 2020 23:16:45 +0000 (UTC) Received: from pdx1-sub0-mail-a93.g.dreamhost.com (100-96-15-75.trex.outbound.svc.cluster.local [100.96.15.75]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 92D665020D0; Tue, 28 Jan 2020 23:16:44 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from pdx1-sub0-mail-a93.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.5); Tue, 28 Jan 2020 23:16:45 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Lonely-Turn: 066d39d04eafbac6_1580253405066_2709379360 X-MC-Loop-Signature: 1580253405066:3064875439 X-MC-Ingress-Time: 1580253405066 Received: from pdx1-sub0-mail-a93.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a93.g.dreamhost.com (Postfix) with ESMTP id 51BDD80F9C; Tue, 28 Jan 2020 15:16:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=kCDpAirh69mdP4Q8W3fDCvq6+QY=; b= dcTsvOTbKdIw7RjdFTAlSY5JxJc+ilwlCw6M/rlbZlMqZHrCjD0UWHkFLsuZjFTW lYiLRnMuHybf+Nei+/t7niiY0hh8xWybTUn2TN7cWsKf8t9HueNZp3BmQDxj1XCk kSvrh/EHXiFb9Q0BQy4Ku/85MyCszgM1Y+B2ZiSy0uM= Received: from mail.jurta.org (m91-129-105-126.cust.tele2.ee [91.129.105.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a93.g.dreamhost.com (Postfix) with ESMTPSA id 4829481265; Tue, 28 Jan 2020 15:16:36 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a93 From: Juri Linkov To: Stefan Kangas Subject: Re: bug#39035: Show key bindings on M-x completion References: Date: Tue, 28 Jan 2020 23:39:13 +0200 In-Reply-To: (Stefan Kangas's message of "Wed, 8 Jan 2020 11:17:16 +0100") Message-ID: <87y2tre4zq.fsf@linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.60 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrfeeggdduieehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhfffgjkfgfgggtsehmtderredtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecuffhomhgrihhnpehgnhhurdhorhhgnecukfhppeeluddruddvledruddthedruddvieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddthedruddviedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehsthgvfhgrnhesmhgrrhigihhsthdrshgv X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39035 Cc: 39035@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain > Severity: wishlist > > In the completion interface for M-x, please add functionality to show > the key bindings in parenthesis after the command. This functionality > is already there in the highly popular helm and swiper completion > frameworks, which could be useful for reference. > > For example, when typing M-x kmacro TAB, one should see: > > kmacro-insert-counter (C-x C-k TAB) > kmacro-set-counter (C-x C-k C-c) > [...] > > Ideally, the keybinding should also use a different color from the command. > > This was discussed on emacs-devel, and Stefan Monnier suggested that > it shouldn't be too hard to do: > https://lists.gnu.org/archive/html/emacs-devel/2020-01/msg00115.html Indeed, not hard at all: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=read-extended-command--annotation.patch diff --git a/lisp/simple.el b/lisp/simple.el index 00a706848b..b0159df203 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1783,17 +1783,29 @@ read-extended-command ;; and it serves as a shorthand for "Extended command: ". "M-x ") (lambda (string pred action) - (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))) + (if (and suggest-key-bindings (eq action 'metadata)) + '(metadata + (annotation-function . read-extended-command--annotation) + (category . suggest-key-bindings)) + (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)))) #'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 binding + (format " (%s)" (if (stringp binding) + (concat "M-x " binding " RET") + (key-description binding)))))) + (defcustom suggest-key-bindings t "Non-nil means show the equivalent key-binding when M-x command has one. The value can be a length of time to show the message for. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 28 22:03:08 2020 Received: (at 39035) by debbugs.gnu.org; 29 Jan 2020 03:03:08 +0000 Received: from localhost ([127.0.0.1]:33128 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iwddE-0007aI-HV for submit@debbugs.gnu.org; Tue, 28 Jan 2020 22:03:08 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:28270) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iwddC-0007Zm-TU for 39035@debbugs.gnu.org; Tue, 28 Jan 2020 22:03:07 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 2B9F6101016; Tue, 28 Jan 2020 22:03:01 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 61771100ECE; Tue, 28 Jan 2020 22:02:59 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1580266979; bh=+ftFaE+NLo19gNZao8livN/sE0H0sodJJMYuZWsto4I=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=WKUn5ZSduM8u1kpKrQ6Fd7RE/mmfZNSbfBZpGMj7xCmXlIHL/T+nzfEgsC6t4ScqX Bmni1F+lJ37YabGYR5slwBww7P4jcT8HeA0DM1O/ta07/nVttdj+q6SixqJWiBunRE 0coNLVghqeCXB85+nCQ8ODouUm2ZD18NKTvYnW0QBJ0IN3kPr+nk3wMwIIPv5BRPSx 9Os+MA5bxRHt+1VtY2iB9Ksf0msUCpxlT8c7XmtSRCQ+g3+F/daukHFFxLQoJPJZUk wTApUwxh91+INcgPFQRN0mPRgWlYTava2yAfw3vHGgkOQRwAaWCZqCPvRK70SgL27O yvQgvW8hMUApw== Received: from alfajor (unknown [45.72.213.248]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id CE99A120422; Tue, 28 Jan 2020 22:02:57 -0500 (EST) From: Stefan Monnier To: Juri Linkov Subject: Re: bug#39035: Show key bindings on M-x completion Message-ID: References: <87y2tre4zq.fsf@linkov.net> Date: Tue, 28 Jan 2020 22:02:55 -0500 In-Reply-To: <87y2tre4zq.fsf@linkov.net> (Juri Linkov's message of "Tue, 28 Jan 2020 23:39:13 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.020 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 39035 Cc: 39035@debbugs.gnu.org, Stefan Kangas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Indeed, not hard at all: Looks about right, thanks. > + (if (and suggest-key-bindings (eq action 'metadata)) > + '(metadata > + (annotation-function . read-extended-command--annotation) > + (category . suggest-key-bindings)) The `category` should describe the things that are being completed, i.e. `command` rather than `suggest-key-bindings`. > +(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 binding > + (format " (%s)" (if (stringp binding) > + (concat "M-x " binding " RET") > + (key-description binding)))))) Since we're in the middle of a `M-x`, I think a `M-x foo RET` annotation would not be useful at all: better not put anything when a command has no corresponding key binding (one could argue that it could be useful to put the `M-x RET` like `M-x re-u RET` for `rename-uniquely`, but it would be too costly to compute and still wouldn't be terribly useful). Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 29 18:44:53 2020 Received: (at 39035) by debbugs.gnu.org; 29 Jan 2020 23:44:53 +0000 Received: from localhost ([127.0.0.1]:34723 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iwx0u-0003pM-PM for submit@debbugs.gnu.org; Wed, 29 Jan 2020 18:44:52 -0500 Received: from brown.birch.relay.mailchannels.net ([23.83.209.23]:5016) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iwx0t-0003pC-Rg; Wed, 29 Jan 2020 18:44:52 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 93D40E02BE; Wed, 29 Jan 2020 23:44:50 +0000 (UTC) Received: from pdx1-sub0-mail-a85.g.dreamhost.com (100-96-83-64.trex.outbound.svc.cluster.local [100.96.83.64]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 1D0BDE0FCA; Wed, 29 Jan 2020 23:44:50 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from pdx1-sub0-mail-a85.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.5); Wed, 29 Jan 2020 23:44:50 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Cold-Harmony: 3983b8b724a09ec1_1580341490399_242383692 X-MC-Loop-Signature: 1580341490399:3065681612 X-MC-Ingress-Time: 1580341490398 Received: from pdx1-sub0-mail-a85.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a85.g.dreamhost.com (Postfix) with ESMTP id 904507F009; Wed, 29 Jan 2020 15:44:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=62Omw6gOM/zZk9HDrdDdEyUt0zw=; b= ycdH4xhgZ8jk9DzdBRZf/4GKQbJtiWmx/TtxQDAuRrQPZwlGuxTiWVUpwfHMmCnl 4HXBTTOvLjQ4/mZh1FuSfPYkhV6+H3y6SfIvMgI50u9EHxz0ThI+idqHE7EA8T3R oBcd0f4SuFtFnErC6Kt2Xiwwpv57Ekbad6fmhoGNib8= Received: from mail.jurta.org (m91-129-105-126.cust.tele2.ee [91.129.105.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a85.g.dreamhost.com (Postfix) with ESMTPSA id A3A587F00E; Wed, 29 Jan 2020 15:44:41 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a85 From: Juri Linkov To: Stefan Monnier Subject: Re: bug#39035: Show key bindings on M-x completion Organization: LINKOV.NET References: <87y2tre4zq.fsf@linkov.net> Date: Thu, 30 Jan 2020 01:42:55 +0200 In-Reply-To: (Stefan Monnier's message of "Tue, 28 Jan 2020 22:02:55 -0500") Message-ID: <87o8ulj0cg.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.60 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrfeejgdduudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddthedruddvieenucevlhhushhtvghrufhiiigvpeegnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddthedruddviedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrg X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39035 Cc: 39035@debbugs.gnu.org, Stefan Kangas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 39035 fixed close 39035 28.1 quit >> + (if (and suggest-key-bindings (eq action 'metadata)) >> + '(metadata >> + (annotation-function . read-extended-command--annotation) >> + (category . suggest-key-bindings)) > > The `category` should describe the things that are being completed, > i.e. `command` rather than `suggest-key-bindings`. Fixed. >> +(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 binding >> + (format " (%s)" (if (stringp binding) >> + (concat "M-x " binding " RET") >> + (key-description binding)))))) > > Since we're in the middle of a `M-x`, I think a `M-x foo RET` annotation > would not be useful at all: better not put anything when a command has > no corresponding key binding (one could argue that it could be useful to > put the `M-x RET` like `M-x re-u RET` for > `rename-uniquely`, but it would be too costly to compute and still > wouldn't be terribly useful). Thanks for suggestions, the fixed patch was pushed to master. From unknown Thu Sep 11 10:05:14 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 27 Feb 2020 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator