* "Dynamic" Imenu
@ 2008-08-21 15:21 Eric
2008-08-22 4:48 ` Drew Adams
2008-08-22 14:10 ` Scott Frazer
0 siblings, 2 replies; 3+ messages in thread
From: Eric @ 2008-08-21 15:21 UTC (permalink / raw)
To: help-gnu-emacs
I am trying to write a major mode for language that's used at my
workplace. Function-type blocks take the form
METHOD [methodName]
Obviously, it's easy to write an imenu regexp for that line. However,
"functions" associated with a certain window take the form
WINDOW [windowName] (windowObjectAssociatedWith)
Two windows could have identically named windowObjects. I would like
an imenu that looks something like this:
Imenu
FunctionFoo1
FunctionFoo2
Window >
Window1 >
windowFunctionFoo1
windowFunctionFoo2
Window2 >
windowFunctionFoo1
windowFunctionFoo2
So that the Window submenu has submenus, where each submenu is the
name of a window.
Alternatively, the imenu could simply contain submenus that are the
name of the window. So
Imenu
FunctionFoo1
FunctionFoo2
Window1 >
windowFunctionFoo1
windowFunctionFoo2
Window2 >
windowFunctionFoo1
windowFunctionFoo2
I've wrestled with the lisp for a while, but I can't think of a way to
do this with the imenu-generic-expression variable. Any suggestions?
Is this even possible with an imenu?
Thanks,
Eric
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: "Dynamic" Imenu
2008-08-21 15:21 "Dynamic" Imenu Eric
@ 2008-08-22 4:48 ` Drew Adams
2008-08-22 14:10 ` Scott Frazer
1 sibling, 0 replies; 3+ messages in thread
From: Drew Adams @ 2008-08-22 4:48 UTC (permalink / raw)
To: 'Eric', help-gnu-emacs
> I am trying to write a major mode for language that's used at my
> workplace. Function-type blocks take the form
> METHOD [methodName]
> Obviously, it's easy to write an imenu regexp for that line. However,
> "functions" associated with a certain window take the form
> WINDOW [windowName] (windowObjectAssociatedWith)
> Two windows could have identically named windowObjects. I would like
> an imenu that looks something like this:
> Imenu
> FunctionFoo1
> FunctionFoo2
> Window >
> Window1 >
> windowFunctionFoo1
> windowFunctionFoo2
> Window2 >
> windowFunctionFoo1
> windowFunctionFoo2
I don't have a concrete answer for you, but you might get some help for part of
it by looking at this code: http://www.emacswiki.org/cgi-bin/wiki/imenu%2b.el.
Maybe, maybe not.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: "Dynamic" Imenu
2008-08-21 15:21 "Dynamic" Imenu Eric
2008-08-22 4:48 ` Drew Adams
@ 2008-08-22 14:10 ` Scott Frazer
1 sibling, 0 replies; 3+ messages in thread
From: Scott Frazer @ 2008-08-22 14:10 UTC (permalink / raw)
To: help-gnu-emacs
Eric wrote:
> I am trying to write a major mode for language that's used at my
> workplace. Function-type blocks take the form
> METHOD [methodName]
> Obviously, it's easy to write an imenu regexp for that line. However,
> "functions" associated with a certain window take the form
> WINDOW [windowName] (windowObjectAssociatedWith)
> Two windows could have identically named windowObjects. I would like
> an imenu that looks something like this:
> Imenu
> FunctionFoo1
> FunctionFoo2
> Window >
> Window1 >
> windowFunctionFoo1
> windowFunctionFoo2
> Window2 >
> windowFunctionFoo1
> windowFunctionFoo2
> So that the Window submenu has submenus, where each submenu is the
> name of a window.
> Alternatively, the imenu could simply contain submenus that are the
> name of the window. So
> Imenu
> FunctionFoo1
> FunctionFoo2
> Window1 >
> windowFunctionFoo1
> windowFunctionFoo2
> Window2 >
> windowFunctionFoo1
> windowFunctionFoo2
>
> I've wrestled with the lisp for a while, but I can't think of a way to
> do this with the imenu-generic-expression variable. Any suggestions?
> Is this even possible with an imenu?
Use the imenu-create-index-function variable. You set it to a function
(you would create) to scan the current buffer and build an alist with the
function tree you want. That var will point you to imenu--index-alist
that has the format you need to create, and so on.
Scott
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-08-22 14:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-21 15:21 "Dynamic" Imenu Eric
2008-08-22 4:48 ` Drew Adams
2008-08-22 14:10 ` Scott Frazer
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.