all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Scott Frazer <frazer.scott@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: "Dynamic" Imenu
Date: Fri, 22 Aug 2008 10:10:00 -0400	[thread overview]
Message-ID: <1219414201.333291@sj-nntpcache-2.cisco.com> (raw)
In-Reply-To: <0b993bb6-6837-4747-a8d0-360405d0075c@x41g2000hsb.googlegroups.com>

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


      parent reply	other threads:[~2008-08-22 14:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-21 15:21 "Dynamic" Imenu Eric
2008-08-22  4:48 ` Drew Adams
2008-08-22 14:10 ` Scott Frazer [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1219414201.333291@sj-nntpcache-2.cisco.com \
    --to=frazer.scott@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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.