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: Wed, 16 Dec 2020 11:15:40 +0200 Organization: LINKOV.NET Message-ID: <87wnxiqezv.fsf@mail.linkov.net> References: <87k0ty2xnw.fsf@matem.unam.mx> <875z5gdkky.fsf@mail.linkov.net> <86pn3mpbxf.fsf@matem.unam.mx> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32217"; 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 Wed Dec 16 10:31:17 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 1kpT9Q-0008KT-RY for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 16 Dec 2020 10:31:16 +0100 Original-Received: from localhost ([::1]:55228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpT9P-0004vF-Rs for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 16 Dec 2020 04:31:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpT9C-0004tt-0T for bug-gnu-emacs@gnu.org; Wed, 16 Dec 2020 04:31:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48307) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpT9B-0005SV-Ov for bug-gnu-emacs@gnu.org; Wed, 16 Dec 2020 04:31:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kpT9B-0002Fj-MM for bug-gnu-emacs@gnu.org; Wed, 16 Dec 2020 04:31:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 Dec 2020 09:31:01 +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.16081110248588 (code B ref 45035); Wed, 16 Dec 2020 09:31:01 +0000 Original-Received: (at 45035) by debbugs.gnu.org; 16 Dec 2020 09:30:24 +0000 Original-Received: from localhost ([127.0.0.1]:59843 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kpT8a-0002ES-5c for submit@debbugs.gnu.org; Wed, 16 Dec 2020 04:30:24 -0500 Original-Received: from relay5-d.mail.gandi.net ([217.70.183.197]:39379) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kpT8X-0002EA-UV for 45035@debbugs.gnu.org; Wed, 16 Dec 2020 04:30:23 -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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 0BAAD1C000D; Wed, 16 Dec 2020 09:30:13 +0000 (UTC) In-Reply-To: <86pn3mpbxf.fsf@matem.unam.mx> ("Omar =?UTF-8?Q?Antol=C3=ADn?= Camarena"'s message of "Sun, 06 Dec 2020 20:50:04 -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:196204 Archived-At: --=-=-= Content-Type: text/plain >> 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. > > Oh, that's a very good point. Probably it would be best to leave > minibuffer-completion-help as is, and change only > read-extended-command--annotation. > >> 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. > > My Emacs doesn't have affixation-function yet, so I don't really know > anything about it. I'm sorry that your version of Emacs is not updated too often. So here I created a patch based on current master, and after pushing it, sometimes it will arrive to your updated version. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=read-extended-command--affixation.patch diff --git a/lisp/simple.el b/lisp/simple.el index c309df11ad..f669996c2f 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1958,22 +1958,27 @@ read-extended-command (lambda (string pred action) (if (and suggest-key-bindings (eq action 'metadata)) '(metadata - (annotation-function . read-extended-command--annotation) + (affixation-function . read-extended-command--affixation) (category . command)) (complete-with-action action obarray string pred))) #'commandp t nil 'extended-command-history))) -(defun read-extended-command--annotation (command-name) - (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)) - (alias (symbol-function fun))) - (cond ((symbolp alias) - (format " (%s)" alias)) - (obsolete - (format " (%s)" (car obsolete))) - ((and binding (not (stringp binding))) - (format " (%s)" (key-description binding)))))) +(defun read-extended-command--affixation (command-names) + (with-selected-window (or (minibuffer-selected-window) (selected-window)) + (mapcar + (lambda (command-name) + (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)) + (alias (symbol-function fun)) + (suffix (cond ((symbolp alias) + (format " (%s)" alias)) + (obsolete + (format " (%s)" (car obsolete))) + ((and binding (not (stringp binding))) + (format " (%s)" (key-description binding)))))) + (if suffix (list command-name suffix) command-name))) + command-names))) (defcustom suggest-key-bindings t "Non-nil means show the equivalent key-binding when M-x command has one. --=-=-=--