unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Drew Adams" <drew.adams@oracle.com>
Cc: 12717@debbugs.gnu.org
Subject: bug#12717: 24.2.50; [PATCH] `imenu--split-submenus' incorrectly distinguishes submenus
Date: Mon, 29 Oct 2012 23:05:15 -0400	[thread overview]
Message-ID: <jwvr4ogvf83.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <9212825D880B4B2581E22420DB3B53DC@us.oracle.com> (Drew Adams's message of "Tue, 23 Oct 2012 17:07:11 -0700")

> (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	other threads:[~2012-10-30  3:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-24  0:07 bug#12717: 24.2.50; [PATCH] `imenu--split-submenus' incorrectly distinguishes submenus Drew Adams
2012-10-30  3:05 ` Stefan Monnier [this message]
2012-10-30  6:18   ` Drew Adams
2012-10-30  6:33     ` Drew Adams
2012-11-15  2:03   ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvr4ogvf83.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=12717@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).