From: Doug Lewan <dougl@shubertticketing.com>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: imenu question (or an alternative)
Date: Tue, 13 May 2014 20:52:48 +0000 [thread overview]
Message-ID: <155DEC68569B714B86C2C7075F5EDA9892AB4F22@DAKIYA1.pegasus.local> (raw)
I've written a small mode for editing files containing lists of certain formats. I use which-function-mode (i.e. imenu) to index the lists.
Such lists might have a "preferred" entry depending on what directory it's in. The mode starts by putting the point on the "preferred" entry. This is nice, but then the imenu index starts only at that entry which makes the whole which-function/imenu combination less useful than it might be.
Here's the mode's current definition with the go-to-issue code at the very end. FYI without those two lines, the Issues menu gets populated correctly.
(define-derived-mode issues-mode text-mode "issues"
"Major mode for files that might contain issues."
:keymap 'issues-mode-map
(make-local-variable 'beginning-of-defun-function)
(make-local-variable 'end-of-defun-function)
(setq beginning-of-defun-function 'iss-beginning-of-issue)
(setq end-of-defun-function 'iss-end-of-issue)
(setq imenu-create-index-function 'iss-mode-create-index)
(setq imenu-sort-function 'imenu--sort-by-position)
(unless which-function-mode
(require 'which-func)
(which-function-mode))
(imenu-add-to-menubar "Issues")
(let ((issue (iss-get-issue-for-directory)))
(imenu issue)))
Is there a magic incantation that I don't know to make this do the right thing? (Is there an appropriate alternative to which-function/imenu?
Thanks.
,Douglas
Douglas Lewan
Shubert Ticketing
(201) 489-8600 ext 224
LISP: The most intelligent way to misuse a computer.
next reply other threads:[~2014-05-13 20:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-13 20:52 Doug Lewan [this message]
2014-05-13 21:58 ` imenu question (or an alternative) Drew Adams
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=155DEC68569B714B86C2C7075F5EDA9892AB4F22@DAKIYA1.pegasus.local \
--to=dougl@shubertticketing.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).