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

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

Re: "Dynamic" Imenu


From: Scott Frazer
Subject: Re: "Dynamic" Imenu
Date: Fri, 22 Aug 2008 10:10:00 -0400
User-agent: Thunderbird 2.0.0.16 (Windows/20080708)

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


reply via email to

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