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

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

Re: More imenu questions


From: rgb
Subject: Re: More imenu questions
Date: 11 Nov 2005 08:43:14 -0800
User-agent: G2/0.2

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 via email to

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