From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Exploring a code base? Date: Tue, 27 Oct 2020 18:38:49 +0700 Message-ID: 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="11565"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 27 12:47:43 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 1kXNS2-0002tY-7D for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 27 Oct 2020 12:47:42 +0100 Original-Received: from localhost ([::1]:47192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXNS1-0002go-0Y for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 27 Oct 2020 07:47:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXNJh-00068n-Py for help-gnu-emacs@gnu.org; Tue, 27 Oct 2020 07:39:05 -0400 Original-Received: from mail-vs1-xe35.google.com ([2607:f8b0:4864:20::e35]:36547) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kXNJe-0002YH-NC for help-gnu-emacs@gnu.org; Tue, 27 Oct 2020 07:39:05 -0400 Original-Received: by mail-vs1-xe35.google.com with SMTP id h5so669580vsp.3 for ; Tue, 27 Oct 2020 04:39:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=sSahN3M3rTRxHnFCZlL1eO0Vl8Tzux/lYbM/O+fDezc=; b=Yfw8+3COSqlhWJECNsL8PNs1AkWv+eJa/HsjMHJshcPIMtO8WDiK+2swYDoX1aNXt3 eXDz5P+2SnsYwc8pXt4qq/T7uS8/b27agtzInR/3SBFw2n2TmGkHgvKDvWnYtfkP9/T8 4Jt/pmgkH2I1lBNUbs7VtKA6v/UJrltdzxsu6MJTIEG3balRCh+VeofoODSrAzZxJkRU pPuJopKVoLKJ+OfPj7RFkxXm56wTOFUNpKbqy/eluMlauFIwEkpsukWij2mmN2ssoX25 zZkuZVjjGQo7dhqWVtKlJmeCAgLcWxTx+V93apya4QkKWQGIxLI/+5EoO75/5sZ+nl3O oFcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=sSahN3M3rTRxHnFCZlL1eO0Vl8Tzux/lYbM/O+fDezc=; b=eX9B8IstloqxIZv0P6EFx6TnY7WJSrYnIwUnJnPt6XpqeNSkwUJMFsncsyNI8gDKwF 3iSUKkN1bLieMR+5dxMBHCG7CqbmTmcNYcV9AwXLQVsyI+BfIUzIOjXHsnJP8nhWeX25 Ult++VbJImomFSDjKmBpb+b6VLRRt2jMyH2ZzxZRUSZia5EP82QT4LJ2KJe4H2j6H1xA hQlz39r2RTvyHDICvO928Bg65vJevm9kunqwMEI8qM7uuq/0gxOirlpRLq5NhLP90HiZ XsdbBrPIPj1W4Sb2Lu8aHtKnLsXOcweQiQWIh54WHLmFkgSX8BGgEdphamT9JGF86TqV AmwQ== X-Gm-Message-State: AOAM531TyDOOxXKMFT9q7UikBgYpHSIHEBDicNrAph5POpEdqYI/Bwvg pAL71Dp043EoLC2dn7C+jOyogJ4Fg63rvJp+x4NkJbeZ X-Google-Smtp-Source: ABdhPJw2rjof9PC0aCBLDDaLcQ5Z6+kLsOQ2lf43ZZ+S8LRXf4SozV7L8bLSwU2ZJjacxNYPnlSSva+hYIkt+/wrUrQ= X-Received: by 2002:a67:3143:: with SMTP id x64mr940009vsx.12.1603798740287; Tue, 27 Oct 2020 04:39:00 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::e35; envelope-from=yurivkhan@gmail.com; helo=mail-vs1-xe35.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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:124732 Archived-At: 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=E2=80=99s = 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. * I find that I have a function, let=E2=80=99s call it make_foo, that retur= ns 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. * This leads to more functions that return Foo. I may want to inspect each of those recursively. Basically what I=E2=80=99m doing is traversal of a graph, where nodes are t= ype and function definitions, and edges are relationships such as =E2=80=9Cfunction function=E2=80=9D, =E2=80=9Cfunction ty= pe=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. When the change I=E2=80=99m doing is not very invasive, the affected subgra= ph 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. 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?