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: Stefan Monnier
Subject: bug#12717: 24.2.50; [PATCH] `imenu--split-submenus' incorrectly distinguishes submenus
Date: Mon, 29 Oct 2012 23:05:15 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

> (defun imenu--split-submenus (alist)
>   "..."
>   (mapcar (lambda (elt)
>             (if (and (consp elt) (stringp (car elt)) (listp (cdr elt)))
>                 (imenu--split-menu (cdr elt) (car elt))
>               elt))
>    alist))
 
> The `if' condition should instead test whether the element is a submenu.
> We have a function that does that: `imenu--subalist-p'.  I believe this
> is the correct code:
 
> (defun imenu--split-submenus (alist)
>   "..."
>   (mapcar (lambda (elt)
>             (if (imenu--subalist-p elt)
>                 (imenu--split-menu (cdr elt) (car elt))
>               elt))
>    alist))

This looks eminently reasonable, except that I don't understand the code
enough to be sure (e.g. the current test includes (consp elt) whereas
imenu--split-menu starts right off by calling cdr).  Do you happen to
have some kind of test case?


        Stefan





reply via email to

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