From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#51173: 28.0.60; gnus-article-describe-key doesn't work Date: Sat, 16 Oct 2021 15:53:03 -0400 Message-ID: References: <87h7dl6spg.fsf@gnus.org> <87r1cox4th.fsf@mail.linkov.net> <87h7dkx2g5.fsf@mail.linkov.net> <87r1cm3hqb.fsf@mail.linkov.net> <87h7dgg8go.fsf@mail.linkov.net> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38524"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Lars Ingebrigtsen , Katsumi Yamaoka , 51173@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 16 21:54:12 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 1mbpkx-0009mv-PS for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Oct 2021 21:54:11 +0200 Original-Received: from localhost ([::1]:45690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbpkv-0007Oj-Qo for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Oct 2021 15:54:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbpko-0007OU-84 for bug-gnu-emacs@gnu.org; Sat, 16 Oct 2021 15:54:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59811) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mbpkn-0001Sm-Ud for bug-gnu-emacs@gnu.org; Sat, 16 Oct 2021 15:54:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mbpkn-0006fg-QP; Sat, 16 Oct 2021 15:54:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bugs@gnus.org Resent-Date: Sat, 16 Oct 2021 19:54:01 +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.163441399525594 (code B ref 51173); Sat, 16 Oct 2021 19:54:01 +0000 Original-Received: (at 51173) by debbugs.gnu.org; 16 Oct 2021 19:53:15 +0000 Original-Received: from localhost ([127.0.0.1]:43124 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mbpk2-0006ek-Sb for submit@debbugs.gnu.org; Sat, 16 Oct 2021 15:53:15 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:28671) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mbpk0-0006eV-Q4 for 51173@debbugs.gnu.org; Sat, 16 Oct 2021 15:53:13 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 4D7A1440BDB; Sat, 16 Oct 2021 15:53:06 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id BD6E94409E2; Sat, 16 Oct 2021 15:53:04 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1634413984; bh=mDOBHq6YI3hM9Af3ceNZQXzg/6BiGwmLnO1HSu2oWEk=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=GPk5+0f14dcM3MQUjcICKCxieQAE6mwKlgUrepCAvJqGc980wahghbpLHPZpRLehD I7dx61XBr/v8wArZVkS0EIEwvQKW1VgDebHNuU8BfI4PyKqPJikOgtoMEgtVLxlXwL aGKYD1UuUxI0yuCw3LIrNfAlcc9RvPzEA3bhYvd9RcNFbsuf0st+Pdpna/lUpcLTd1 3KGOC3t7I6v7+5paE5aiqaBguA3rPxveSMIX/wtG4blUOrE4o/8IWP07qg6NZvGJ1q tc8IDe1GoNvKpjnIkKiETYJLnMgf9fNrQ+f/AGm1C5/CsC2I6s2XIgCN1iXsp75C0u ctRgO8fh5vEvw== Original-Received: from pastel (unknown [45.72.241.23]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 83843120384; Sat, 16 Oct 2021 15:53:04 -0400 (EDT) In-Reply-To: <87h7dgg8go.fsf@mail.linkov.net> (Juri Linkov's message of "Sat, 16 Oct 2021 20:55:51 +0300") 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:217394 Archived-At: >>> + (let* ((key (read-key-sequence nil t)) >>> + (buffer (if (consp key) >>> + (window-buffer (posn-window (event-start key))) >>> + (current-buffer)))) >>> + (describe-key key buffer)))) >> >> I think the first `describe-key` above should always use >> `current-buffer` (that's the whole point of the function: to lookup the >> keybinding in that other buffer). > > There is still something missing: `gnus-article-describe-key` > already selects the required buffer with `with-current-buffer`. > Then why should it provide the same buffer as an argument > to `describe-key` to select it again in `describe-key`? Because `describe-key` otherwise uses the buffer of the window associated with the event (this is in done in `help--analyse-key` where we currently use `mouse-set-point`). So we need to pass an explicit buffer to tell `describe-key` to ignore the event's window (and we need to change this part of `describe-key/help--analyse-key` to obey such a buffer argument). > Maybe you intended to add a new argument `buffer` to pass it down > to `help--analyze-key` that could use it somehow in this condition: > > (defn (if (consp event) > (save-excursion (mouse-set-point event) (key-binding key t)) > (key-binding key t))) Yes. > But I have no idea how. Maybe not to set point (that also selects > another window) when the `buffer` arg is provided? Exactly. > (defn (if (not buffer) > (save-excursion (mouse-set-point event) (key-binding key t)) > (key-binding key t))) > > IOW, the semantics of `buffer` is not clear here. If nil it means "defaults to the (window-buffer (posn-window (event-end event)))" >> OTOH we should probably try and change the `key` arg to use the new >> key-list format expected by `describe-key` (i.e. a list of (SEQ >> . RAW-SEQ) pairs). > > `gnus-article-describe-key` just passes down the value > that `read-key-sequence` returns. I know. This is the old calling convention of `describe-key`; we should move to the new one. Stefan