unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* imenu question (or an alternative)
@ 2014-05-13 20:52 Doug Lewan
  2014-05-13 21:58 ` Drew Adams
  0 siblings, 1 reply; 2+ messages in thread
From: Doug Lewan @ 2014-05-13 20:52 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

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.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-13 21:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-13 20:52 imenu question (or an alternative) Doug Lewan
2014-05-13 21:58 ` Drew Adams

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).