GNU bug report logs - #9923
24.0.91; `where-is' does not find recentf menu items (cmds, not files)

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Mon, 31 Oct 2011 20:30:02 UTC

Severity: minor

Tags: confirmed

Found in versions 24.0.91, 25.2

Full log


Message #81 received at 9923 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juri Linkov <juri <at> linkov.net>
Cc: 9923 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: Re: bug#9923: 24.0.91; `where-is' does not find recentf menu items
 (cmds, not files)
Date: Mon, 06 Dec 2021 08:50:49 -0500
>> I think it would be more "obviously correct" if we switched to
>> (window-buffer (posn-window (event-end click))) instead.
>>
>>>    ;; Include text-mode select menu only in strings and comments.
>>> -  (when (nth 8 (save-excursion (syntax-ppss (posn-point (event-end click)))))
>>> +  (when (nth 8 (save-excursion
>>> +                 (with-current-buffer (window-buffer)
>>> +                   (syntax-ppss (posn-point (event-end click))))))
>>
>> Same here.
>
> Will do this if a simpler solution below is not suitable.

I think the hunk above (and the one before that) is a good change
regardless of this specific bug: it doesn't make sense to use
`posn-point` without making sure we're in (window-buffer (posn-window ...)).

> The problem is that `describe-mode` calls `context-menu-map`
> that it should not do:
>
>   context-menu-map()
>   (lambda (_) (context-menu-map))(ignore)
>   where-is-internal(ignore nil t)

AFAIK that's because an event is bound to a `menu-item` whose `:filter`
is the lambda above, used to dynamically generate the keymap, so
`where-is-internal` runs the filter to try and see if `ignore` is bound
in the dynamically-generated map.

> `context-menu-map' is bound to `ignore',

Is it?

> so ignoring `ignore' will prevent calling it from
> help-fns--list-local-commands.

Hmm... taking a second look at the `mouse.el` file, I think the problem
is rather than the menu-item has an nominal/default/static binding of
`ignore`.  So I guess the `:filter` isn't run to try and look for
`ignore` in the dynamically-generated map but instead it's run later
(when `where-is-internal` checks that the binding it found is real).

So maybe another way to avoid running the filter is with the
patch below.


        Stefan


diff --git a/lisp/mouse.el b/lisp/mouse.el
index 5c645a4b895..9e902ca25e0 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -513,7 +513,7 @@ context-menu-ffap
   menu)
 
 (defvar context-menu-entry
-  `(menu-item ,(purecopy "Context Menu") ignore
+  `(menu-item ,(purecopy "Context Menu") ,(make-sparse-keymap)
               :filter (lambda (_) (context-menu-map)))
   "Menu item that creates the context menu and can be bound to a mouse key.")
 





This bug report was last modified 91 days ago.

Previous Next


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