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#53910: [External] : bug#53910: 29.0.50; context-menu-mode breaks help in read-only buffers Date: Fri, 18 Feb 2022 09:44:14 +0200 Organization: LINKOV.NET Message-ID: <86fsogocwx.fsf@mail.linkov.net> References: <20220210001600.vjiuqzoiuuzzj54c.ref@Ergus> <20220210001600.vjiuqzoiuuzzj54c@Ergus> <87mtizdwrv.fsf@gnus.org> <86y22jxfsq.fsf@mail.linkov.net> <87o83f7y3x.fsf@gnus.org> <86iltmpn0a.fsf@mail.linkov.net> <86wni13ifi.fsf@mail.linkov.net> <86pmns10kw.fsf@mail.linkov.net> <5d2c2af9-d011-583b-e9c1-985bbc2378c2@gmx.at> <861r06vbos.fsf@mail.linkov.net> <868ru9jnp6.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37114"; 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 , Ergus , "53910@debbugs.gnu.org" <53910@debbugs.gnu.org> To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 18 08:55:44 2022 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 1nKy7E-0009WK-48 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Feb 2022 08:55:44 +0100 Original-Received: from localhost ([::1]:56274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nKy7B-0000LI-0x for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Feb 2022 02:55:41 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:36094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nKy5a-00080r-9u for bug-gnu-emacs@gnu.org; Fri, 18 Feb 2022 02:54:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59467) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nKy5a-0005HG-0s for bug-gnu-emacs@gnu.org; Fri, 18 Feb 2022 02:54:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nKy5Z-0001vH-Vc for bug-gnu-emacs@gnu.org; Fri, 18 Feb 2022 02:54: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: Fri, 18 Feb 2022 07:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53910 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 53910-submit@debbugs.gnu.org id=B53910.16451707897314 (code B ref 53910); Fri, 18 Feb 2022 07:54:01 +0000 Original-Received: (at 53910) by debbugs.gnu.org; 18 Feb 2022 07:53:09 +0000 Original-Received: from localhost ([127.0.0.1]:53361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nKy4i-0001tu-MS for submit@debbugs.gnu.org; Fri, 18 Feb 2022 02:53:08 -0500 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]:54399) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nKy4g-0001tO-GF for 53910@debbugs.gnu.org; Fri, 18 Feb 2022 02:53:07 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 71DB9C000E; Fri, 18 Feb 2022 07:52:55 +0000 (UTC) In-Reply-To: (Stefan Monnier's message of "Thu, 17 Feb 2022 15:12:36 -0500") 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:227141 Archived-At: >>>> (defvar context-menu-entry >>>> `(menu-item ,(purecopy "Context Menu") ,(make-sparse-keymap) >>>> - :filter ,(lambda (_) (context-menu-map))) >>>> + :filter ,(lambda (_) (unless help-buffer-under-preparation >>>> + ;; No need to build menu to describe keys >>>> + (context-menu-map)))) >>>> "Menu item that creates the context menu and can be bound to a mouse key.") >>> FWIW, I find this hideous. `mouse.el` should not depend on `help-*` variables. >> I know, but there are too many problems when help functions are trying >> to build the context menu in a non-displayed buffer. > > Those are bugs in the context-menu functions that need to be fixed > because they'll bite us sooner or later in other cases anyway. > In a sense, we should be happy to have such an easy way to trigger those > bugs ;-) If `context-menu-mode` is intended to work only on displayed buffers, is it really important to ensure that it also doesn't fail on non-window buffers? I think the bug is in these functions that are trying to call `context-menu-map` in a non-window buffer, in this case the bug in the Help functions. Then indeed instead of using `help-buffer-under-preparation` in `mouse.el`, maybe it should be fixed in `describe-map` somehow to not call `lookup-key` that creates the context menu with: (eq definition (lookup-key tail (vector event) t)) >> Is there another way to prevent this? > > I think a slightly cleaner way (if you want to keep such a workaround > rather than chase&fix the underlying bugs) is to move the var to > `mouse.el` and call it `inhibit-context-menu`, and then let-bind at the > appropriate place with a prominent comment explaining why we're using > such a hack. Then this means using something like this in `describe-map`: (let ((inhibit-context-menu t)) (eq definition (lookup-key tail (vector event) t))) But indeed, this looks like a workaround.