From: Dmitry Gutov <dgutov@yandex.ru>
To: Drew Adams <drew.adams@oracle.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Tips for quick jumping back and forth
Date: Fri, 13 Jul 2012 01:30:44 +0400 [thread overview]
Message-ID: <4FFF4204.2040107@yandex.ru> (raw)
In-Reply-To: <13BA66DA5FBC432785CE408796BD71AD@us.oracle.com>
On 12.07.2012 3:44, Drew Adams wrote:
>> How to save a tree structure that would be generally useful, that's a
>> harder question.
>
> Apparently you are interested in only the subset of the code tree/graph made up
> of the nodes you have already visited. Doesn't sound like a biggee.
The full function call graph may be useful, but we don't have that in
Emacs, at least not for most of the supported languages (CEDET?).
So we can try to rebuild it partially by tracing start and destination
points of invocations of select navigation functions.
The harder part is grouping start points into single node. When we visit
different functions called inside a certain function, we'll do that from
different buffer positions. How do we decide that the parent node for
resulting graph edges should be the same? `beginning-of-defun' and
`end-of-defun' come to mind, but they don't really work for nested
functions in js-mode, or for methods in ruby-mode (they just move to the
beginning or end of the class).
I guess we could just track the last used node, but this way the
resulting graph may deviate further from the call graph.
> Or do you want to also present neighbor but unvisited nodes as candidates? And
> possibly not just immediate neighbors but nearby neighbors? I don't hear that
> you have quite decided this. But I thought that your previous description
> involved only visited nodes as candidates.
Navigating a full code graph, provided we have one, would be different.
For one, it's not hierarchical, any function can call any other
function, so there can be multiple "parent" nodes, and we'd need to be
able to choose the destination node when we're going "back", not just
when going "forward".
>> Actually, the answer to that is "maybe", depending on how distant the
>> cousin is, and how well I know the code. For example, if I'm
>> not sure I remember the cousin's exact name, I might pop to the common
>> ancestor and follow from there, to be sure I know where I'm going.
>> If I had a visual representation of the tree, that would be
>> even better.
>
> I guess you mean a visual representation of the bushy tree itself, in addition
> to a visual representation of only the nodes you have visited. Perhaps you mean
> the latter superimposed on the former.
No I mean only the visited nodes. You can't bookmark unvisited nodes
either, so the comparison is meaningless there.
>>>>> 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).
>>>
>>> Why do you think so?
>>
>> It's just one or two key combinations away.
>
> Not at all. The only (already visited) parts of the tree that are only one or
> two key combinations away are those that are, well, one or two key combinations
> away!
Sure, I just meant that for closest candidates it would be easier to
jump along the edges than filter and choose.
Also, I think that you want to do that more often than jump to a faraway
node, simply because when you're reading or writing, you mostly think
about and touch directly related pieces of code.
> And they would be the same distance away if you ordered candidates by last
> visit, for instance. Especially if your navigation model is only from node to
> immediately adjacent node.
Not the last visited, but the closest by distance in edges, probably.
I could have just came from a very distant tree node, for example, by
traversing the edges, or with direct jump. The closest nodes definitely
won't be the most recently visited ones.
>> That's always faster than invoking the list, entering search
>> criteria, picking, etc.
>
> You seem to be using last-visited as your metric of which nodes to represent as
> nearby. And apparently you are interested only in, say, the Nth nearest (by
> visit time), to reduce your search space.
No, "previously visited node" was just an easy illustration. If we want
to build and use a graph, it won't be adequately represented by any
linear ordering.
> You can (programmatically) make it quickest and easiest to get to any particular
> set of nodes you choose, by controlling the set and the order. And you can
> limit the set size to simplify choosing.
That's quite neat.
> Wrt the automatic creation of bookmarks, I should mention also that Bookmark+
> has a (buffer-local or global) mode to do that, which is based on time spent at
> a given position with the position's buffer current:
> `bmkp-auto-idle-bookmark-mode'.
That might be useful.
> You can define the bookmarking function that is used for this. By default it
> sets a temporary, autonamed bookmark at the start of the current line. But it
> could do anything you like, including pay attention to the code structure and
> code parts already visited etc.
I don't see how it can recreate the code structure from a set of points
I spent some time at. Sure, it can group the points somehow, but not
build directional relations.
next prev parent reply other threads:[~2012-07-12 21:30 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
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 [this message]
[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=4FFF4204.2040107@yandex.ru \
--to=dgutov@yandex.ru \
--cc=drew.adams@oracle.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.
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.