From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#45035: 28.0.50; Command completion annotations show minibuffer keybindings Date: Sat, 05 Dec 2020 22:51:41 +0200 Organization: LINKOV.NET Message-ID: <875z5gdkky.fsf@mail.linkov.net> References: <87k0ty2xnw.fsf@matem.unam.mx> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1530"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 45035@debbugs.gnu.org To: Omar =?UTF-8?Q?Antol=C3=ADn?= Camarena Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 05 22:16:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kleuZ-0000IU-Jm for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 05 Dec 2020 22:16:11 +0100 Original-Received: from localhost ([::1]:47044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kleuY-00037o-FX for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 05 Dec 2020 16:16:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kleuQ-00037g-FR for bug-gnu-emacs@gnu.org; Sat, 05 Dec 2020 16:16:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36797) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kleuQ-0000LC-8O for bug-gnu-emacs@gnu.org; Sat, 05 Dec 2020 16:16:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kleuQ-0004tM-2f for bug-gnu-emacs@gnu.org; Sat, 05 Dec 2020 16:16:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Dec 2020 21:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45035 X-GNU-PR-Package: emacs Original-Received: via spool by 45035-submit@debbugs.gnu.org id=B45035.160720290718734 (code B ref 45035); Sat, 05 Dec 2020 21:16:02 +0000 Original-Received: (at 45035) by debbugs.gnu.org; 5 Dec 2020 21:15:07 +0000 Original-Received: from localhost ([127.0.0.1]:48342 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kletX-0004s5-8m for submit@debbugs.gnu.org; Sat, 05 Dec 2020 16:15:07 -0500 Original-Received: from relay2-d.mail.gandi.net ([217.70.183.194]:52887) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kletV-0004rE-TN for 45035@debbugs.gnu.org; Sat, 05 Dec 2020 16:15:06 -0500 X-Originating-IP: 91.129.99.98 Original-Received: from mail.gandi.net (m91-129-99-98.cust.tele2.ee [91.129.99.98]) (Authenticated sender: juri@linkov.net) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id DEFE740002; Sat, 5 Dec 2020 21:14:57 +0000 (UTC) In-Reply-To: <87k0ty2xnw.fsf@matem.unam.mx> ("Omar =?UTF-8?Q?Antol=C3=ADn?= Camarena"'s message of "Thu, 03 Dec 2020 19:00:03 -0600") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:195057 Archived-At: > If from M-x you switch to the *Completions* buffer, it will show > keybindings as annotations next to the command names. Unfortunately, it > shows the key bindings that are active in the minibuffer, while it would > be more useful to show the keybindings active in the buffer in which you pressed M-x. > > Here's a simple recipe to see the issue from emacs -Q: > > Run emacs -Q. You will have eval-print-last-sexp bound to C-j in the > scratch buffer, and minibuffer-complete-and-exit bound to C-j in the > minibuffer, of course. > > Try this: while in the scratch buffer, type M-x and part of either of > those two commands, and then press M-v to switch to the *Completions* > buffer. For eval-print-last-sexp you'll see no annotation, and for > minibuffer-complete-and-exit you'll see C-j. > > This illustrates the fact that the key bindings in the annotation are > those from the minibuffer. > > The problem is that when the function read-extended-command--annotation > is called, the minibuffer is active. If people agree that it would be > better to show the key bindings in the last buffer active before the > minibuffer, one way to get this behavior is by modifying > minibuffer-completion-help. That function obtains the > annotation-function metadatum and stores it in a variable called afun. > The form that actually calls afun could be wrapped in with-minibuffer-selected-window, for example. Thanks, I think your idea is correct. But I'm not sure if minibuffer-completion-help is the right place for wrapping in with-minibuffer-selected-window. This means that all calls of annotation-function will be in the original buffer, whereas only read-extended-command--annotation needs such wrapping. Or do you care that such wrapping will be called for every command in read-extended-command--annotation? Then instead of annotation-function you could try to use a new function affixation-function that is called only once, so you could add wrapping to it.