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#53910: [External] : bug#53910: 29.0.50; context-menu-mode breaks help in read-only buffers Date: Thu, 17 Feb 2022 15:12:36 -0500 Message-ID: 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> 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="19760"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: martin rudalics , Lars Ingebrigtsen , Ergus , Drew Adams , "53910@debbugs.gnu.org" <53910@debbugs.gnu.org> To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 17 21:13:35 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 1nKn9i-0004wx-Mb for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 17 Feb 2022 21:13:34 +0100 Original-Received: from localhost ([::1]:49416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nKn9h-0003BP-7o for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 17 Feb 2022 15:13:33 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:37798) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nKn9C-000396-NB for bug-gnu-emacs@gnu.org; Thu, 17 Feb 2022 15:13:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58836) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nKn9C-0004JZ-Dw for bug-gnu-emacs@gnu.org; Thu, 17 Feb 2022 15:13:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nKn9C-0002XY-6q for bug-gnu-emacs@gnu.org; Thu, 17 Feb 2022 15:13:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 Feb 2022 20:13:02 +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.16451287689743 (code B ref 53910); Thu, 17 Feb 2022 20:13:02 +0000 Original-Received: (at 53910) by debbugs.gnu.org; 17 Feb 2022 20:12:48 +0000 Original-Received: from localhost ([127.0.0.1]:52733 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nKn8y-0002X5-Fn for submit@debbugs.gnu.org; Thu, 17 Feb 2022 15:12:48 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:7108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nKn8v-0002Wq-Fd for 53910@debbugs.gnu.org; Thu, 17 Feb 2022 15:12:47 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 560884424B9; Thu, 17 Feb 2022 15:12:39 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id C26734424B2; Thu, 17 Feb 2022 15:12:37 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1645128757; bh=pcdJAsR3LjAWS3x55XYGzTIInJNO4bKaaESQtGHKz2Q=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=RRS2CQjrSqW5tisU5s/hoOspuI2AYPnlz0ZyzMjxC18eLBYdNrYghBHRnTG6Rh+FR Ua7PGP3PzfiI1rXzYBFZSr3xwCvZbBO+brZtV2GhBjzaVAn7MV/ySVK825+HIGW5k8 in0aXvEgLXKowfRQFQWj1BudWMbWmVc4uwz/eu8qBU4V2zaArT9VOBXSBHLvCG+QCL fAWaPl2c1zrQb7FT2ADPujlP28RK0D9NJfBvuX4ugVqcjouY0xogKmeLo/+SWs7FuZ akntJ6CGOopnVcyMIdSkzpFtRj0wZMOQYlzFgkYy8WPnbcVCAd5tvT51y2scoM2T8U bIgXJmdCjjQVA== Original-Received: from pastel (unknown [45.72.237.157]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 831EF12023D; Thu, 17 Feb 2022 15:12:37 -0500 (EST) In-Reply-To: <868ru9jnp6.fsf@mail.linkov.net> (Juri Linkov's message of "Thu, 17 Feb 2022 21:30:13 +0200") 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:227115 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 ;-) > 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. > Maybe (kill-buffer (window-buffer )) has the same effect > when used in any window, but (bury-buffer (window-buffer )) > definitely should be called in the required window, Indeed, there are several function that need the right `selected-window` and where you can't pass an explicit window instead, and `bury-buffer` is one of them. Stefan