bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12717: 24.2.50; [PATCH] `imenu--split-submenus' incorrectly distingu


From: Drew Adams
Subject: 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.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]