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#51173: 28.0.60; gnus-article-describe-key doesn't work Date: Fri, 15 Oct 2021 09:49:32 +0300 Organization: LINKOV.NET Message-ID: <87r1cm3hqb.fsf@mail.linkov.net> References: <87h7dl6spg.fsf@gnus.org> <87r1cox4th.fsf@mail.linkov.net> <87h7dkx2g5.fsf@mail.linkov.net> 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="3391"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: Lars Ingebrigtsen , Katsumi Yamaoka , 51173@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 15 09:03:38 2021 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 1mbHFi-0000mq-63 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 Oct 2021 09:03:38 +0200 Original-Received: from localhost ([::1]:42634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbHFe-0000Mi-W2 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 Oct 2021 03:03:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35852) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbHF8-0000LI-M8 for bug-gnu-emacs@gnu.org; Fri, 15 Oct 2021 03:03:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54587) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mbHF8-0003Tg-E3 for bug-gnu-emacs@gnu.org; Fri, 15 Oct 2021 03:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mbHF8-0007xq-8v; Fri, 15 Oct 2021 03:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bugs@gnus.org Resent-Date: Fri, 15 Oct 2021 07:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51173 X-GNU-PR-Package: emacs,gnus Original-Received: via spool by 51173-submit@debbugs.gnu.org id=B51173.163428136930576 (code B ref 51173); Fri, 15 Oct 2021 07:03:02 +0000 Original-Received: (at 51173) by debbugs.gnu.org; 15 Oct 2021 07:02:49 +0000 Original-Received: from localhost ([127.0.0.1]:37896 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mbHEv-0007x5-EL for submit@debbugs.gnu.org; Fri, 15 Oct 2021 03:02:49 -0400 Original-Received: from relay9-d.mail.gandi.net ([217.70.183.199]:32771) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mbHEt-0007wm-Ek for 51173@debbugs.gnu.org; Fri, 15 Oct 2021 03:02:48 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 3A993FF818; Fri, 15 Oct 2021 07:02:38 +0000 (UTC) In-Reply-To: (Stefan Monnier's message of "Wed, 13 Oct 2021 16:01:51 -0400") 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:217289 Archived-At: --=-=-= Content-Type: text/plain > But this will still use "the wrong buffer" for mouse clicks, no? > > BTW, maybe a cleaner fix would be as follows: > - Add a `buffer` argument to `describe-key(-briefly)`. > - Pass that argument from `gnus-article-describe-key`. > And to get the behavior that Juri just pushed that `buffer` argument > would default to (if (consp event) (window-buffer (posn-window > (event-start event))) (current-buffere)). Maybe something like this (but currently I have no idea how to test all cases): --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=gnus-article-describe-key.patch diff --git a/lisp/help.el b/lisp/help.el index 9666ef9805..08a293c3dc 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -731,7 +731,7 @@ help--filter-info-list ;; If nothing left, then keep one (the last one). (last info-list))) -(defun describe-key-briefly (&optional key-list insert untranslated) +(defun describe-key-briefly (&optional key-list insert buffer) "Print the name of the functions KEY-LIST invokes. KEY-LIST is a list of pairs (SEQ . RAW-SEQ) of key sequences, where RAW-SEQ is the untranslated form of the key sequence SEQ. @@ -739,8 +739,10 @@ describe-key-briefly While reading KEY-LIST interactively, this command temporarily enables menu items or tool-bar buttons that are disabled to allow getting help -on them." - (declare (advertised-calling-convention (key-list &optional insert) "27.1")) +on them. + +BUFFER is the buffer in which to lookup those keys; it defaults to the +current buffer." (interactive ;; Ignore mouse movement events because it's too easy to miss the ;; message while moving the mouse. @@ -748,15 +750,13 @@ describe-key-briefly `(,key-list ,current-prefix-arg))) (when (arrayp key-list) ;; Old calling convention, changed - (setq key-list (list (cons key-list - (if (numberp untranslated) - (this-single-command-raw-keys) - untranslated))))) - (let* ((info-list (mapcar (lambda (kr) - (help--analyze-key (car kr) (cdr kr))) - key-list)) - (msg (mapconcat #'car (help--filter-info-list info-list 1) "\n"))) - (if insert (insert msg) (message "%s" msg)))) + (setq key-list (list (cons key-list nil)))) + (with-current-buffer (or buffer (current-buffer)) + (let* ((info-list (mapcar (lambda (kr) + (help--analyze-key (car kr) (cdr kr))) + key-list)) + (msg (mapconcat #'car (help--filter-info-list info-list 1) "\n"))) + (if insert (insert msg) (message "%s" msg))))) (defun help--key-binding-keymap (key &optional accept-default no-remap position) "Return a keymap holding a binding for KEY within current keymaps. diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index bb466b9400..bbb452279a 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -6865,8 +6865,14 @@ gnus-article-describe-key unread-command-events)) (let ((cursor-in-echo-area t) gnus-pick-mode) - (describe-key (read-key-sequence nil t)))) - (describe-key key))) + (let* ((key (read-key-sequence nil t)) + (buffer (if (consp key) + (window-buffer (posn-window (event-start key))) + (current-buffer)))) + (describe-key key buffer)))) + (describe-key key (if (consp key) + (window-buffer (posn-window (event-start key))) + (current-buffer))))) (defun gnus-article-describe-key-briefly (key &optional insert) "Display documentation of the function invoked by KEY. @@ -6888,8 +6894,15 @@ gnus-article-describe-key-briefly unread-command-events)) (let ((cursor-in-echo-area t) gnus-pick-mode) - (describe-key-briefly (read-key-sequence nil t) insert))) - (describe-key-briefly key insert))) + (let ((key (read-key-sequence nil t)) + (buffer (if (consp key) + (window-buffer (posn-window (event-start key))) + (current-buffer)))) + (describe-key-briefly key insert buffer)))) + (describe-key-briefly key insert + (if (consp key) + (window-buffer (posn-window (event-start key))) + (current-buffer))))) ;;`gnus-agent-mode' in gnus-agent.el will define it. (defvar gnus-agent-summary-mode) --=-=-=--