unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Doug Lewan <dougl@shubertticketing.com>, help-gnu-emacs@gnu.org
Subject: RE: imenu question (or an alternative)
Date: Tue, 13 May 2014 14:58:14 -0700 (PDT)	[thread overview]
Message-ID: <474810ca-8841-4982-a43f-a808c66c06e1@default> (raw)
In-Reply-To: <155DEC68569B714B86C2C7075F5EDA9892AB4F22@DAKIYA1.pegasus.local>

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



      reply	other threads:[~2014-05-13 21:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-13 20:52 imenu question (or an alternative) Doug Lewan
2014-05-13 21:58 ` Drew Adams [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

  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=474810ca-8841-4982-a43f-a808c66c06e1@default \
    --to=drew.adams@oracle.com \
    --cc=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).