GNU bug report logs - #12717
24.2.50; [PATCH] `imenu--split-submenus' incorrectly distinguishes submenus

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Wed, 24 Oct 2012 00:10:02 UTC

Severity: normal

Tags: patch

Found in version 24.2.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 12717 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>
Cc: 12717 <at> debbugs.gnu.org
Subject: RE: bug#12717: 24.2.50;
	[PATCH] `imenu--split-submenus' incorrectly distinguishes submenus
Date: Mon, 29 Oct 2012 23:33:59 -0700
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.





This bug report was last modified 12 years and 249 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.