GNU bug report logs - #53910
29.0.50; context-menu-mode breaks help in read-only buffers

Previous Next

Package: emacs;

Reported by: Ergus <spacibba <at> aol.com>

Date: Thu, 10 Feb 2022 00:17:01 UTC

Severity: normal

Tags: confirmed

Fixed in version 29.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: martin rudalics <rudalics <at> gmx.at>, Lars Ingebrigtsen <larsi <at> gnus.org>, Ergus <spacibba <at> aol.com>, Drew Adams <drew.adams <at> oracle.com>, "53910 <at> debbugs.gnu.org" <53910 <at> debbugs.gnu.org>
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
>>>>  (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.




This bug report was last modified 3 years and 149 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.