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#9923: 24.0.91; `where-is' does not find recentf menu items (cmds, not files) Date: Mon, 06 Dec 2021 08:50:49 -0500 Message-ID: References: <76FA3F83D086455EAA01FF0FB000FCDB@us.oracle.com> <871r6hk99k.fsf@gnus.org> <87bl5k2ug1.fsf@gnus.org> <87czpwb4gw.fsf@mail.linkov.net> <8635n753o3.fsf@mail.linkov.net> <8635n613xt.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="38909"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 9923@debbugs.gnu.org, Lars Ingebrigtsen To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 06 14:55:28 2021 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 1muESk-0009nF-N9 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 06 Dec 2021 14:55:26 +0100 Original-Received: from localhost ([::1]:46362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1muESj-00075S-Ct for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 06 Dec 2021 08:55:25 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:41272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1muEPW-0002Pe-35 for bug-gnu-emacs@gnu.org; Mon, 06 Dec 2021 08:52:07 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49325) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1muEPS-0008Ur-Kw for bug-gnu-emacs@gnu.org; Mon, 06 Dec 2021 08:52:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1muEPS-0002pK-BC for bug-gnu-emacs@gnu.org; Mon, 06 Dec 2021 08:52: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: Mon, 06 Dec 2021 13:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9923 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 9923-submit@debbugs.gnu.org id=B9923.163879867710806 (code B ref 9923); Mon, 06 Dec 2021 13:52:02 +0000 Original-Received: (at 9923) by debbugs.gnu.org; 6 Dec 2021 13:51:17 +0000 Original-Received: from localhost ([127.0.0.1]:60871 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1muEOi-0002oE-MB for submit@debbugs.gnu.org; Mon, 06 Dec 2021 08:51:16 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:29134) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1muEOg-0002o1-Iq for 9923@debbugs.gnu.org; Mon, 06 Dec 2021 08:51:15 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 39196805B1; Mon, 6 Dec 2021 08:51:08 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 9B57180470; Mon, 6 Dec 2021 08:51:06 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1638798666; bh=trjow9SeOPMrJK/8S8kbC0AkEAoomyIaFdkvlBiCCX0=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=dnCrfEB53LN7LN/7U8UPLy9Uqph4M8zwVNO93jqELuvypUu0LyOY3fw1JamJkUseP UJXpR7CVjBQn/KjnXOtIrYeqntoUYzYmFMNRrj/XnDGlAGLXEKCyFVX0qO3UU3xc0J 8rls1UaewQWI8T6tdGpdyCbWMbx8VCNYccU5UUujbLA4fg0U4uLr0O6BBis8LzcBpG F0raRn1TUZfbGMZNgCqhlWgEiQAPNpocvdQ8zn3K16kypDw+OCmy2ftM0JtHLqtRHX bBH+cE/wBXu7P/E/6RlyNP/lB7SVGHog3GM2zak4F2Z7pqvW64Y4WYrnnrfF+i+JYT KYSI2hXvTfj9g== Original-Received: from ceviche (unknown [216.154.30.173]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6BB2612044C; Mon, 6 Dec 2021 08:51:06 -0500 (EST) In-Reply-To: <8635n613xt.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 06 Dec 2021 11:28:30 +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:221748 Archived-At: >> 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.")