all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Brendan Miller <catphive@catphive.net>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: unifying emacs "go to definition" functionality
Date: Wed, 20 Feb 2013 08:54:05 +0400	[thread overview]
Message-ID: <87txp7d1qq.fsf@yandex.ru> (raw)
In-Reply-To: <CADOO-JyPRaXWLvh0U3XE+H2pQbO8dbEOqL1CKw7mRs5j_1nRoQ@mail.gmail.com> (Brendan Miller's message of "Tue, 19 Feb 2013 16:28:04 -0800")

Brendan Miller <catphive@catphive.net> writes:

> Right now emacs has several modules that offer "go to definition"
> functionality, all of which have different implementations, and
> different behavior.
>
> 1. Etags uses M-. and M-* to push and pop from a pair of tag stacks
> (find-tag-marker-ring, and tags-location-ring).
>
> 2. elisp uses C-h f TAB RETURN to jump to definition. It has no tag
> stack, so there's no way to jump back.

It's actually C-x F for Elisp if your use which-func, or whatever
binding you have for find-function (by default, none).

> 3. CEDET uses C-c , J to jump to definition. It has no tag stack,
> though it pushes to the global mark ring.
>
> 4. Jedi (jump to definition/autocompletion for python) uses C-. It has
> no tag stack.
>
> 5. SLIME uses etags keybindings, but I don't think it uses etags stack.
>
> By far the etags interface (M-. to jump to definition and push the
> location, M-* to pop back), is the easiest interface to use, though
> the underlying tagging engine is less precise than the others.

I agree than etags's push/pop interface is the easiest in this list, but
it also has room for improvement.

> My suggestion is that the etags key bindings and tag stack be made
> generic, and that M-. trigger some kind of callback through a buffer
> local variable, so that jump to definition can be handled in a mode
> specific way.

The "callback" part seems to be the easiest (you add a
save-buffer-position-function variable and make sure all navigation
functions call it), and also the most important, I think.

This way, the user we can have a navigation system that is a drop-in
replacement for mark and tag rings.

I have a small package that does that through advice, but that means I
need to hardcode every function that does navigation, by hand, and/or
ask any potential user to do that, too.

https://github.com/dgutov/point-stack

> Note that in addition to reusing the same keybindings, reusing the
> same tag stack gives that added benefits that it's possible to
> navigate through a high level language into a lower level language,
> and then pop back out with M-*. I have this mocked up (in kind of a
> hacky way) with elisp and C, where I can jump from elisp into the C
> definition of a native function, navigate around C with etags or
> CEDET, and then pop back out back into elisp again.

Using the same keybindings for the jump commands is, on one hand,
something that each user can set up themselves (it's customary to expect
users to set their own keybindings), on the other, I looks hard to do
something about this and retain backward compatibility at the same time.

Unless everybody agrees that M-. is the way to go, of course. If you'd
like to standardize on M-* too, then everybody would also need to agree
which storage facility to use (e.g. mark ring or tag ring, and we have
two mark rings, so the two ways are not exactly equivalent).



  parent reply	other threads:[~2013-02-20  4:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-20  0:28 unifying emacs "go to definition" functionality Brendan Miller
2013-02-20  3:00 ` Stefan Monnier
2013-02-20  4:54 ` Dmitry Gutov [this message]
2013-02-20  6:59 ` Andreas Röhler
2013-02-20 13:44   ` Dmitry Gutov
2013-02-20  8:52 ` Helmut Eller
2013-02-20  9:07   ` Andreas Schwab
2013-02-20  9:28     ` Helmut Eller
2013-02-20  9:36       ` Andreas Schwab
2013-02-20  9:45         ` Helmut Eller
2013-02-20 13:51         ` Stefan Monnier
2013-02-20  9:59   ` Lawrence Mitchell
2013-02-20 10:21     ` Jambunathan K
2013-02-20 10:40       ` Jambunathan K
2013-02-20 15:21     ` 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87txp7d1qq.fsf@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=catphive@catphive.net \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.