From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Dimech Newsgroups: gmane.emacs.help Subject: Re: Exploring a code base? Date: Tue, 27 Oct 2020 12:58:23 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14992"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: Yuri Khan Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 27 13:15:18 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kXNsj-0003n8-Do for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 27 Oct 2020 13:15:17 +0100 Original-Received: from localhost ([::1]:46388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXNsg-0001kE-Pd for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 27 Oct 2020 08:15:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXNcT-0006oE-Ml for help-gnu-emacs@gnu.org; Tue, 27 Oct 2020 07:58:30 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:47351) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXNcQ-0000yj-L5 for help-gnu-emacs@gnu.org; Tue, 27 Oct 2020 07:58:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1603799903; bh=7QTSZjcq0QCrl9ogVnYGnxfRm5wygfyqBmFE8Xj+g9s=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=IogoIwKi/gg96h9xqUO5VILTP8IJIT3skWN+T4e6XSpyXWhTa+lppa5TQ82q4xvWf 322csTHG9lztw6R7QtK6BfjH9VifLcgBk/UtBhJ/sNfGQTlek2RWm1GkK3a9cykeKd ETOKiufPmtQepue8ugD4lzT/PTYa0jrYIlcl0EI0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs12.server.lan [172.19.170.180]) (via HTTP); Tue, 27 Oct 2020 12:58:23 +0100 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:juCygdmkERA0r9elYyJHVKpiEpCCuMUsK2YnKeWo41WQSilf8mNuB0+AdSZdFbPEJGoTC QBXezkpBCI8/rDs07GDBzzEDtfdwydTtSInwAVMDcU39Diogouh7pR+HPH0IbLiiC6DVZRA56sj8 w4CEX5XH92WlYPUFOW+DEvHZ5NgXJsuNB2tLhPln2nIOVf9LtlV6TIJ3WizJeSYnAmReYmEFv0TE Du8bCcu47fjT0NVn+yaMaU36XOF2c0M/zKdHj2Kg6VUElwbFO7OzhLaUyBC4bIVF5Y3yFNGHVuGN 9U= X-UI-Out-Filterresults: notjunk:1;V03:K0:hQEUGJX5pzY=:piJwmolvGZrNsZDiTnjDiL arBboew3NjAt/NAjiui/ePrFVkjDQi9N3z82HkX/xT5uw5l0XiE9gOzwpeaD8g5q2KoUHJW8w OJ7ByWFsaYSJZAUqWNr4Ii0Ii5Hx8qT/E3HbBXf6RFxIBaIIttG7a6VgmccL+b9W8nzxBo+LN H0t73RtpkOzOEWh1r3h9ZgVXPTlMSpTMobVY8JrZwCO+sFyrrjXOj+0Iwf23QgejQtDN3HaPV K+eMn4692lSMRNfPXfE91LVA7+lbM5682zgVAwlgrWGx0HE70V2om2s9NXQSa8KriWARuG2Jt PEECPfU3z0qltGUNuZSgRIMwKeU2kMVHimmZupAUSaGbmpdMgGblPw5f/pKbApLH427ddjN6x JzpurZOPpBFyu1lYZCvOSj8ozsHpIzEUm5mq0J3kZTinunWmfXt9nZoaMw8O5bJkLTEKoKAK/ sNe+qfDQFUYvG4lHlNVnw94k2uFfARP37HMuzMW1NbXkoTsPNGCmAA+YLKq2Emd5yvBzwBSob xRWBEqIgYpd2XAzsOtWdhYv0A1+P8k6eqw+/E2idWz3MDpTpnDUw5XfoJuKxnOzLvR0mLTWmy FkIlNnQ3nBTZ4= Received-SPF: pass client-ip=212.227.17.21; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 07:58:24 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:124733 Archived-At: There is the Graph Description Language, Dot=2E --------------------- Christopher Dimech General Administrator - Naiad Informatics - GNU Project (Geocomputation) - Geophysical Simulation - Geological Subsurface Mapping - Disaster Preparedness and Mitigation - Natural Resource Exploration and Production - Free Software Advocacy > Sent: Tuesday, October 27, 2020 at 12:38 PM > From: "Yuri Khan" > To: "help-gnu-emacs" > Subject: Exploring a code base? > > Hello list, >=20 > often, when working on a project, I encounter the following need: >=20 > * I want to refactor a data structure=2E It has a unique name, let=E2=80= =99s say > Foo, so I =E2=80=98M-x grep RET git grep Foo RET=E2=80=99=2E This gives = me a Grep buffer > where I can inspect each place where that type is used explicitly=2E >=20 > * I find that I have a function, let=E2=80=99s call it make_foo, that re= turns > an instance of that type=2E There is also a consume_foo that accepts an > argument of that type=2E I now want to inspect all usages of those > because my refactoring may affect them=2E So I put point on make_foo and > invoke =E2=80=98xref-find-references=E2=80=99=2E >=20 > * This leads to more functions that return Foo=2E I may want to inspect > each of those recursively=2E >=20 > Basically what I=E2=80=99m doing is traversal of a graph, where nodes ar= e type > and function definitions, and edges are relationships such as > =E2=80=9Cfunction function=E2=80=9D, =E2=80=9Cfunction = type=E2=80=9D, =E2=80=9Cfunction > type=E2=80=9D, =E2=80=9Ctype type=E2=80=9D, =E2= =80=9Ctype type=E2=80=9D, > etc=2E >=20 > When the change I=E2=80=99m doing is not very invasive, the affected sub= graph > fits completely in my head=2E However, when it doesn=E2=80=99t, I find m= yself > having to record my traversal state=2E I create an Org buffer and > manually maintain a queue of nodes, marking those I haven=E2=80=99t yet > visited with TODO and those I have with DONE=2E 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=2E Repeat until no TODO=2E >=20 > This is rather tedious=2E It feels like there should exist a better way, > maybe with a visualization of the graph structure=2E >=20 > What do you use to explore and map a code base and perform extensive > changes on it? >=20 >