all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Exploring a code base?
@ 2020-10-27 11:38 Yuri Khan
  2020-10-27 11:58 ` Christopher Dimech
                   ` (6 more replies)
  0 siblings, 7 replies; 19+ messages in thread
From: Yuri Khan @ 2020-10-27 11:38 UTC (permalink / raw)
  To: help-gnu-emacs

Hello list,

often, when working on a project, I encounter the following need:

* I want to refactor a data structure. It has a unique name, let’s say
Foo, so I ‘M-x grep RET git grep Foo RET’. This gives me a Grep buffer
where I can inspect each place where that type is used explicitly.

* I find that I have a function, let’s call it make_foo, that returns
an instance of that type. There is also a consume_foo that accepts an
argument of that type. I now want to inspect all usages of those
because my refactoring may affect them. So I put point on make_foo and
invoke ‘xref-find-references’.

* This leads to more functions that return Foo. I may want to inspect
each of those recursively.

Basically what I’m doing is traversal of a graph, where nodes are type
and function definitions, and edges are relationships such as
“function <calls> function”, “function <accepts> type”, “function
<returns> type”, “type <derives from> type”, “type <aggregates> type”,
etc.

When the change I’m doing is not very invasive, the affected subgraph
fits completely in my head. However, when it doesn’t, I find myself
having to record my traversal state. I create an Org buffer and
manually maintain a queue of nodes, marking those I haven’t yet
visited with TODO and those I have with DONE. Then I pick the first
TODO, grep or xref-find-references on it, add any relevant nodes to
the queue, make the necessary changes in the code, and mark the node
DONE. Repeat until no TODO.

This is rather tedious. It feels like there should exist a better way,
maybe with a visualization of the graph structure.

What do you use to explore and map a code base and perform extensive
changes on it?



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2020-11-07 19:40 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-27 11:38 Exploring a code base? Yuri Khan
2020-10-27 11:58 ` Christopher Dimech
2020-10-27 14:15 ` Stefan Monnier
2020-10-27 15:55 ` Drew Adams
2020-10-27 20:56 ` Dmitry Gutov
2020-11-07 13:26   ` Yuri Khan
2020-11-07 13:56     ` Eli Zaretskii
2020-11-07 14:33       ` Gregory Heytings via Users list for the GNU Emacs text editor
2020-11-07 14:47         ` Eli Zaretskii
2020-11-07 15:32           ` Gregory Heytings via Users list for the GNU Emacs text editor
2020-11-07 15:52             ` Stefan Monnier
2020-11-07 15:58               ` Eli Zaretskii
2020-11-07 17:24                 ` Eric Abrahamsen
2020-11-07 19:23               ` Dmitry Gutov
2020-11-07 19:40     ` Dmitry Gutov
2020-10-27 20:59 ` Perry Smith
2020-10-27 22:53 ` Daniel Martín
2020-10-27 23:15   ` Stefan Monnier
2020-10-28  0:59 ` Skip Montanaro

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.