From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "rgb" Newsgroups: gmane.emacs.help Subject: Re: More imenu questions Date: 11 Nov 2005 08:43:14 -0800 Organization: http://groups.google.com Message-ID: <1131727394.648824.142840@g43g2000cwa.googlegroups.com> References: <1131650614.618835.24650@z14g2000cwz.googlegroups.com> <1131674235.003097.278410@o13g2000cwo.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1131727680 25487 80.91.229.2 (11 Nov 2005 16:48:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 11 Nov 2005 16:48:00 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 11 17:47:50 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Eac1k-0002kE-Km for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Nov 2005 17:45:24 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Eac1j-0000bf-VB for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Nov 2005 11:45:24 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!news.glorb.com!postnews.google.com!g43g2000cwa.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.emacs,comp.lang.tcl Original-Lines: 55 Original-NNTP-Posting-Host: 198.74.20.74 Original-X-Trace: posting.google.com 1131727399 22427 127.0.0.1 (11 Nov 2005 16:43:19 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 11 Nov 2005 16:43:19 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: g43g2000cwa.googlegroups.com; posting-host=198.74.20.74; posting-account=C7LM4w0AAAD23IRuMuUUJVCLQTuHhTK8 Original-Xref: shelby.stanford.edu gnu.emacs.help:135395 comp.emacs:90560 comp.lang.tcl:273211 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:30989 Archived-At: 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.