[Top][All Lists]

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

imenu question (or an alternative)

From: Doug Lewan
Subject: imenu question (or an alternative)
Date: Tue, 13 May 2014 20:52:48 +0000

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)
  (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?


Douglas Lewan
Shubert Ticketing
(201) 489-8600 ext 224

LISP: The most intelligent way to misuse a computer.

reply via email to

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