From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: bug#12717: 24.2.50; [PATCH] `imenu--split-submenus' incorrectly distinguishes submenus Date: Mon, 29 Oct 2012 23:33:59 -0700 Message-ID: <0A937822E8694129BBE65DA8B18493FA@us.oracle.com> References: <9212825D880B4B2581E22420DB3B53DC@us.oracle.com> <00BA7268CCD34A4CA7D11B7F83CE61E8@us.oracle.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1351578878 2551 80.91.229.3 (30 Oct 2012 06:34:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 30 Oct 2012 06:34:38 +0000 (UTC) Cc: 12717@debbugs.gnu.org To: "'Stefan Monnier'" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 30 07:34:46 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TT5PR-0004Se-KN for geb-bug-gnu-emacs@m.gmane.org; Tue, 30 Oct 2012 07:34:45 +0100 Original-Received: from localhost ([::1]:44926 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TT5PJ-0003D6-0P for geb-bug-gnu-emacs@m.gmane.org; Tue, 30 Oct 2012 02:34:37 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TT5PF-0003Cs-Un for bug-gnu-emacs@gnu.org; Tue, 30 Oct 2012 02:34:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TT5PE-0003jR-T4 for bug-gnu-emacs@gnu.org; Tue, 30 Oct 2012 02:34:33 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56821) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TT5PE-0003jN-PM for bug-gnu-emacs@gnu.org; Tue, 30 Oct 2012 02:34:32 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TT5Re-0005nA-2B for bug-gnu-emacs@gnu.org; Tue, 30 Oct 2012 02:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 30 Oct 2012 06:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12717 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 12717-submit@debbugs.gnu.org id=B12717.135157900522241 (code B ref 12717); Tue, 30 Oct 2012 06:37:02 +0000 Original-Received: (at 12717) by debbugs.gnu.org; 30 Oct 2012 06:36:45 +0000 Original-Received: from localhost ([127.0.0.1]:38839 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TT5RJ-0005md-WA for submit@debbugs.gnu.org; Tue, 30 Oct 2012 02:36:43 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:23620) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TT5RG-0005mV-H7 for 12717@debbugs.gnu.org; Tue, 30 Oct 2012 02:36:39 -0400 Original-Received: from ucsinet21.oracle.com ([156.151.31.93]) by aserp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q9U6Y6oV027578 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 30 Oct 2012 06:34:07 GMT Original-Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q9U6Y3R6020197 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 30 Oct 2012 06:34:06 GMT Original-Received: from abhmt115.oracle.com (abhmt115.oracle.com [141.146.116.67]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q9U6Y3IK009850; Tue, 30 Oct 2012 01:34:03 -0500 Original-Received: from dradamslap1 (/10.159.222.205) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 29 Oct 2012 23:34:03 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <00BA7268CCD34A4CA7D11B7F83CE61E8@us.oracle.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac22S2SWsEbYSdf3SnyFm31qJOzVFgAGGd6QAAC2VmA= X-Source-IP: [156.151.31.93] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:66227 Archived-At: Sorry, I was confused in my reply. This wasn't directly about `imenu--make-index-alist', but about `imenu--split-submenus'. I made the fix for that at the same time, for the same reason (to add the toggle menu items). `imenu--subalist-p' does this: (defun imenu--subalist-p (item) (and (consp (cdr item)) (listp (cadr item)) (not (eq (car (cadr item)) 'lambda)))) I don't think it is necessary to check that the elements of the ALIST arg to `imenu--split-submenus' are conses. But if you want to be sure that the `cdr' in `imenu--subalist-p' doesn't cause a problem, then either add a `consp' test before `imenu--sublist-p' or change the `cdr' to `cdr-safe'. I'm pretty sure that the ALIST arg will have only cons elements, but I guess there is no guarantee. My guess is that the original test (and (consp elt) (stringp (car elt)) (listp (cdr elt))) was just a feeble attempt to check for a sublmenu. Anyway, now you know as much as I about the code, and can decide how you want to fix it. The point of the bug report is that the current definition ends up trying to handle a "special" menu item as if it were a submenu: it is a consp with a string car and listp cdr, but it is not a submenu. It ends up choking.