Subject: bug#78250: closed (Re: bug#78250: 31.0.50; Eglot: eglot-show-call-hierarchy)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 08 May 2025 20:44:02 +0000

Your bug report

#78250: 31.0.50; Eglot: eglot-show-call-hierarchy

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
78250: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78250
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#78250: 31.0.50; Eglot: eglot-show-call-hierarchy
From: João Távora <[email-masked]>
To: Gerd Möllmann <[email-masked]>
Cc: Eli Zaretskii <[email-masked]>, [email-masked]
Date: Thu, 08 May 2025 21:43:36 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Gerd Möllmann <[email-masked]> writes:

> What I meant is, for example, when I C-n down to an interesting line and
> press TAB or RET. I would have naively expected that to do something but
> it only complains "buffer is read-only".

Why not go to that line with TAB, instead of mixing C-n and TAB?

>> dependency on a new graph-representation library.  Perhaps you could
>> lift the bespoke one that profiler.el uses into a new library?  Call it
> Well, what can I say :-). I don't feel that's something for me, sorry.

What can _I_ say, except "it's your itch" :-)".  Well if you don't want
to work on a better solution you can always bind keys to whatever you
like in eglot-hierarchy-mode-map.

>> Just a note that I've experimented with hierarchy.el (which uses
>> tree-widget.el) and found it brings no benefit at all over directly
>> calling tree-widget.el.
>
> Just looked at eglot-supplements - it's using its own tree
> implementation 'toggletree.el', AFAICT.

Haven't looked, but if it's good, ask the author to bring it into Emacs.

>> Anyway, please try the patch after my sig.  It fixes the mis-navigations
>> you reported.
>
> Yes, that works. Thanks for the fix!

I'll push it as soon as savannah recovers (seems to be down now).

João

PS: if you use clangd on Emacs' repo, here's a patch to .clangd you
might like. 

diff --git a/.clangd b/.clangd
index 469d33dfd03..5c7308d64ae 100644
--- a/.clangd
+++ b/.clangd
@@ -2,4 +2,5 @@
 If:
     PathMatch: "src/*.c"
 CompileFlags:
-    Add: [-Wno-unused-macros, -include=config.h]
+    Add: [-Wno-unused-macros, -include=config.h, -fstrict-flex-arrays=3]
+    Remove: [-fstrict-flex-arrays]

Subject: 31.0.50; Eglot: eglot-show-call-hierarchy
From: Gerd Möllmann <[email-masked]>
To: [email-masked]
Date: Mon, 05 May 2025 05:36:39 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

In GNU Emacs 31.0.50 (build 1, aarch64-apple-darwin24.4.0) of 2025-05-04

This is in an Emacs repository, with clangd 20.1 installed via Homebrew
on macOS.

In insdel.c, navigate to function insert_and_inherit, then, on the
function name, C-u M-x eglot-show-call-hierarchy RET and choose
outgoing.

The resulting buffer looks like this:

  [-]  ∘ insert_and_inherit
   |-[+]  → chars_in_text
   |-[+]  → insert_1_both
   |-[+]  → signal_after_change
   `-[+]  → update_compositions

1. Wishlist: Expanding/collapsing nodes and jumping to call sites is not
easily reachable with the "usual" keys like TAG, RET, and so on that are
used by the profiler, Magit etc. It would be very nice if that could be
added.

2. Bug: Clicking on "chars_in_text" in the tree above takes me here:

character.c:
  586 ptrdiff_t
  587 str_as_multibyte (unsigned char *str, ptrdiff_t len, ptrdiff_t nbytes,
  588                   ptrdiff_t *nchars)
  589 {

Clicking on "insert_1_both" OTOH takes me here which is correct

insdel.c:
  581 void
  582 insert_and_inherit (const char *string, ptrdiff_t nbytes)
  583 {
  584   if (nbytes > 0)
  585     {
  586       ptrdiff_t len = chars_in_text ((unsigned char *) string, nbytes), opoint;
  587       insert_1_both (string, len, nbytes, 1, 1, 0);

Clicking on "signal_after_change" is also correct, and clicking on
update_compositions is incorrect again.

The outgoing call tree I get from eglot-supplements does all correctly.