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 #8 received at 12717 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Drew Adams" <drew.adams <at> oracle.com>
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:05:15 -0400
> (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




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.