unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Juri Linkov <juri@linkov.net>
Cc: 9923@debbugs.gnu.org, Lars Ingebrigtsen <larsi@gnus.org>
Subject: 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	[thread overview]
Message-ID: <jwvlf0xua69.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <8635n613xt.fsf@mail.linkov.net> (Juri Linkov's message of "Mon,  06 Dec 2021 11:28:30 +0200")

>> 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.")
 






  reply	other threads:[~2021-12-06 13:50 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-31 20:26 bug#9923: 24.0.91; `where-is' does not find recentf menu items (cmds, not files) Drew Adams
2011-11-01 16:05 ` Stefan Monnier
2012-09-17  0:25   ` Drew Adams
2021-08-25 12:18   ` Lars Ingebrigtsen
2021-08-25 14:49     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-26 13:42       ` Lars Ingebrigtsen
2021-08-26 17:44         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-29 16:48         ` Juri Linkov
2021-08-29 18:46           ` Lars Ingebrigtsen
2021-08-30  7:33             ` Juri Linkov
2021-08-31  0:03               ` Lars Ingebrigtsen
2021-08-31  6:41                 ` Juri Linkov
2021-08-31  8:36                   ` Lars Ingebrigtsen
2021-08-31 18:44                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-30  6:55                       ` Juri Linkov
2021-09-30 12:43                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-03 17:54                           ` Juri Linkov
2021-10-03 18:36                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-03 18:53                               ` Juri Linkov
2021-10-03 19:26                                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-05 18:04           ` Juri Linkov
2021-12-05 20:48             ` Lars Ingebrigtsen
2021-12-05 23:13             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-06  9:28               ` Juri Linkov
2021-12-06 13:50                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-12-06 17:24                   ` Juri Linkov
2021-12-06 19:01                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-08 20:32                       ` Juri Linkov
2022-12-15 18:28                   ` Juri Linkov
2022-12-15 18:45                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-15 18:51                       ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvlf0xua69.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=9923@debbugs.gnu.org \
    --cc=juri@linkov.net \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).