unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "rgb" <rbielaws@i1.net>
Subject: Re: More imenu questions
Date: 11 Nov 2005 08:43:14 -0800	[thread overview]
Message-ID: <1131727394.648824.142840@g43g2000cwa.googlegroups.com> (raw)
In-Reply-To: 1131674235.003097.278410@o13g2000cwo.googlegroups.com

gamename wrote:
> Hi Peter,
>
> Thanks for the regex pointers. That helps.  I'll have to give you a
> little background to explain what I'm trying.
>
> I have an in-house developed tcl package with code blocks in the
> following format:
>
> aetest::testcase -tc_id rekey {
>     aetest::subtest -subtc_id test1 {
>         aetest::section setup {        }
>         aetest::section test {        }
>         aetest::section cleanup {        }
>     }
>     aetest::subtest -subtc_id test2 {
>         aetest::section setup {        }
>         aetest::section test {        }
>         aetest::section cleanup {        }
>     }
>     etc ...
> }
>
> So, I'm trying to create an imenu menu hierarchy which will allow me to
> put them in some kind of logical order.  Here is what I have:
>
> (setq tcl-imenu-generic-expression
>  '(("Testcase"  "aetest::testcase +-tc_id +\\([-_A-Za-z0-9+]+\\) +{" 1)
>  ("SubTest"  "aetest::subtest +-subtc_id +\\([-_A-Za-z0-9+]+\\) +{" 2)
>  ("Section"  "aetest::section +\\([-_A-Za-z0-9+]+\\) +{" 3)))
>
> (add-hook 'tcl-mode-hook
>    (function (lambda ()
>          (setq imenu-generic-expression
> tcl-imenu-generic-expression))))
>
> I hope this clarifies what I'm trying to do.  Is this the correct way
> to approach it?

I wish someone would tell me I'm wrong but imenu doesn't support any
kind of heirarchy.  You're getting a "Section" menu that contains a
bunch of "setup" entries without any indication of which subtest it
belongs to right?

AFAIK, the best you can do is to specify () or nil for the menu names
and include the testcase/subtest/section keyword in your match group.
Obviously, then, you can't use any sorting on the imenu index because
it's only the position in the list that gives you an idea of what
groups your entities belong to.

I've been trying to find time to enhance imenu myself because I have
several modes that need hierarchy support but it's just not happening.
If someone else has done something I'll be downloading it right away
but I've not seen anything.

  reply	other threads:[~2005-11-11 16:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-10 19:23 More imenu questions gamename
2005-11-10 21:11 ` Peter Dyballa
2005-11-10 22:00 ` Kevin Rodgers
2005-11-10 23:55 ` rgb
     [not found] ` <mailman.14783.1131660316.20277.help-gnu-emacs@gnu.org>
2005-11-11  0:15   ` rgb
     [not found] ` <mailman.14778.1131657088.20277.help-gnu-emacs@gnu.org>
2005-11-11  1:57   ` gamename
2005-11-11 16:43     ` rgb [this message]
2005-11-11 17:04       ` Drew Adams
2005-11-11 23:58       ` Donal K. Fellows
2005-11-14 22:24         ` Bruce Stephens
2005-11-12 17:20       ` gamename

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=1131727394.648824.142840@g43g2000cwa.googlegroups.com \
    --to=rbielaws@i1.net \
    /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.
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).