all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Drew Adams <drew.adams@oracle.com>
Cc: help-gnu-emacs@gnu.org, philipp@haselwarter.org
Subject: Re: Tips for quick jumping back and forth
Date: Wed, 11 Jul 2012 21:31:52 +0400	[thread overview]
Message-ID: <4FFDB888.6050002@yandex.ru> (raw)
In-Reply-To: <2F7782F6CA4745A3A13E350FB63DD025@us.oracle.com>

On 11.07.2012 19:02, Drew Adams wrote:
>>   > It'd be neat if there were different ways to navigate
>>   > through the ring; when I discovered Toby Cubitt's
>>   > excellent undo-tree-mode it somewhat revolutionized
>>   > my editing habits. I imagine that having a tree-like
>>   > representation of the marks that allows to easily
>>   > navigate back and forth would be very pleasant.
>>
>> Not sure about sideways navigation, but at least going back
>> and forward between marks would be an improvement.
>>
>> The distinction between local and global mark rings also, I think,
>> complicates things.
>
> What you want is a quick way to navigate to any previously marked position.  And
> of course a quick way to mark each position (e.g. a quick key).  It does not
> matter what "mark" means here - it could be but need not be an Emacs marker
> (e.g. from `C-SPC').

That's correct, except many useful functions, such as `imenu', 
`find-function', and `isearch-mode', automatically push mark before 
performing navigation. So the mark rings become a centralized source of 
information on "where I was before I did that thing".

> AFAICT, it also does not matter whether the marks were defined using a treelike
> pattern of navigation in the first place.  At least not to me, it doesn't.  And
> anyway you don't want to have imposed a particular navigation pattern (e.g. tree
> traversal of some sort).  You want to be able to navigate among marks in any
> order.

If you're just editing text, maybe. But I'd wager that most of the time 
people are using Emacs to read and edit program code.

When I'm reading code, I usually want to be able to follow the control 
flow: read the code of some function, jump into some function it calls, 
jump into some other function from it, etc.
The jumps may be contained to one file, or may be spread across several 
files - if I have to keep in mind which kind the last jump was when I 
want to return, that's a speed bump (hence my dislike for global vs 
local mark rings, etags.el does this better).

> More importantly, to navigate to an arbitrary "marked" position, you need
> _direct_ access.  It's of course also nice to be able to cycle among any group
> of those positions, including all of them.  But cycling, whether tree traversal
> or other, is essentially a fallback, primitive way to get where you want to go.

In the context I mentioned above, a tree could be a good way to 
represent the relations between marked positions. For example, if we 
save position before doing "jump to definition" and also save position 
before jumping back, a parent node would contain a position in a caller 
function, and each child node would point to a definition of a function 
called from parent (that we visited during the current editing session).
If the relations between nodes have defined meanings, traversing them 
will be fast, definitely faster than rings.
Because you know where you want to go, and you don't have to flip 
through the whole ring again if you miss your stop.

> To get to an arbitrary position - especially to get there directly, it helps for
> the position to have a name or to be highlighted in some way, so that you can
> easily (a) recognize it and (b) directly point to it (e.g. mouse, or name
> completion).

That's nice, except traversing along one or two edges of the tree would 
probably be faster (if you know which edges to follow, of course).

With direct access, you also lose the relationship context - like "the 
code I'm looking at now [calls|is called by] the code I was looking at a 
second ago".

> Here are two great ways to do these things, IMNSHO:
> <snipped>

I'll take a look at them, too, thanks.

--Dmitry



  reply	other threads:[~2012-07-11 17:31 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-11 13:36 Tips for quick jumping back and forth Dmitry Gutov
2012-07-11 14:40 ` Eric Abrahamsen
2012-07-11 15:02 ` Drew Adams
2012-07-11 17:31   ` Dmitry Gutov [this message]
2012-07-11 18:33     ` Drew Adams
2012-07-11 21:03       ` Dmitry Gutov
2012-07-11 23:44         ` Drew Adams
2012-07-12 21:30           ` Dmitry Gutov
     [not found] <mailman.4232.1341639863.855.help-gnu-emacs@gnu.org>
2012-07-07  8:02 ` José A. Romero L.
2012-07-07 10:48 ` Xah Lee
2012-07-08  4:25 ` B. T. Raven
2012-07-12  0:04 ` Edward at Work
  -- strict thread matches above, loose matches on Subject: below --
2012-07-07 15:27 Dmitry Gutov
2012-07-08  3:28 ` C K Kashyap
2012-07-08  3:31   ` suvayu ali
2012-07-08  3:35     ` C K Kashyap
2012-07-09  2:01     ` Ken Goldman
     [not found]   ` <mailman.4284.1341718295.855.help-gnu-emacs@gnu.org>
2012-07-08  3:47     ` rusi
     [not found] ` <mailman.4283.1341718129.855.help-gnu-emacs@gnu.org>
2012-07-08 17:28   ` Xah Lee
2012-07-07 13:39 Dmitry Gutov
2012-07-07  5:43 C K Kashyap
2012-07-07  6:19 ` Jambunathan K
2012-07-11  9:57   ` Philipp Haselwarter
2012-07-07  6:45 ` Andreas Röhler
2012-07-07 13:56 ` Francesco Mazzoli
     [not found] ` <mailman.4249.1341669396.855.help-gnu-emacs@gnu.org>
2012-07-07 14:44   ` notbob
2012-07-20 13:02     ` Kevin Rodgers
2012-07-20 13:15       ` Jambunathan K
2012-07-09  2:59 ` Le Wang

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=4FFDB888.6050002@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=philipp@haselwarter.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.
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.