From unknown Wed Jun 25 00:27:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14029: 24.2.50; [PATCH] imenu problems with special elements Resent-From: Andreas Politz Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 22 Mar 2013 01:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14029 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 14029@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.136391561618061 (code B ref -1); Fri, 22 Mar 2013 01:27:02 +0000 Received: (at submit) by debbugs.gnu.org; 22 Mar 2013 01:26:56 +0000 Received: from localhost ([127.0.0.1]:39652 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UIqkw-0004hF-Or for submit@debbugs.gnu.org; Thu, 21 Mar 2013 21:26:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34588) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UIqkt-0004h6-SL for submit@debbugs.gnu.org; Thu, 21 Mar 2013 21:26:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIqj1-0005UU-Hs for submit@debbugs.gnu.org; Thu, 21 Mar 2013 21:24:58 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:33947) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIqj1-0005UQ-F7 for submit@debbugs.gnu.org; Thu, 21 Mar 2013 21:24:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIqiy-0006RX-Jj for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2013 21:24:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIqiv-0005T1-VA for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2013 21:24:52 -0400 Received: from gateway-a.fh-trier.de ([143.93.54.181]:54740) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIqiv-0005Sn-JQ for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2013 21:24:49 -0400 X-Virus-Scanned: by Amavisd-new + McAfee uvscan + ClamAV [Rechenzentrum Hochschule Trier] Received: from luca (dslb-088-068-070-155.pools.arcor-ip.net [88.68.70.155]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: politza) by gateway-a.fh-trier.de (Postfix) with ESMTPSA id E1644175CA07 for ; Fri, 22 Mar 2013 02:24:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=simple/simple; d=fh-trier.de; s=default; t=1363915474; bh=dRE7QkYGFxMx/ePcfTmflwH2d0w=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=R1TVnp1AeRv5k0rJSZOSai2c3rZ3Ba1tndzqqba8K/YqBchByOirpEFVh/6ZLORvj VZyps1WuRtM1f3B+WQ5efZzq5NOIEoXztJaZUXoPNQ04V9q3LTV4gr2UdcChteCHHh 23/CIo8oOUFaF2X2AndVfylrc9F9Hq51DGCM/G3o= Received: from localhost ([127.0.0.1] helo=luca) by luca with esmtp (Exim 4.72) (envelope-from ) id 1UIqif-0008I3-5a for bug-gnu-emacs@gnu.org; Fri, 22 Mar 2013 02:24:33 +0100 From: Andreas Politz Date: Fri, 22 Mar 2013 02:24:33 +0100 Message-ID: <87hak4gram.fsf@fh-trier.de> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -3.5 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.2 (------) ,----[ (info "(elisp) Imenu") ] | Special elements look like this: | | (INDEX-NAME INDEX-POSITION FUNCTION ARGUMENTS...) | | Selecting a special element performs: | | (funcall FUNCTION | INDEX-NAME INDEX-POSITION ARGUMENTS...) `---- 1. At least one function does not recognize these elements, resulting in an error. 2. The advertised calling convention is different from the actual one in `imenu'. 3. The `imenu--subalist-p' predicate is unsafe and incomplete. Andreas diff -c -L /home/politza/src/emacs/trunk/lisp/imenu.el -L \#\ /home/politza/src/emacs/trunk/lisp/imenu.el /tmp/buffer-content-3095O-q *** /home/politza/src/emacs/trunk/lisp/imenu.el --- # *************** *** 286,293 **** (defun imenu--subalist-p (item) ! (and (consp (cdr item)) (listp (cadr item)) ! (not (eq (car (cadr item)) 'lambda)))) (defmacro imenu-progress-message (_prevpos &optional _relpos _reverse) "Macro to display a progress message. --- 286,295 ---- (defun imenu--subalist-p (item) ! (and (consp item) ! (consp (cdr item)) ! (listp (cadr item)) ! (not (functionp (cadr item))))) (defmacro imenu-progress-message (_prevpos &optional _relpos _reverse) "Macro to display a progress message. *************** *** 641,647 **** ;; We are only interested in the bottom-level elements, so we need to ;; recurse if TAIL is a list. (cond ((listp tail) ! (if (setq res (imenu--in-alist str tail)) (setq alist nil))) ((if imenu-name-lookup-function (funcall imenu-name-lookup-function str head) --- 643,650 ---- ;; We are only interested in the bottom-level elements, so we need to ;; recurse if TAIL is a list. (cond ((listp tail) ! (if (and (imenu--subalist-p elt) ! (setq res (imenu--in-alist str tail))) (setq alist nil))) ((if imenu-name-lookup-function (funcall imenu-name-lookup-function str head) *************** *** 1024,1030 **** (nth 2 index-item) imenu-default-goto-function)) (position (if is-special-item (cadr index-item) (cdr index-item))) ! (rest (if is-special-item (cddr index-item)))) (apply function (car index-item) position rest)) (run-hooks 'imenu-after-jump-hook))) --- 1027,1033 ---- (nth 2 index-item) imenu-default-goto-function)) (position (if is-special-item (cadr index-item) (cdr index-item))) ! (rest (if is-special-item (cdddr index-item)))) (apply function (car index-item) position rest)) (run-hooks 'imenu-after-jump-hook))) Diff finished. Fri Mar 22 02:15:09 2013 From unknown Wed Jun 25 00:27:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14029: 24.2.50; [PATCH] imenu problems with special elements Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 22 Mar 2013 05:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14029 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: "'Andreas Politz'" , <14029@debbugs.gnu.org> Received: via spool by 14029-submit@debbugs.gnu.org id=B14029.136392928010003 (code B ref 14029); Fri, 22 Mar 2013 05:15:02 +0000 Received: (at 14029) by debbugs.gnu.org; 22 Mar 2013 05:14:40 +0000 Received: from localhost ([127.0.0.1]:39853 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UIuJL-0002bI-EH for submit@debbugs.gnu.org; Fri, 22 Mar 2013 01:14:39 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:23821) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UIuJI-0002b8-0t for 14029@debbugs.gnu.org; Fri, 22 Mar 2013 01:14:37 -0400 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r2M5Cd3R031070 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 22 Mar 2013 05:12:40 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r2M5CcNp020204 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 22 Mar 2013 05:12:39 GMT Received: from abhmt107.oracle.com (abhmt107.oracle.com [141.146.116.59]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r2M5Cce3008393; Fri, 22 Mar 2013 00:12:38 -0500 Received: from dradamslap1 (/10.159.248.227) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 21 Mar 2013 22:12:37 -0700 From: "Drew Adams" References: <87hak4gram.fsf@fh-trier.de> Date: Thu, 21 Mar 2013 22:12:34 -0700 Message-ID: <5ABDF35DFCF64DEEAA37AFAE5048578D@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87hak4gram.fsf@fh-trier.de> Thread-Index: Ac4mnB1hVV/+YU70SkCJcJk1Vz3ahwAGQBng X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.7 (------) Thanks for this report and fix. Neither the original code nor your patch is super clear to me, so I have some (non-rhetorical) questions below. But if someone else understands this better, feel free to ignore. > | Special elements look like this: > | (INDEX-NAME INDEX-POSITION FUNCTION ARGUMENTS...) > | Selecting a special element performs: > | (funcall FUNCTION > | INDEX-NAME INDEX-POSITION ARGUMENTS...) > > 1. At least one function does not recognize these elements, resulting > in an error. Can you be more specific? Which function? What error? Recipe to reproduce? (Maybe you are referring to the last change in your patch, for `imenu'?) > 2. The advertised calling convention is different from the > actual one in `imenu'. How so? What difference do you see, where? > 3. The `imenu--subalist-p' predicate is unsafe and incomplete. How so? > (defun imenu--subalist-p (item) > ! (and (consp (cdr item)) (listp (cadr item)) (defun imenu--subalist-p (item) > ! (and (consp item) > ! (consp (cdr item)) > ! (listp (cadr item)) (consp (cdr item)) is equivalent to (and (consp item) (consp (cdr item))), assuming ITEM has the proper form (so that cdr does not raise an error). (consp (cdr-safe item)) should do the same thing. > ! (not (eq (car (cadr item)) 'lambda)))) > ! (not (functionp (cadr item))))) Is it possible for (cadr item) to be a list and also be `functionp' and yet not have its car be `lambda'? Dunno. I was under the impression that it was impossible, but I could be wrong. If it is possible, is it better to test `functionp' here? Dunno. > ! (if (setq res (imenu--in-alist str tail)) > ! (if (and (imenu--subalist-p elt) > ! (setq res (imenu--in-alist str tail))) Why is (imenu--subalist-p elt) needed here? What error case does it prevent? Can't the code assume a properly constructed menu here, so that if TAIL is a list then it is a bottom-level element, and so it is proper to just set ALIST to nil? > ! (rest (if is-special-item (cddr index-item)))) > ! (rest (if is-special-item (cdddr index-item)))) This change looks good, but `cdddr' is in cl.el, so perhaps it is better to use (nthcdr 3 index-item). I'm only a little bit surprised that this one hasn't already been reported and fixed - there have been other bugs (e.g. #12717) related to special items. I use special items myself, but so far I have not used non-nil ARGS, so I have not encountered this one (your last change). From unknown Wed Jun 25 00:27:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14029: 24.2.50; [PATCH] imenu problems with special elements Resent-From: Andreas Politz Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Mar 2013 15:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14029 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 14029@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.136405425126394 (code B ref -1); Sat, 23 Mar 2013 15:58:01 +0000 Received: (at submit) by debbugs.gnu.org; 23 Mar 2013 15:57:31 +0000 Received: from localhost ([127.0.0.1]:42377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UJQp0-0006rc-NE for submit@debbugs.gnu.org; Sat, 23 Mar 2013 11:57:31 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37335) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UJQox-0006rQ-SJ for submit@debbugs.gnu.org; Sat, 23 Mar 2013 11:57:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UJQmw-0001Q3-FB for submit@debbugs.gnu.org; Sat, 23 Mar 2013 11:55:25 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:60714) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJQmw-0001Pz-BT for submit@debbugs.gnu.org; Sat, 23 Mar 2013 11:55:22 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJQmt-0006JX-9q for bug-gnu-emacs@gnu.org; Sat, 23 Mar 2013 11:55:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UJQmq-0001Oz-3O for bug-gnu-emacs@gnu.org; Sat, 23 Mar 2013 11:55:19 -0400 Received: from gateway-b.fh-trier.de ([143.93.54.182]:44608) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJQmp-0001OD-Nj for bug-gnu-emacs@gnu.org; Sat, 23 Mar 2013 11:55:16 -0400 X-Virus-Scanned: by Amavisd-new + McAfee uvscan + ClamAV [Rechenzentrum Hochschule Trier] Received: from luca (dslb-088-068-069-031.pools.arcor-ip.net [88.68.69.31]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: politza) by gateway-b.fh-trier.de (Postfix) with ESMTPSA id BA75D17B422 for ; Sat, 23 Mar 2013 16:54:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=simple/simple; d=fh-trier.de; s=default; t=1364054099; bh=lD0KvptJyltjwSizXhdlGKGmY48=; h=From:To:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type; b=IvDmQqhdHQCtwcAKqBdwiPpmeA6ZqMNtzH6fpt9ha2mg6XuuFvlemnQQN8lpANfJB 8wjj1FBGE/Z/0y2bnZqJACBJdUSAZrv6FEgERi9yChkxTZHmlDnQzUNGAsP+NdcLJI CWlRdZKnjm1lhrBAZfJ62X414rfdTwH2E9Lck5Bk= Received: from localhost ([127.0.0.1] helo=luca) by luca with esmtp (Exim 4.72) (envelope-from ) id 1UJQmY-0005CD-Dh for bug-gnu-emacs@gnu.org; Sat, 23 Mar 2013 16:54:58 +0100 From: Andreas Politz References: <87hak4gram.fsf@fh-trier.de> <5ABDF35DFCF64DEEAA37AFAE5048578D@us.oracle.com> <87ip4iwfoe.fsf@fh-trier.de> Date: Sat, 23 Mar 2013 16:54:58 +0100 In-Reply-To: <87ip4iwfoe.fsf@fh-trier.de> (Andreas Politz's message of "Sat, 23 Mar 2013 11:53:21 +0100") Message-ID: <878v5ew1pp.fsf@fh-trier.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.2 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.2 (------) Andreas Politz writes: > "Drew Adams" writes: > >> Thanks for this report and fix. Neither the original code nor your patch is >> super clear to me, so I have some (non-rhetorical) questions below. But if >> someone else understands this better, feel free to ignore. >> >>> | Special elements look like this: >>> | (INDEX-NAME INDEX-POSITION FUNCTION ARGUMENTS...) >>> | Selecting a special element performs: >>> | (funcall FUNCTION >>> | INDEX-NAME INDEX-POSITION ARGUMENTS...) >>> >>> 1. At least one function does not recognize these elements, resulting >>> in an error. >> >> Can you be more specific? Which function? What error? Recipe to reproduce? >> (Maybe you are referring to the last change in your patch, for `imenu'?) > > Yes in `imenu--in-alist'. It used to be >1, but one is already fixed in > bzr. > >> >>> 2. The advertised calling convention is different from the >>> actual one in `imenu'. >> >> How so? What difference do you see, where? >> > > The last change in `imenu' about cdddr. > >>> 3. The `imenu--subalist-p' predicate is unsafe and incomplete. >> >> How so? >> > >>> (defun imenu--subalist-p (item) >>> ! (and (consp (cdr item)) (listp (cadr item)) >> >> (defun imenu--subalist-p (item) >>> ! (and (consp item) >>> ! (consp (cdr item)) >>> ! (listp (cadr item)) >> >> (consp (cdr item)) is equivalent to >> (and (consp item) (consp (cdr item))), assuming ITEM has the proper form (so >> that cdr does not raise an error). (consp (cdr-safe item)) should do the same >> thing. > > That's right. > >> >>> ! (not (eq (car (cadr item)) 'lambda)))) >> >>> ! (not (functionp (cadr item))))) >> >> Is it possible for (cadr item) to be a list and also be `functionp' and yet not >> have its car be `lambda'? Dunno. I was under the impression that it was >> impossible, but I could be wrong. If it is possible, is it better to test >> `functionp' here? Dunno. > > If the documentation states FUNCTION, then it should be a function. > > Let's recap. The three types are: > > (INDEX-NAME . INDEX-POSITION) > (INDEX-NAME INDEX-POSITION FUNCTION ARGUMENTS...) > (MENU-TITLE SUB-ALIST) > > First, I think the documentation is incorrect, and the last one should read > > (MENU-TITLE . SUB-ALIST) > > since SUB-ALIST is supposed to be the cdr of the list (see > e.g. imenu--split-submenus) > > So (listp (cdr item)) would exclude the first type and we are > left with > > (INDEX-POSITION FUNCTION ARGUMENTS...) and > SUB-ALIST = (ITEM ITEM ...) > > and (cadr item) is either a function, an item or nil. I think > that INDEX-NAME and MENU-TITLE (the car of a possible item) are > supposed to be strings, so this should work. > > >> >>> ! (if (setq res (imenu--in-alist str tail)) >> >>> ! (if (and (imenu--subalist-p elt) >>> ! (setq res (imenu--in-alist str tail))) >> >> Why is (imenu--subalist-p elt) needed here? What error case does it prevent? >> >> Can't the code assume a properly constructed menu here, so that if TAIL is a >> list then it is a bottom-level element, and so it is proper to just set ALIST to >> nil? >> > > No, it may contain subalists. > >>> ! (rest (if is-special-item (cddr index-item)))) >> >>> ! (rest (if is-special-item (cdddr index-item)))) >> >> This change looks good, but `cdddr' is in cl.el, so perhaps it is better to use >> (nthcdr 3 index-item). >> >> I'm only a little bit surprised that this one hasn't already been reported and >> fixed - there have been other bugs (e.g. #12717) related to special items. I >> use special items myself, but so far I have not used non-nil ARGS, so I have not >> encountered this one (your last change). > > That, and you probably always used the mouse menu. > > A From unknown Wed Jun 25 00:27:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14029: 24.2.50; [PATCH] imenu problems with special elements Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Mar 2013 16:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14029 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: "'Andreas Politz'" , <14029@debbugs.gnu.org> Received: via spool by 14029-submit@debbugs.gnu.org id=B14029.136405543728262 (code B ref 14029); Sat, 23 Mar 2013 16:18:01 +0000 Received: (at 14029) by debbugs.gnu.org; 23 Mar 2013 16:17:17 +0000 Received: from localhost ([127.0.0.1]:42409 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UJR89-0007Lm-0T for submit@debbugs.gnu.org; Sat, 23 Mar 2013 12:17:17 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:18904) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UJR86-0007Ld-1U for 14029@debbugs.gnu.org; Sat, 23 Mar 2013 12:17:15 -0400 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r2NGF93Y010748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 23 Mar 2013 16:15:09 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r2NGF8fx027294 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 23 Mar 2013 16:15:08 GMT Received: from abhmt115.oracle.com (abhmt115.oracle.com [141.146.116.67]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r2NGF8hc016602; Sat, 23 Mar 2013 11:15:08 -0500 Received: from dradamslap1 (/71.202.147.44) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 23 Mar 2013 09:15:08 -0700 From: "Drew Adams" References: <87hak4gram.fsf@fh-trier.de><5ABDF35DFCF64DEEAA37AFAE5048578D@us.oracle.com><87ip4iwfoe.fsf@fh-trier.de> <878v5ew1pp.fsf@fh-trier.de> Date: Sat, 23 Mar 2013 09:15:01 -0700 Message-ID: <497E84080AB04CFCBF0170ED70AC58A7@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 In-Reply-To: <878v5ew1pp.fsf@fh-trier.de> Thread-Index: Ac4n3vGaUJnpGjQ1QeWfDUqpCV6xLwAAMAag X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.7 (------) Ok, thanks for the reply. I don't have time to look into it further - I mainly wanted you to clarify and double-check. Please consider adding some comments to the code to help understanding (e.g. wrt the fixed code). Both Stefan and I have mentioned that the code is not too clear on its own, and I imagine that you feel the same: it could be clearer with a couple of comments. Thx. >> This change looks good, but `cdddr' is in cl.el, so perhaps it is >> better to use (nthcdr 3 index-item). >> >> I'm only a little bit surprised that this one hasn't already been >> reported and fixed - there have been other bugs (e.g. #12717) related >> to special items. I use special items myself, but so far I have not >> used non-nil ARGS, so I have not encountered this one (your last change). > > That, and you probably always used the mouse menu. Actually, I use the keyboard, but my use of special items is limited to adding two special menu items (that toggle sorting and toggle case-sensitive sorting). FWIW, from the keyboard I use the commands described here: http://www.emacswiki.org/emacs/Icicles_-_Other_Search_Commands#IciclesImenu. They let you quickly choose among definitions of a given type, matching either the object name or its full definition. From unknown Wed Jun 25 00:27:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14029: 24.2.50; [PATCH] imenu problems with special elements Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 24 Nov 2013 23:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14029 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Andreas Politz Cc: 14029@debbugs.gnu.org Received: via spool by 14029-submit@debbugs.gnu.org id=B14029.138533720628592 (code B ref 14029); Sun, 24 Nov 2013 23:54:02 +0000 Received: (at 14029) by debbugs.gnu.org; 24 Nov 2013 23:53:26 +0000 Received: from localhost ([127.0.0.1]:42955 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VkjUT-0007R6-Hi for submit@debbugs.gnu.org; Sun, 24 Nov 2013 18:53:26 -0500 Received: from mail-wi0-f181.google.com ([209.85.212.181]:62545) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VkjUR-0007Qs-F0 for 14029@debbugs.gnu.org; Sun, 24 Nov 2013 18:53:24 -0500 Received: by mail-wi0-f181.google.com with SMTP id hq4so3271498wib.14 for <14029@debbugs.gnu.org>; Sun, 24 Nov 2013 15:53:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=K2fXb2BCfH6ADnNBRU81QAJsOqf4tzlCXXuSPn4qbeQ=; b=lzQj0JN5q72edAbm3slpU++Wx6gkdUNXZf/8XcrGyedH1kiyhje7U+TFsC05LLLez+ CcPXQoXotBq2S66zJ6bEN6NDMoMGYoabrbykKFyCFsTjNfjoM7KDAZIWwyBUFLDREDnk x/+LBVNrfWDu/vgkWZ75QHKmr9+VN1nLmfdCtGUseDMbUMYfQIsL/Jcf93SCSH0WSPGS I9mJFC8OA4B7ZNZGDdZba7yjWkBpuM2BcAvCIugNxxEkwZT09wqweh4uL42F4oTtrD9w ZGm5xhdNXCF2G/nLteiOegS0MYNwtFhm4fl1RiU1OUKVtbqli2849OIRrz59NHlUxxIX gKeA== X-Received: by 10.180.75.46 with SMTP id z14mr11168836wiv.58.1385337197433; Sun, 24 Nov 2013 15:53:17 -0800 (PST) Received: from axl ([93.109.200.157]) by mx.google.com with ESMTPSA id g16sm1438425wiw.6.2013.11.24.15.53.14 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 24 Nov 2013 15:53:15 -0800 (PST) From: Dmitry Gutov References: <87hak4gram.fsf@fh-trier.de> <5ABDF35DFCF64DEEAA37AFAE5048578D@us.oracle.com> <87ip4iwfoe.fsf@fh-trier.de> <878v5ew1pp.fsf@fh-trier.de> Date: Mon, 25 Nov 2013 01:53:09 +0200 In-Reply-To: <878v5ew1pp.fsf@fh-trier.de> (Andreas Politz's message of "Sat, 23 Mar 2013 16:54:58 +0100") Message-ID: <87iovhqrve.fsf@yandex.ru> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Hi there, Andreas Politz writes: >> Let's recap. The three types are: >> >> (INDEX-NAME . INDEX-POSITION) >> (INDEX-NAME INDEX-POSITION FUNCTION ARGUMENTS...) >> (MENU-TITLE SUB-ALIST) >> >> First, I think the documentation is incorrect, and the last one should read >> >> (MENU-TITLE . SUB-ALIST) >> >> since SUB-ALIST is supposed to be the cdr of the list (see >> e.g. imenu--split-submenus) Is this documentation fix supposed to be included in the patch? I only see source code changes in it. Aside from that, you should consider including a proper ChangeLog entry in the patch (with detailed descriptions, as is the custom). Without it and a reproduction recipe, I'm having hard time understanding what change does what, too. The patchy description in email replies doesn't really cut it. Also note that your last reply is one huge quote. From unknown Wed Jun 25 00:27:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14029: 24.2.50; [PATCH] imenu problems with special elements Resent-From: Andreas Politz Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 25 Nov 2013 01:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14029 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Dmitry Gutov Cc: 14029@debbugs.gnu.org Received: via spool by 14029-submit@debbugs.gnu.org id=B14029.13853431809694 (code B ref 14029); Mon, 25 Nov 2013 01:33:02 +0000 Received: (at 14029) by debbugs.gnu.org; 25 Nov 2013 01:33:00 +0000 Received: from localhost ([127.0.0.1]:43082 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vkl2p-0002WH-C8 for submit@debbugs.gnu.org; Sun, 24 Nov 2013 20:33:00 -0500 Received: from gateway-a.fh-trier.de ([143.93.54.181]:54341) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vkl2l-0002Vz-NS for 14029@debbugs.gnu.org; Sun, 24 Nov 2013 20:32:57 -0500 X-Virus-Scanned: by Amavisd-new + McAfee uvscan + ClamAV [Rechenzentrum Hochschule Trier] Received: from luca (dslb-178-004-033-213.pools.arcor-ip.net [178.4.33.213]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: politza) by gateway-a.fh-trier.de (Postfix) with ESMTPSA id AED971788D49; Mon, 25 Nov 2013 02:32:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=simple/simple; d=hochschule-trier.de; s=default; t=1385343154; bh=ATf8pXWp9VR+REGfU3kaSNqbghM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type; b=pA834ETZb0raVEP14hfuL6P6iCyrxFfsAoHnLggA0sI3thcNBbdtnM7nAsgX5xcLV H8I00F37aY0Wh4hHpmxQy0ns9qLFeKI5rwbe3rxhHrW+mb8UV/lKlvcaxZ9lGI/SX4 F9is2hGAMKiN67YJrZAPDuW076ZhkKlwB+PZKfTo= Received: from politza by luca with local (Exim 4.72) (envelope-from ) id 1Vkl2P-0007GZ-Ui; Mon, 25 Nov 2013 02:32:33 +0100 From: Andreas Politz References: <87hak4gram.fsf@fh-trier.de> <5ABDF35DFCF64DEEAA37AFAE5048578D@us.oracle.com> <87ip4iwfoe.fsf@fh-trier.de> <878v5ew1pp.fsf@fh-trier.de> <87iovhqrve.fsf@yandex.ru> Date: Mon, 25 Nov 2013 02:32:33 +0100 In-Reply-To: <87iovhqrve.fsf@yandex.ru> (Dmitry Gutov's message of "Mon, 25 Nov 2013 01:53:09 +0200") Message-ID: <878uwdmfke.fsf@hochschule-trier.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain Changelog: * imenu.el (imenu--subalist-p): Don't error on non-conses and allow non-lambda lists as functions. In my opinion a predicate should not throw an error. Anyway more important is the `non-lambda' lists part. (imenu--index-alist): Don't recurse into non-subalists. Looking at the commentary, the ability to embed functions in a menu has clearly been added after this functions was written. (imenu): Don't pass function itself as an argument. ,----[ C-h v (describe-variable 'imenu-generic-expression) RET ] | Each element of this list should have the form | | (MENU-TITLE REGEXP INDEX [FUNCTION] [ARGUMENTS...]) | | FUNCTION, if present, specifies a function to call when the index | item is selected by the user. This function is called with | arguments consisting of the item name, the buffer position, and | the ARGUMENTS. `---- (cddr index-item) == (FUNCTION . ARGS), is wrong as argument list, we need one more cdr. * doc/lispref/modes.texi: Make it clear that sub-alist is the cdr. -ap --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=imenu.patch === modified file 'doc/lispref/modes.texi' *** doc/lispref/modes.texi 2013-08-17 11:14:10 +0000 --- doc/lispref/modes.texi 2013-11-25 00:39:51 +0000 *************** *** 2483,2489 **** A nested sub-alist element looks like this: @example ! (@var{menu-title} @var{sub-alist}) @end example It creates the submenu @var{menu-title} specified by @var{sub-alist}. --- 2483,2489 ---- A nested sub-alist element looks like this: @example ! (@var{menu-title} . @var{sub-alist}) @end example It creates the submenu @var{menu-title} specified by @var{sub-alist}. === modified file 'lisp/ChangeLog' *** lisp/ChangeLog 2013-11-24 22:53:35 +0000 --- lisp/ChangeLog 2013-11-25 00:45:59 +0000 *************** *** 1,3 **** --- 1,10 ---- + 2013-11-22 Andreas Politz + * imenu.el (imenu--subalist-p): Don't error on non-conses and + allow non-lambda lists as functions. + (imenu--index-alist): Don't recurse into non-subalists. + (imenu): Don't pass function itself as an argument. + * doc/lispref/modes.texi: Make it clear that sub-alist is the cdr. + 2013-11-24 Simon Schubert <2@0x2c.org> (tiny change) * json.el (json-alist-p): Only return non-nil if the alist has === modified file 'lisp/imenu.el' *** lisp/imenu.el 2013-11-24 21:23:47 +0000 --- lisp/imenu.el 2013-11-25 01:26:34 +0000 *************** *** 293,300 **** (defun imenu--subalist-p (item) ! (and (consp (cdr item)) (listp (cadr item)) ! (not (eq (car (cadr item)) 'lambda)))) (defmacro imenu-progress-message (_prevpos &optional _relpos _reverse) "Macro to display a progress message. --- 293,302 ---- (defun imenu--subalist-p (item) ! (and (consp item) ! (consp (cdr item)) ! (listp (cadr item)) ! (not (functionp (cadr item))))) (defmacro imenu-progress-message (_prevpos &optional _relpos _reverse) "Macro to display a progress message. *************** *** 645,653 **** ;; (INDEX-NAME (INDEX-NAME . INDEX-POSITION) ...) ;; while a bottom-level element looks like ;; (INDEX-NAME . INDEX-POSITION) ;; We are only interested in the bottom-level elements, so we need to ! ;; recurse if TAIL is a list. ! (cond ((listp tail) (if (setq res (imenu--in-alist str tail)) (setq alist nil))) ((if imenu-name-lookup-function --- 647,657 ---- ;; (INDEX-NAME (INDEX-NAME . INDEX-POSITION) ...) ;; while a bottom-level element looks like ;; (INDEX-NAME . INDEX-POSITION) + ;; or + ;; (INDEX-NAME INDEX-POSITION FUNCTION ARGUMENTS...) ;; We are only interested in the bottom-level elements, so we need to ! ;; recurse if TAIL is a nested ALIST. ! (cond ((imenu--subalist-p elt) (if (setq res (imenu--in-alist str tail)) (setq alist nil))) ((if imenu-name-lookup-function *************** *** 1033,1040 **** (nth 2 index-item) imenu-default-goto-function)) (position (if is-special-item (cadr index-item) (cdr index-item))) ! (rest (if is-special-item (cddr index-item)))) ! (apply function (car index-item) position rest)) (run-hooks 'imenu-after-jump-hook))) (provide 'imenu) --- 1037,1044 ---- (nth 2 index-item) imenu-default-goto-function)) (position (if is-special-item (cadr index-item) (cdr index-item))) ! (args (if is-special-item (cdr (cddr index-item))))) ! (apply function (car index-item) position args)) (run-hooks 'imenu-after-jump-hook))) (provide 'imenu) --=-=-=-- From unknown Wed Jun 25 00:27:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14029: 24.2.50; [PATCH] imenu problems with special elements Resent-From: Andreas Politz Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 25 Nov 2013 01:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14029 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Dmitry Gutov Cc: 14029@debbugs.gnu.org Received: via spool by 14029-submit@debbugs.gnu.org id=B14029.138534367610625 (code B ref 14029); Mon, 25 Nov 2013 01:42:02 +0000 Received: (at 14029) by debbugs.gnu.org; 25 Nov 2013 01:41:16 +0000 Received: from localhost ([127.0.0.1]:43097 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VklAp-0002lI-7M for submit@debbugs.gnu.org; Sun, 24 Nov 2013 20:41:16 -0500 Received: from gateway-a.fh-trier.de ([143.93.54.181]:43538) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VklAh-0002kx-GE for 14029@debbugs.gnu.org; Sun, 24 Nov 2013 20:41:08 -0500 X-Virus-Scanned: by Amavisd-new + McAfee uvscan + ClamAV [Rechenzentrum Hochschule Trier] Received: from luca (dslb-178-004-033-213.pools.arcor-ip.net [178.4.33.213]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: politza) by gateway-a.fh-trier.de (Postfix) with ESMTPSA id E6FEF175EB4B; Mon, 25 Nov 2013 02:40:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=simple/simple; d=hochschule-trier.de; s=default; t=1385343648; bh=IoDb2z+XzvxLuo2HiMBCf5IaBaY=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type; b=bIn7o9Iww+9cKMsobNejcCEbf6LlUCI6meqoXewhTPntH02RX2Fh8JtgdKrHoMe5i hji7UCZ4LlL5yhCZYeiIOyisKYuPVW86L78i8kX5T3ImaCp6Uv73tIYCP/P/OWKOl4 +GIy1E3N+xnt8rVFD3HUU0R/KjebvGFBTm/Fve7Y= Received: from politza by luca with local (Exim 4.72) (envelope-from ) id 1VklAN-0007Ww-AD; Mon, 25 Nov 2013 02:40:47 +0100 From: Andreas Politz References: <87hak4gram.fsf@fh-trier.de> <5ABDF35DFCF64DEEAA37AFAE5048578D@us.oracle.com> <87ip4iwfoe.fsf@fh-trier.de> <878v5ew1pp.fsf@fh-trier.de> <87iovhqrve.fsf@yandex.ru> <878uwdmfke.fsf@hochschule-trier.de> Date: Mon, 25 Nov 2013 02:40:47 +0100 In-Reply-To: <878uwdmfke.fsf@hochschule-trier.de> (Andreas Politz's message of "Mon, 25 Nov 2013 02:32:33 +0100") Message-ID: <8738mlmf6o.fsf@hochschule-trier.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Andreas Politz writes: > (imenu--index-alist): Don't recurse into non-subalists. This should be read as (imenu--in-alist). -ap From unknown Wed Jun 25 00:27:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14029: 24.2.50; [PATCH] imenu problems with special elements Resent-From: Andreas Politz Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 25 Nov 2013 01:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14029 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Dmitry Gutov Cc: 14029@debbugs.gnu.org Received: via spool by 14029-submit@debbugs.gnu.org id=B14029.138534426711536 (code B ref 14029); Mon, 25 Nov 2013 01:52:01 +0000 Received: (at 14029) by debbugs.gnu.org; 25 Nov 2013 01:51:07 +0000 Received: from localhost ([127.0.0.1]:43105 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VklKM-000300-67 for submit@debbugs.gnu.org; Sun, 24 Nov 2013 20:51:06 -0500 Received: from gateway-a.fh-trier.de ([143.93.54.181]:57223) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VklKG-0002zP-3p for 14029@debbugs.gnu.org; Sun, 24 Nov 2013 20:51:01 -0500 X-Virus-Scanned: by Amavisd-new + McAfee uvscan + ClamAV [Rechenzentrum Hochschule Trier] Received: from luca (dslb-178-004-033-213.pools.arcor-ip.net [178.4.33.213]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: politza) by gateway-a.fh-trier.de (Postfix) with ESMTPSA id 3C5EA1788D28; Mon, 25 Nov 2013 02:50:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=simple/simple; d=hochschule-trier.de; s=default; t=1385344240; bh=KXVnTOuhnMtr4wfoNSujSIENMac=; h=From:To:Cc:Subject:In-Reply-To:Date:References:Message-ID: MIME-Version:Content-Type; b=cfilHdpOvDxs4dPZQ5lbVad/1YNmeqewxuSme+gjRfN/TcQmSuJTAJIFkkcbNJ3QG 8FNGDI9wGpOIvfNo1Np1wF1Frrwv9F2Fs6QCWyJaMlI9YanvReDyru9m++D0cghVGn WfrjRV0odvgKqgvANonPmchdjqMP3Vy8yuvsnvZQ= Received: from politza by luca with local (Exim 4.72) (envelope-from ) id 1VklJv-0007qr-KG; Mon, 25 Nov 2013 02:50:39 +0100 From: Andreas Politz In-Reply-To: <87iovhqrve.fsf@yandex.ru> (Dmitry Gutov's message of "Mon, 25 Nov 2013 01:53:09 +0200") Date: Mon, 25 Nov 2013 02:32:33 +0100 References: <87hak4gram.fsf@fh-trier.de> <5ABDF35DFCF64DEEAA37AFAE5048578D@us.oracle.com> <87ip4iwfoe.fsf@fh-trier.de> <878v5ew1pp.fsf@fh-trier.de> <87iovhqrve.fsf@yandex.ru> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Message-ID: <87vbzhl05s.fsf@hochschule-trier.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain Content-Disposition: inline Let's do that again. Changelog: * imenu.el (imenu--subalist-p): Don't error on non-conses and allow non-lambda lists as functions. In my opinion a predicate should not throw an error. Anyway more important is the `non-lambda' lists part. (imenu--in-alist): Don't recurse into non-subalists. Looking at the commentary, the ability to embed functions in a menu has clearly been added after this functions was written. (imenu): Don't pass function itself as an argument. ,----[ (info "(elisp) Imenu") ] | Selecting a simple element has the effect of moving to position | INDEX-POSITION in the buffer. Special elements look like this: | | (INDEX-NAME INDEX-POSITION FUNCTION ARGUMENTS...) | | Selecting a special element performs: | | (funcall FUNCTION | INDEX-NAME INDEX-POSITION ARGUMENTS...) `---- (cddr index-item) == (FUNCTION . ARGS), is wrong as argument list, we need one more cdr. * doc/lispref/modes.texi: Make it clear that sub-alist is the cdr. -ap --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=imenu.patch === modified file 'doc/lispref/modes.texi' *** doc/lispref/modes.texi 2013-08-17 11:14:10 +0000 --- doc/lispref/modes.texi 2013-11-25 00:39:51 +0000 *************** *** 2483,2489 **** A nested sub-alist element looks like this: @example ! (@var{menu-title} @var{sub-alist}) @end example It creates the submenu @var{menu-title} specified by @var{sub-alist}. --- 2483,2489 ---- A nested sub-alist element looks like this: @example ! (@var{menu-title} . @var{sub-alist}) @end example It creates the submenu @var{menu-title} specified by @var{sub-alist}. === modified file 'lisp/ChangeLog' *** lisp/ChangeLog 2013-11-24 22:53:35 +0000 --- lisp/ChangeLog 2013-11-25 00:45:59 +0000 *************** *** 1,3 **** --- 1,10 ---- + 2013-11-22 Andreas Politz + * imenu.el (imenu--subalist-p): Don't error on non-conses and + allow non-lambda lists as functions. + (imenu--in-alist): Don't recurse into non-subalists. + (imenu): Don't pass function itself as an argument. + * doc/lispref/modes.texi: Make it clear that sub-alist is the cdr. + 2013-11-24 Simon Schubert <2@0x2c.org> (tiny change) * json.el (json-alist-p): Only return non-nil if the alist has === modified file 'lisp/imenu.el' *** lisp/imenu.el 2013-11-24 21:23:47 +0000 --- lisp/imenu.el 2013-11-25 01:26:34 +0000 *************** *** 293,300 **** (defun imenu--subalist-p (item) ! (and (consp (cdr item)) (listp (cadr item)) ! (not (eq (car (cadr item)) 'lambda)))) (defmacro imenu-progress-message (_prevpos &optional _relpos _reverse) "Macro to display a progress message. --- 293,302 ---- (defun imenu--subalist-p (item) ! (and (consp item) ! (consp (cdr item)) ! (listp (cadr item)) ! (not (functionp (cadr item))))) (defmacro imenu-progress-message (_prevpos &optional _relpos _reverse) "Macro to display a progress message. *************** *** 645,653 **** ;; (INDEX-NAME (INDEX-NAME . INDEX-POSITION) ...) ;; while a bottom-level element looks like ;; (INDEX-NAME . INDEX-POSITION) ;; We are only interested in the bottom-level elements, so we need to ! ;; recurse if TAIL is a list. ! (cond ((listp tail) (if (setq res (imenu--in-alist str tail)) (setq alist nil))) ((if imenu-name-lookup-function --- 647,657 ---- ;; (INDEX-NAME (INDEX-NAME . INDEX-POSITION) ...) ;; while a bottom-level element looks like ;; (INDEX-NAME . INDEX-POSITION) + ;; or + ;; (INDEX-NAME INDEX-POSITION FUNCTION ARGUMENTS...) ;; We are only interested in the bottom-level elements, so we need to ! ;; recurse if TAIL is a nested ALIST. ! (cond ((imenu--subalist-p elt) (if (setq res (imenu--in-alist str tail)) (setq alist nil))) ((if imenu-name-lookup-function *************** *** 1033,1040 **** (nth 2 index-item) imenu-default-goto-function)) (position (if is-special-item (cadr index-item) (cdr index-item))) ! (rest (if is-special-item (cddr index-item)))) ! (apply function (car index-item) position rest)) (run-hooks 'imenu-after-jump-hook))) (provide 'imenu) --- 1037,1044 ---- (nth 2 index-item) imenu-default-goto-function)) (position (if is-special-item (cadr index-item) (cdr index-item))) ! (args (if is-special-item (cdr (cddr index-item))))) ! (apply function (car index-item) position args)) (run-hooks 'imenu-after-jump-hook))) (provide 'imenu) --=-=-=-- From unknown Wed Jun 25 00:27:15 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Andreas Politz Subject: bug#14029: closed (Re: bug#14029: 24.2.50; [PATCH] imenu problems with special elements) Message-ID: References: <52980D7D.2060902@yandex.ru> <87hak4gram.fsf@fh-trier.de> X-Gnu-PR-Message: they-closed 14029 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 14029@debbugs.gnu.org Date: Fri, 29 Nov 2013 03:45:04 +0000 Content-Type: multipart/mixed; boundary="----------=_1385696704-27225-1" This is a multi-part message in MIME format... ------------=_1385696704-27225-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #14029: 24.2.50; [PATCH] imenu problems with special elements=20 which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 14029@debbugs.gnu.org. --=20 14029: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D14029 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1385696704-27225-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 14029-done) by debbugs.gnu.org; 29 Nov 2013 03:44:10 +0000 Received: from localhost ([127.0.0.1]:49478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VmEzx-00073c-LX for submit@debbugs.gnu.org; Thu, 28 Nov 2013 22:44:09 -0500 Received: from mail-wi0-f179.google.com ([209.85.212.179]:63617) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VmEzv-00073G-Du for 14029-done@debbugs.gnu.org; Thu, 28 Nov 2013 22:44:08 -0500 Received: by mail-wi0-f179.google.com with SMTP id ey16so1546326wid.6 for <14029-done@debbugs.gnu.org>; Thu, 28 Nov 2013 19:44:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=afFf0Yr/9iJsriBqofielcvllurTtep2F/JcHCUgWD4=; b=AxzlAMgPUnVeCZ1dfFOo4JlCb/1PxdLKtQ5CKubWKae3kIpF9hOCcMG/5chw/skRdV 6g6T23BKnXT2gZx0TJI14mKtKvSUxqH6hvkKLZwBZsDKypqv/IqFG4H532yKGJp4ZUnh hV7vLhakzNgTQWMbY7cMuFkJsT/5M2L5IRT1GRPb3FGT5pclSk4jQyAMzb/iCVQ3lOJu fWbyLjcFwkd/d615bBJZj7VFNU0PfxgYhQCOQIixc5K4RXegHcrCNz8jZ0+PNQOF6IUS SoUL0qULvaU5+XnyAfoTsNV46+ggeMnFyGRBemwAnVsJbPEcRu2QG2H+r3DlNpp1G2O3 YpGg== X-Received: by 10.194.93.193 with SMTP id cw1mr8143932wjb.38.1385696641321; Thu, 28 Nov 2013 19:44:01 -0800 (PST) Received: from [192.168.10.2] (83-43-131.netrun.cytanet.com.cy. [83.168.43.131]) by mx.google.com with ESMTPSA id w1sm52104810wib.6.2013.11.28.19.43.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Nov 2013 19:44:00 -0800 (PST) Message-ID: <52980D7D.2060902@yandex.ru> Date: Fri, 29 Nov 2013 05:43:57 +0200 From: Dmitry Gutov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 To: Andreas Politz Subject: Re: bug#14029: 24.2.50; [PATCH] imenu problems with special elements References: <87hak4gram.fsf@fh-trier.de> <5ABDF35DFCF64DEEAA37AFAE5048578D@us.oracle.com> <87ip4iwfoe.fsf@fh-trier.de> <878v5ew1pp.fsf@fh-trier.de> <87iovhqrve.fsf@yandex.ru> <87vbzhl05s.fsf@hochschule-trier.de> In-Reply-To: <87vbzhl05s.fsf@hochschule-trier.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 14029-done Cc: 14029-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Version: 24.4 Thanks, that's clearer. Installed in revision 115279. One note: >> Is it possible for (cadr item) to be a list and also be `functionp' and yet not >> have its car be `lambda'? Dunno. I was under the impression that it was >> impossible, but I could be wrong. If it is possible, is it better to test >> `functionp' here? Dunno. > > If the documentation states FUNCTION, then it should be a function. The documentation allows FUNCTION in the third element, but `imenu--subalist-p' is checking whether the second element is a function. AFAICT, it's checking against malformed items. Your change makes it also guard against lexically-bound lambdas (their car is `closure'), so that's good, I guess. ------------=_1385696704-27225-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 22 Mar 2013 01:26:56 +0000 Received: from localhost ([127.0.0.1]:39652 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UIqkw-0004hF-Or for submit@debbugs.gnu.org; Thu, 21 Mar 2013 21:26:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34588) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UIqkt-0004h6-SL for submit@debbugs.gnu.org; Thu, 21 Mar 2013 21:26:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIqj1-0005UU-Hs for submit@debbugs.gnu.org; Thu, 21 Mar 2013 21:24:58 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:33947) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIqj1-0005UQ-F7 for submit@debbugs.gnu.org; Thu, 21 Mar 2013 21:24:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIqiy-0006RX-Jj for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2013 21:24:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIqiv-0005T1-VA for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2013 21:24:52 -0400 Received: from gateway-a.fh-trier.de ([143.93.54.181]:54740) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIqiv-0005Sn-JQ for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2013 21:24:49 -0400 X-Virus-Scanned: by Amavisd-new + McAfee uvscan + ClamAV [Rechenzentrum Hochschule Trier] Received: from luca (dslb-088-068-070-155.pools.arcor-ip.net [88.68.70.155]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: politza) by gateway-a.fh-trier.de (Postfix) with ESMTPSA id E1644175CA07 for ; Fri, 22 Mar 2013 02:24:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=simple/simple; d=fh-trier.de; s=default; t=1363915474; bh=dRE7QkYGFxMx/ePcfTmflwH2d0w=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=R1TVnp1AeRv5k0rJSZOSai2c3rZ3Ba1tndzqqba8K/YqBchByOirpEFVh/6ZLORvj VZyps1WuRtM1f3B+WQ5efZzq5NOIEoXztJaZUXoPNQ04V9q3LTV4gr2UdcChteCHHh 23/CIo8oOUFaF2X2AndVfylrc9F9Hq51DGCM/G3o= Received: from localhost ([127.0.0.1] helo=luca) by luca with esmtp (Exim 4.72) (envelope-from ) id 1UIqif-0008I3-5a for bug-gnu-emacs@gnu.org; Fri, 22 Mar 2013 02:24:33 +0100 From: Andreas Politz To: bug-gnu-emacs@gnu.org Subject: 24.2.50; [PATCH] imenu problems with special elements Date: Fri, 22 Mar 2013 02:24:33 +0100 Message-ID: <87hak4gram.fsf@fh-trier.de> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.2 (------) ,----[ (info "(elisp) Imenu") ] | Special elements look like this: | | (INDEX-NAME INDEX-POSITION FUNCTION ARGUMENTS...) | | Selecting a special element performs: | | (funcall FUNCTION | INDEX-NAME INDEX-POSITION ARGUMENTS...) `---- 1. At least one function does not recognize these elements, resulting in an error. 2. The advertised calling convention is different from the actual one in `imenu'. 3. The `imenu--subalist-p' predicate is unsafe and incomplete. Andreas diff -c -L /home/politza/src/emacs/trunk/lisp/imenu.el -L \#\ /home/politza/src/emacs/trunk/lisp/imenu.el /tmp/buffer-content-3095O-q *** /home/politza/src/emacs/trunk/lisp/imenu.el --- # *************** *** 286,293 **** (defun imenu--subalist-p (item) ! (and (consp (cdr item)) (listp (cadr item)) ! (not (eq (car (cadr item)) 'lambda)))) (defmacro imenu-progress-message (_prevpos &optional _relpos _reverse) "Macro to display a progress message. --- 286,295 ---- (defun imenu--subalist-p (item) ! (and (consp item) ! (consp (cdr item)) ! (listp (cadr item)) ! (not (functionp (cadr item))))) (defmacro imenu-progress-message (_prevpos &optional _relpos _reverse) "Macro to display a progress message. *************** *** 641,647 **** ;; We are only interested in the bottom-level elements, so we need to ;; recurse if TAIL is a list. (cond ((listp tail) ! (if (setq res (imenu--in-alist str tail)) (setq alist nil))) ((if imenu-name-lookup-function (funcall imenu-name-lookup-function str head) --- 643,650 ---- ;; We are only interested in the bottom-level elements, so we need to ;; recurse if TAIL is a list. (cond ((listp tail) ! (if (and (imenu--subalist-p elt) ! (setq res (imenu--in-alist str tail))) (setq alist nil))) ((if imenu-name-lookup-function (funcall imenu-name-lookup-function str head) *************** *** 1024,1030 **** (nth 2 index-item) imenu-default-goto-function)) (position (if is-special-item (cadr index-item) (cdr index-item))) ! (rest (if is-special-item (cddr index-item)))) (apply function (car index-item) position rest)) (run-hooks 'imenu-after-jump-hook))) --- 1027,1033 ---- (nth 2 index-item) imenu-default-goto-function)) (position (if is-special-item (cadr index-item) (cdr index-item))) ! (rest (if is-special-item (cdddr index-item)))) (apply function (car index-item) position rest)) (run-hooks 'imenu-after-jump-hook))) Diff finished. Fri Mar 22 02:15:09 2013 ------------=_1385696704-27225-1-- From unknown Wed Jun 25 00:27:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14029: 24.2.50; [PATCH] imenu problems with special elements Resent-From: Andreas Politz Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Nov 2013 13:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14029 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Dmitry Gutov Cc: 14029-done@debbugs.gnu.org Received: via spool by 14029-done@debbugs.gnu.org id=D14029.138573223324919 (code D ref 14029); Fri, 29 Nov 2013 13:38:02 +0000 Received: (at 14029-done) by debbugs.gnu.org; 29 Nov 2013 13:37:13 +0000 Received: from localhost ([127.0.0.1]:49905 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VmOFs-0006Tq-BC for submit@debbugs.gnu.org; Fri, 29 Nov 2013 08:37:12 -0500 Received: from gateway-a.fh-trier.de ([143.93.54.181]:36574) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VmOFp-0006SM-25 for 14029-done@debbugs.gnu.org; Fri, 29 Nov 2013 08:37:10 -0500 X-Virus-Scanned: by Amavisd-new + McAfee uvscan + ClamAV [Rechenzentrum Hochschule Trier] Received: from luca (dslb-084-059-246-148.pools.arcor-ip.net [84.59.246.148]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: politza) by gateway-a.fh-trier.de (Postfix) with ESMTPSA id E7ED41788CF2; Fri, 29 Nov 2013 14:36:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=simple/simple; d=hochschule-trier.de; s=default; t=1385732209; bh=diYkMKNnQbP3lHD2zQscUvnLtDM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type; b=gN8ZrHnuAdrRSM4a1lDFyPOvqWRIws4RkGefD+ODVCQ1t6WySqsgflIl/4uvJeH2B XMgqIIzzTnzHy/s0D8pYkVopkBJwWqxaZcH2fkUC7Pbh2RkF3M9kr7XkZHVepPXsel 9brr2wgB4o+fWZbZlvEiQRH8w0zsskS7BK9M46ec= Received: from politza by luca with local (Exim 4.72) (envelope-from ) id 1VmOFU-0004Fw-8V; Fri, 29 Nov 2013 14:36:48 +0100 From: Andreas Politz References: <87hak4gram.fsf@fh-trier.de> <5ABDF35DFCF64DEEAA37AFAE5048578D@us.oracle.com> <87ip4iwfoe.fsf@fh-trier.de> <878v5ew1pp.fsf@fh-trier.de> <87iovhqrve.fsf@yandex.ru> <87vbzhl05s.fsf@hochschule-trier.de> <52980D7D.2060902@yandex.ru> Date: Fri, 29 Nov 2013 14:36:48 +0100 In-Reply-To: <52980D7D.2060902@yandex.ru> (Dmitry Gutov's message of "Fri, 29 Nov 2013 05:43:57 +0200") Message-ID: <87pppj2utr.fsf@hochschule-trier.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain Dmitry Gutov writes: > One note: > >>> Is it possible for (cadr item) to be a list and also be `functionp' and yet not >>> have its car be `lambda'? > > The documentation allows FUNCTION in the third element, but > imenu--subalist-p' is checking whether the second element is a > function. Yes, this doesn't make much sense. I guess this function check was intended to distinguish a special element (INDEX-NAME POS FN . ARGS) from a sub-alist element (INDEX-NAME . SUB-ALIST). The check would make sense, if this function was applied to the cdr of an element, i.e. check if the argument is a SUB-ALIST. But this is not how this function is used in imenu.el . I might have initially (and falsely) determined this as the source of some bug. -ap P.S.: There is another dot missing in the documentation. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=imenu.patch === modified file 'lisp/imenu.el' *** lisp/imenu.el 2013-11-29 03:38:20 +0000 --- lisp/imenu.el 2013-11-29 13:30:58 +0000 *************** *** 463,469 **** To \"go to\" a special element means applying FUNCTION to INDEX-NAME, POSITION, and the ARGUMENTS. ! A nested sub-alist element looks like (INDEX-NAME SUB-ALIST). The function `imenu--subalist-p' tests an element and returns t if it is a sub-alist. --- 463,469 ---- To \"go to\" a special element means applying FUNCTION to INDEX-NAME, POSITION, and the ARGUMENTS. ! A nested sub-alist element looks like (INDEX-NAME . SUB-ALIST). The function `imenu--subalist-p' tests an element and returns t if it is a sub-alist. --=-=-=-- From unknown Wed Jun 25 00:27:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14029: 24.2.50; [PATCH] imenu problems with special elements Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Nov 2013 14:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14029 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Andreas Politz Cc: 14029-done@debbugs.gnu.org Received: via spool by 14029-done@debbugs.gnu.org id=D14029.138573575930328 (code D ref 14029); Fri, 29 Nov 2013 14:36:02 +0000 Received: (at 14029-done) by debbugs.gnu.org; 29 Nov 2013 14:35:59 +0000 Received: from localhost ([127.0.0.1]:49921 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VmPAk-0007t5-VK for submit@debbugs.gnu.org; Fri, 29 Nov 2013 09:35:59 -0500 Received: from mail-ea0-f170.google.com ([209.85.215.170]:65431) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VmPAh-0007sr-PF for 14029-done@debbugs.gnu.org; Fri, 29 Nov 2013 09:35:56 -0500 Received: by mail-ea0-f170.google.com with SMTP id k10so7035807eaj.1 for <14029-done@debbugs.gnu.org>; Fri, 29 Nov 2013 06:35:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=/1So+hVe82ADYUhmvHDi+sD6BbQu8PY4fDep/krRk20=; b=OjOaaKqLBon3eRUai3yPIuFNZ9n5+W8KyBSuV8dApeA41rPnTJYHG+j937OI6fRNDd 3aGLBoHsmg61HRnV+Ixv/lcCChSNA4xzbtpwa4b9ww2qz7v5ACu8xlECXZ1PDbRa6i0l vSlxDTSxtJHPZgcwyBWzhfXPnTup1NHPoA622LPdGM+Gae36EQJQkF11jvJ+l7OW8wME YP5A13CnZUTnxWgsLWdmsuPKhgk9FonFjKJEP1JO3uDSXJCqHnaL74LHXSMbgHZteVPV GPNj6+VcaG1NJHOHwFRMFPev0pT9norN6TJ5cCCsKZBknO9NCxuMVDgTogCuiNLFw12o J8Qw== X-Received: by 10.14.127.4 with SMTP id c4mr155703eei.144.1385735750020; Fri, 29 Nov 2013 06:35:50 -0800 (PST) Received: from [192.168.10.48] (93-245-142.netrun.cytanet.com.cy. [93.109.245.142]) by mx.google.com with ESMTPSA id e3sm4318694eeg.11.2013.11.29.06.35.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 06:35:49 -0800 (PST) Message-ID: <5298A642.6090406@yandex.ru> Date: Fri, 29 Nov 2013 16:35:46 +0200 From: Dmitry Gutov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 References: <87hak4gram.fsf@fh-trier.de> <5ABDF35DFCF64DEEAA37AFAE5048578D@us.oracle.com> <87ip4iwfoe.fsf@fh-trier.de> <878v5ew1pp.fsf@fh-trier.de> <87iovhqrve.fsf@yandex.ru> <87vbzhl05s.fsf@hochschule-trier.de> <52980D7D.2060902@yandex.ru> <87pppj2utr.fsf@hochschule-trier.de> In-Reply-To: <87pppj2utr.fsf@hochschule-trier.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 29.11.2013 15:36, Andreas Politz wrote: > The check would make sense, if this function was applied to the cdr of > an element, i.e. check if the argument is a SUB-ALIST. But this is not > how this function is used in imenu.el . Yep, it's either a mistake or an example of defensive programming. > I might have initially (and falsely) determined this as the source of > some bug. That's why we usually ask that bug reports have reproduction scenario. > P.S.: There is another dot missing in the documentation. Installed, thanks. From unknown Wed Jun 25 00:27:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14029: 24.2.50; [PATCH] imenu problems with special elements Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Nov 2013 15:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14029 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Andreas Politz , Dmitry Gutov Cc: 14029-done@debbugs.gnu.org Received: via spool by 14029-done@debbugs.gnu.org id=D14029.13857392733838 (code D ref 14029); Fri, 29 Nov 2013 15:35:02 +0000 Received: (at 14029-done) by debbugs.gnu.org; 29 Nov 2013 15:34:33 +0000 Received: from localhost ([127.0.0.1]:50422 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VmQ5R-0000zp-1r for submit@debbugs.gnu.org; Fri, 29 Nov 2013 10:34:33 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:28812) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VmQ5N-0000zb-U6 for 14029-done@debbugs.gnu.org; Fri, 29 Nov 2013 10:34:30 -0500 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id rATFYLMP026472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 29 Nov 2013 15:34:22 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rATFYKFo010052 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 29 Nov 2013 15:34:21 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rATFYKUF010030; Fri, 29 Nov 2013 15:34:20 GMT MIME-Version: 1.0 Message-ID: Date: Fri, 29 Nov 2013 07:34:19 -0800 (PST) From: Drew Adams References: <87hak4gram.fsf@fh-trier.de> <5ABDF35DFCF64DEEAA37AFAE5048578D@us.oracle.com> <87ip4iwfoe.fsf@fh-trier.de> <878v5ew1pp.fsf@fh-trier.de> <87iovhqrve.fsf@yandex.ru> <87vbzhl05s.fsf@hochschule-trier.de> <52980D7D.2060902@yandex.ru> <87pppj2utr.fsf@hochschule-trier.de> In-Reply-To: <87pppj2utr.fsf@hochschule-trier.de> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6680.5000 (x86)] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > >>> Is it possible for (cadr item) to be a list and also be `functionp' a= nd > >>> yet not have its car be `lambda'? > > > > The documentation allows FUNCTION in the third element, but > > imenu--subalist-p' is checking whether the second element is a > > function. >=20 > Yes, this doesn't make much sense. I guess this function check was > intended to distinguish a special element (INDEX-NAME POS FN . ARGS) > from a sub-alist element (INDEX-NAME . SUB-ALIST). >=20 > The check would make sense, if this function was applied to the cdr of > an element, i.e. check if the argument is a SUB-ALIST. But this is not > how this function is used in imenu.el . >=20 > I might have initially (and falsely) determined this as the source of > some bug. Sorry, I have not been following this thread at all, and am unaware of the problem being addressed. So please ignore, if this is irrelevant. Emacs itself still does not use "special" items anywhere. But I do. I'm just hoping that they are still going to be taken into consideration and not obliterated. See bug #12717 for background on submenus and special items. Yes, the imenu.el code is a bit confusing. http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D12717