[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: imenu question (or an alternative)
From: |
Drew Adams |
Subject: |
RE: imenu question (or an alternative) |
Date: |
Tue, 13 May 2014 14:58:14 -0700 (PDT) |
> 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?
FWIW, I don't quite follow you. `(imenu ISSUE)' should just go to the
position specified by ISSUE. In particular, it should not change what
is in the `Issues' menu.
What do you mean by "then the imenu index starts only at that entry"?
And by menu `Issues' not getting populated correctly? Calling `imenu'
should not have any bearing on what gets populated to menu `Issues',
which is done by `imenu-add-to-menubar'.
Without really understanding your problem, I'd suggest using
`M-x debug-on-entry imenu-add-to-menubar', to see why `Issues' is
not being populated with what you think it should be.
Or if you think that it is the call to `imenu' that somehow screws
up the menu, then trace that through the debugger, to see just what
it is doing.