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: Thu, 26 Aug 2021 13:44:24 -0400 Message-ID: References: <76FA3F83D086455EAA01FF0FB000FCDB@us.oracle.com> <871r6hk99k.fsf@gnus.org> <87bl5k2ug1.fsf@gnus.org> 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="6070"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 9923@debbugs.gnu.org, Drew Adams To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 26 20:14:29 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 1mJJtV-0001OH-6W for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 Aug 2021 20:14:29 +0200 Original-Received: from localhost ([::1]:38074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mJJtT-0004Zt-Ua for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 Aug 2021 14:14:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJJR0-00060C-Uf for bug-gnu-emacs@gnu.org; Thu, 26 Aug 2021 13:45:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38826) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mJJR0-0002Ui-Jo for bug-gnu-emacs@gnu.org; Thu, 26 Aug 2021 13:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mJJR0-0001XK-Ew for bug-gnu-emacs@gnu.org; Thu, 26 Aug 2021 13:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Aug 2021 17:45: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.16299998765857 (code B ref 9923); Thu, 26 Aug 2021 17:45:02 +0000 Original-Received: (at 9923) by debbugs.gnu.org; 26 Aug 2021 17:44:36 +0000 Original-Received: from localhost ([127.0.0.1]:50372 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mJJQa-0001WP-Bo for submit@debbugs.gnu.org; Thu, 26 Aug 2021 13:44:36 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:62757) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mJJQX-0001W9-QA for 9923@debbugs.gnu.org; Thu, 26 Aug 2021 13:44:34 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 55F9780855; Thu, 26 Aug 2021 13:44:27 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id C7BB980695; Thu, 26 Aug 2021 13:44:25 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1629999865; bh=vHmvO1ImeKl+Z7y66urCf/VnSMNek1y2oz/qWlrsCIQ=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=YwMgNb4C+wwam6y3UrYBWNKpFG+sHoLJFJp14TKr88PBYWY+3N/nqaBpRCfu/4TqI xESyFetY/JwhwZcNpBZoU6IYhhUXqBQACt6Fa/jLToKl0ekupqUe6nh9P5sddpYZlf Tv6AT4WRoyjVgrETUNnT4c+o+0jatLRKi1r5b3iwGXIxyLD9ycUW3BA7Qud8oLV74c G2H0onyg75ufPKePjVimDQzRjoeh4Iy701aiBE52/ESop5ybDsitXzHYk6vzry7Ys7 EJWZVoKNiS1zYRO5TAkUS0w316u/DXujh1vh6j8ZhcPqFEPZwNr+avSCKeA2/fq7B4 IAXV24XJ9geBQ== Original-Received: from alfajor (unknown [104.247.244.135]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8B54012041E; Thu, 26 Aug 2021 13:44:25 -0400 (EDT) In-Reply-To: <87bl5k2ug1.fsf@gnus.org> (Lars Ingebrigtsen's message of "Thu, 26 Aug 2021 15:42:54 +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:212752 Archived-At: Lars Ingebrigtsen [2021-08-26 15:42:54] wrote: > Stefan Monnier writes: >> So IIRC `where-is` instead uses the "unfiltered" binding. So you can >> often get what you want by being careful about the BINDING you put into >> `(menu-item "foo" BINDING :filter ...). > > Hm... but in this case, the filter returns all the items: > > (easy-menu-add-item > (recentf-menu-bar) recentf-menu-path > (list recentf-menu-title :filter 'recentf-make-menu-items) > recentf-menu-before))) I think the problem is that it's not the same filter: there's the `:filter` above which is part of the easymenu syntax and there the `:filter` in the `menu-item` syntax. Easymenu does indeed use the menu-item-:filter to implement the easymenu-:filter but IIRC easymenu uses a menu item of the form (menu-item TITLE MENU :filter ...) where MENU is the actual menu in its original easymenu-syntax form (aka XEmacs syntax), and it's converted to the keymap-syntax by the :filter. That would explain why `where-is` can't find any commands in MENU since `where-is` expects it to use a keymap-syntax rather than an easymenu-syntax. The relevant code is in `easy-menu-create-menu`: (pcase keyword (:filter (setq filter (lambda (menu) (easy-menu-filter-return (funcall arg menu) menu-name)))) as well as: ;; The filter expects the menu in its XEmacs form and the ;; pre-filter form will only be passed to the filter ;; anyway, so we'd better not convert it at all (it will ;; be converted on the fly by easy-menu-filter-return). menu-items (append menu (mapcar #'easy-menu-convert-item menu-items)))) So maybe the comment is wrong (I can't vouch for the guy who wrote it anyway), and we should put the pre-converted menu in there, and then the filter function should simply ignore its `menu` argument and use the `menu-items` instead (or something like that). Such a change could break something somewhere, tho: AFAICT currently, just like the menu-item-:filter, the easymenu-:filter doesn't have to be accompanied with a "menu" in proper syntax but it is required only to return a menu in proper syntax, so the format of `menu-items` is actually private to the :filter (tho in practice it's usually a valid menu). Stefan