From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Perry Smith Newsgroups: gmane.emacs.help Subject: Re: Exploring a code base? Date: Tue, 27 Oct 2020 15:59:21 -0500 Message-ID: References: Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) 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="4211"; 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 22:01:24 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 1kXW5r-0000yF-NA for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 27 Oct 2020 22:01:23 +0100 Original-Received: from localhost ([::1]:43004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXW5q-0007AS-PC for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 27 Oct 2020 17:01:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXW4k-0007A4-VE for help-gnu-emacs@gnu.org; Tue, 27 Oct 2020 17:00:15 -0400 Original-Received: from beige.elm.relay.mailchannels.net ([23.83.212.16]:30459) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXW4f-0000go-2c for help-gnu-emacs@gnu.org; Tue, 27 Oct 2020 17:00:11 -0400 X-Sender-Id: a2hosting|x-authuser|pedz+easesoftware.com@mi3-ss4.a2hosting.com Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 333A2180F7B; Tue, 27 Oct 2020 20:59:25 +0000 (UTC) Original-Received: from mi3-ss4.a2hosting.com (100-96-27-64.trex.outbound.svc.cluster.local [100.96.27.64]) (Authenticated sender: a2hosting) by relay.mailchannels.net (Postfix) with ESMTPA id 7E00318175D; Tue, 27 Oct 2020 20:59:24 +0000 (UTC) X-Sender-Id: a2hosting|x-authuser|pedz+easesoftware.com@mi3-ss4.a2hosting.com Original-Received: from mi3-ss4.a2hosting.com (mi3-ss4.a2hosting.com [68.66.200.199]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.10); Tue, 27 Oct 2020 20:59:25 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: a2hosting|x-authuser|pedz+easesoftware.com@mi3-ss4.a2hosting.com X-MailChannels-Auth-Id: a2hosting X-Broad-Bottle: 1bcb253b141e060a_1603832364941_828245359 X-MC-Loop-Signature: 1603832364941:1516286523 X-MC-Ingress-Time: 1603832364941 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=easesoftware.com; s=default; h=To:References:Message-Id: Content-Transfer-Encoding:Cc:Date:In-Reply-To:From:Subject:Mime-Version: Content-Type:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=9kD9YckiIYtqAbJCwNtrQDpLWMHn/MVyIgtTOV5H8OA=; b=QAge9CQMNLqXXnaQ7IIT8CPlN 8pLizaGjaFlY+A/RJs49ZdWTfwRy4QTPwbKidgNqOQY3VCyiMokK9j8jSp5nvUmLIODXoj33kIGUq 8cJoDaJMjVIO+BkD8Bu5Hz0Wbspt5EWhZuV0hEHixSRAWdFPwWO62zUQf/ntFBhJaLWITBsQJC+uk INAnhD1x21/UUPkx7FQyuwxFVKcmzk94vJlkqKwXfKjWeFbo6r7N0uR8pckC5wt6t2q1xxicU5GJE z+nGr0Kcbp7UGDu7bWYM0RComkj9OlmwPbLCtWv5Pjd8RIk2uHlv979ErBXHesa30bBIaWGjcVq1u KSFOudKbg==; Original-Received: from mobile-107-107-187-228.mycingular.net ([107.107.187.228]:42146 helo=macbook-pro.localdomain) by mi3-ss4.a2hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1kXW3u-0007NO-LN; Tue, 27 Oct 2020 16:59:22 -0400 In-Reply-To: X-Mailer: Apple Mail (2.3608.120.23.2.4) X-AuthUser: pedz+easesoftware.com@mi3-ss4.a2hosting.com Received-SPF: pass client-ip=23.83.212.16; envelope-from=pedz@easesoftware.com; helo=beige.elm.relay.mailchannels.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 16:59:25 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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:124750 Archived-At: For C, cscope and a package that interfaces cscope to emacs is great. > On Oct 27, 2020, at 6:38 AM, Yuri Khan wrote: >=20 > Hello list, >=20 > often, when working on a project, I encounter the following need: >=20 > * I want to refactor a data structure. It has a unique name, let=E2=80=99= s say > Foo, so I =E2=80=98M-x grep RET git grep Foo RET=E2=80=99. This gives = me a Grep buffer > where I can inspect each place where that type is used explicitly. >=20 > * I find that I have a function, let=E2=80=99s 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 =E2=80=98xref-find-references=E2=80=99. >=20 > * This leads to more functions that return Foo. I may want to inspect > each of those recursively. >=20 > Basically what I=E2=80=99m doing is traversal of a graph, where nodes = are 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. >=20 > When the change I=E2=80=99m doing is not very invasive, the affected = subgraph > fits completely in my head. However, when it doesn=E2=80=99t, 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=E2=80=99t = 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. >=20 > This is rather tedious. It feels like there should exist a better way, > maybe with a visualization of the graph structure. >=20 > What do you use to explore and map a code base and perform extensive > changes on it? >=20