GNU bug report logs - #79980
Eglot property support in imenu

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Juri Linkov <juri@HIDDEN>; dated Wed, 10 Dec 2025 07:42:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 79980 <at> debbugs.gnu.org:


Received: (at 79980) by debbugs.gnu.org; 10 Dec 2025 17:40:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 10 12:40:06 2025
Received: from localhost ([127.0.0.1]:35658 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vTOAY-00016o-0t
	for submit <at> debbugs.gnu.org; Wed, 10 Dec 2025 12:40:06 -0500
Received: from mout-p-202.mailbox.org ([80.241.56.172]:60962)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1vTOAV-000141-HY
 for 79980 <at> debbugs.gnu.org; Wed, 10 Dec 2025 12:40:04 -0500
Received: from smtp102.mailbox.org (smtp102.mailbox.org
 [IPv6:2001:67c:2050:b231:465::102])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4dRNJp1S4Bz9t8d;
 Wed, 10 Dec 2025 18:39:54 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; 
 t=1765388394;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=yuhtet196xTi0AOSfX6kf5TyUAibhqp525weCBRkbk0=;
 b=s3mjWc3ncdU1zYZhb3aFrCV9kVYKVNWRVtFj+UP0T83ov5TFwuxZtoPfoLEvREWNxv+iF8
 +lpqMFONM5PVXLNIk3Gt+XB2ddKKa4xKDlmvhdeumi+VH8Tsk45dfGN/4F2vW9EvAOCGDm
 2cwDMypzYRmYMgCZRigP2LeIkbZPVFk4Q7IfB7RZGr+4t7tOIFcGTbxvCn8C94CbXSZora
 t3XLf8HdQIy6VKik3QqAfschcn+Lj6AHsNyTeiTWtCtAfuZ5tfgpW5YRdXf+wN1Hsow67u
 He19K712MAF9IAb5GFvRjW70x0+qVViToMZXO3UFlFXvydcUGimD2SeFXRblhQ==
Authentication-Results: outgoing_mbo_mout; dkim=none;
 spf=pass (outgoing_mbo_mout: domain of juri@HIDDEN designates
 2001:67c:2050:b231:465::102 as permitted sender)
 smtp.mailfrom=juri@HIDDEN
From: Juri Linkov <juri@HIDDEN>
To: =?iso-8859-1?Q?Jo=E3o_T=E1vora?= <joaotavora@HIDDEN>
Subject: Re: bug#79980: Eglot property support in imenu
In-Reply-To: <CALDnm52Vqjyj5Uat7gx5J6WYVidnhUiuZsFrZW1DeCkQaTfa+A@HIDDEN>
Organization: LINKOV.NET
References: <87345ikcwt.fsf@HIDDEN>
 <CALDnm52Vqjyj5Uat7gx5J6WYVidnhUiuZsFrZW1DeCkQaTfa+A@HIDDEN>
Date: Wed, 10 Dec 2025 19:33:19 +0200
Message-ID: <87ecp2i73s.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Rspamd-Queue-Id: 4dRNJp1S4Bz9t8d
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 79980
Cc: sbaugh@HIDDEN, 79980 <at> debbugs.gnu.org, azeng@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> So yes, I guess you can "bless"  'breadcrumb-region' and 
> 'breadcrumb-jump'  as a de-facto metainfo protocol, much like some 
> `company-*` properties for the company-mode external package.  
> But are other packages making use of this protocol?

I'm not aware of other packages using this protocol.

>     Below is a patch that does this while supporting both cases:
>
>     1. when imenu-flatten is non-nil, it adds completion candidates
>        for jumpable parent nodes using the 'breadcrumb-region' text
>     property;
>
>     2. when imenu-flatten is nil, it adds a new menu entry ".."
>        to be able to navigate to a non-leaf node:
>
> What exactly is the use case/problem you're trying to cover/solve?  
> Imenu of Emacs 31+breadcrumb without Eglot?  Imenu of 
> Emacs 31+some other package? Another case? 

It's expected to handle the case of Imenu of Emacs 31 without Eglot
without regressions.  And also to add handling of Emacs 31 with Eglot.

> Have you tested with Imenu 31+breadcrumb+Eglot?

Yes, tested Imenu 31 with Eglot and breadcrumb.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79980; Package emacs. Full text available.

Message received at 79980 <at> debbugs.gnu.org:


Received: (at 79980) by debbugs.gnu.org; 10 Dec 2025 08:04:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 10 03:04:42 2025
Received: from localhost ([127.0.0.1]:58711 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vTFBi-0000VU-7w
	for submit <at> debbugs.gnu.org; Wed, 10 Dec 2025 03:04:42 -0500
Received: from mail-oo1-xc2d.google.com ([2607:f8b0:4864:20::c2d]:59826)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <joaotavora@HIDDEN>)
 id 1vTFBg-0000V1-7t
 for 79980 <at> debbugs.gnu.org; Wed, 10 Dec 2025 03:04:40 -0500
Received: by mail-oo1-xc2d.google.com with SMTP id
 006d021491bc7-657a6028fbbso3350429eaf.3
 for <79980 <at> debbugs.gnu.org>; Wed, 10 Dec 2025 00:04:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1765353874; x=1765958674; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=nanfx9cA4WD66AxTPbcWFMhAPzHjBqFcJnjUjujc2rI=;
 b=BhsHjfUJHCzCndo71xGGkKjr9Igh+O2ZE6kvPcBW/0d2xSb0/EBJqJB5pom1p2mfQi
 4nta/iMK1SWGP+KpAblrSyg6TGg0u0aoCVsLaI8xgq6Ybm2CJ4BS4lYj20jKzKMbFhZK
 E7qIovERgi+EDBh+C6gpMHVFzUnh0ybZhyhgql11Ou+0sQGTeSoJ6HeBCKMN0HdKyc6t
 TSmWh9RYDtXptVPkkJIVBvk9YfOa85ZFZnQv72Sn4A723g/3XkIkxGDC7xhJ/G/fDpIo
 X2wYsf/tedCE4DVsgREUx/BZLOM26bkqlaYGd4R3u135KYVnOwUUo+5Vu2kBpXoaOrXF
 cpJQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1765353874; x=1765958674;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=nanfx9cA4WD66AxTPbcWFMhAPzHjBqFcJnjUjujc2rI=;
 b=jkd66TzJ23thFB0wwyDULL2UlDMZqv7/NIrHZQ1dOvInBDZMbi91ICTUE/unAsXIT1
 UyEc7DhWO6CWD7YgvF8IkwH98NKYNeCCQ1J+2Y6FqrVy6J7amRXSVRIYV4WqGrRmdmPi
 5plFrTcALb7syJLvl5HJTZhnKWWNs+iUfREsTi/yeGP1/RHeUEVGmzb3AQhVQzXauI0X
 VYtNTxdktqAqfiZL6mnkyeTjs+zVeL4twKzr+ZSz5WWazsguZAdrmLNg4dlhJVh4zxGO
 JcNr5Eilr1+3ncVDkberUYyYLbWIGFOv7L8ykXsbtqXAGwYFnAS3j3HrxN5rH/RnXI2b
 cjQQ==
X-Gm-Message-State: AOJu0YxpKxUH9IKKXNj9RTm+isI9vXeRHfQYZxsNvF/djUXY6nii+//k
 G3PCwb8/HKGoqFcLMWK91wH7zhyqNShAHvPgf1W4d/DTH5PNMFnCc7m1JGBq5jmPHHiP7KqmWMN
 VV80tj2O/hfFqgTDuMedLFEzCBDhJue8=
X-Gm-Gg: ASbGncugZTUmq+CWm5fG6RSWpKREZGR62SjrGFzGR1Q7+EIqZEEt9tOTVI/wLeEXu36
 Wlajr5MqyFA5a1FgXQxH3XclH0tczY7/i2p6IZWX9yg4RJAokusETyR0E9tAe2tBFlrCnf3pMCu
 J4/mUEv1qGVokM40+VHDlsWMDsLB3gzaC4OTYJ9fx9GK2hi/RfAqPArvmYO9//vyKZ6GiTto1nk
 AFk+fsHPYNeeTBUiScWxXHj3SXGh2k/sEGGNHsbpngkfza51fopzaKlqJ2i75dy/PBR5mJeC6Na
 VB51tQ==
X-Google-Smtp-Source: AGHT+IGvtjvGzXoUB2IMuWdgoIAU3YAVX+gsMyWjJdGmHdu8MPJK/Juao/vJ18Xcd3GWgLKNWaHhBSVyHcv3v2G4+Q4=
X-Received: by 2002:a05:6820:883:b0:659:9a49:8ea3 with SMTP id
 006d021491bc7-65b2ad27f0emr965628eaf.39.1765353874226; Wed, 10 Dec 2025
 00:04:34 -0800 (PST)
MIME-Version: 1.0
References: <87345ikcwt.fsf@HIDDEN>
In-Reply-To: <87345ikcwt.fsf@HIDDEN>
From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Date: Wed, 10 Dec 2025 08:06:01 +0000
X-Gm-Features: AQt7F2oe0SgFCMN1DUJ4KBAo4gWWrrWlrUY3thHdc5URfaLxRoMBwPLzXs3QNw8
Message-ID: <CALDnm52Vqjyj5Uat7gx5J6WYVidnhUiuZsFrZW1DeCkQaTfa+A@HIDDEN>
Subject: Re: bug#79980: Eglot property support in imenu
To: Juri Linkov <juri@HIDDEN>
Content-Type: multipart/alternative; boundary="00000000000093831b0645947a40"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 79980
Cc: sbaugh@HIDDEN, 79980 <at> debbugs.gnu.org, azeng@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--00000000000093831b0645947a40
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi Juri,

On Wed, Dec 10, 2025 at 7:42=E2=80=AFAM Juri Linkov <juri@HIDDEN> wrote=
:

>
> Eglot overcomes this limitation by adding text properties
> 'breadcrumb-region'
> to parent node names, that are now used for flattening by
> 'breadcrumb-jump'.
>

Yes, it's important to understand that Eglot is trying to be friendly
mainly to breadcrumb.el, an external package, by propertizing node names
in a way that is harmless to non-breadcrumb.el users, but useful
to users of that package.

So yes, I guess you can "bless"  'breadcrumb-region' and
'breadcrumb-jump'  as a de-facto metainfo protocol, much like some
`company-*` properties for the company-mode external package.
But are other packages making use of this protocol?

If changing the data structure returned from 'eglot-imenu' by adding
> separate explicit parent nodes is not acceptable, then the only
> possible solution is to do this in imenu, while flattening at the
> presentation level, not at the internal data level.
>
> Below is a patch that does this while supporting both cases:
>
> 1. when imenu-flatten is non-nil, it adds completion candidates
>    for jumpable parent nodes using the 'breadcrumb-region' text property;
>
> 2. when imenu-flatten is nil, it adds a new menu entry ".."
>    to be able to navigate to a non-leaf node:


What exactly is the use case/problem you're trying to cover/solve?
Imenu of Emacs 31+breadcrumb without Eglot?  Imenu of
Emacs 31+some other package? Another case?
Have you tested with Imenu 31+breadcrumb+Eglot?

Indeed changing the data structure returned from 'eglot-imenu'
is not acceptable since it has to work with much older versions
of Emacs which won't have your hypothetical new imenu-smarts.

Jo=C3=A3o T=C3=A1vora

--00000000000093831b0645947a40
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_quote gmail_quote_container"><div dir=
=3D"ltr" class=3D"gmail_attr">Hi Juri,</div><div dir=3D"ltr" class=3D"gmail=
_attr"><br></div><div dir=3D"ltr" class=3D"gmail_attr">On Wed, Dec 10, 2025=
 at 7:42=E2=80=AFAM Juri Linkov &lt;<a href=3D"mailto:juri@HIDDEN">juri=
@linkov.net</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex"><br>
Eglot overcomes this limitation by adding text properties &#39;breadcrumb-r=
egion&#39;<br>
to parent node names, that are now used for flattening by &#39;breadcrumb-j=
ump&#39;.<br></blockquote><div><br></div><div>Yes, it&#39;s important to un=
derstand that Eglot is trying to be friendly=C2=A0</div><div>mainly to brea=
dcrumb.el, an external package, by propertizing node names</div><div>in a w=
ay that is harmless to non-breadcrumb.el users, but useful</div><div>to use=
rs of that package.</div><div><br></div><div>So yes, I guess you can &quot;=
bless&quot;=C2=A0 &#39;breadcrumb-region&#39; and=C2=A0</div><div>&#39;brea=
dcrumb-jump&#39;=C2=A0 as a de-facto metainfo protocol, much like some=C2=
=A0</div><div>`company-*`=C2=A0properties for=C2=A0the company-mode externa=
l package.=C2=A0=C2=A0</div><div>But are other=C2=A0packages making use of =
this protocol?</div><div><br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex">
If changing the data structure returned from &#39;eglot-imenu&#39; by addin=
g<br>
separate explicit parent nodes is not acceptable, then the only<br>
possible solution is to do this in imenu, while flattening at the<br>
presentation level, not at the internal data level.<br>
<br>
Below is a patch that does this while supporting both cases:<br>
<br>
1. when imenu-flatten is non-nil, it adds completion candidates<br>
=C2=A0 =C2=A0for jumpable parent nodes using the &#39;breadcrumb-region&#39=
; text property;<br>
<br>
2. when imenu-flatten is nil, it adds a new menu entry &quot;..&quot;<br>
=C2=A0 =C2=A0to be able to navigate to a non-leaf node:</blockquote></div><=
div><br></div><div>What exactly is the use case/problem you&#39;re trying t=
o cover/solve?=C2=A0=C2=A0</div><div>Imenu of Emacs 31+breadcrumb without E=
glot?=C2=A0 Imenu of=C2=A0</div><div>Emacs 31+some other package?=C2=A0Anot=
her case?=C2=A0</div><div>Have you tested with Imenu 31+breadcrumb+Eglot?</=
div><div><br></div><div>Indeed changing the data structure returned from &#=
39;eglot-imenu&#39;=C2=A0=C2=A0</div><div>is not acceptable since it has to=
 work with much older versions=C2=A0</div><div>of Emacs which won&#39;t hav=
e your hypothetical new imenu-smarts.</div><br><div dir=3D"ltr" class=3D"gm=
ail_signature">Jo=C3=A3o T=C3=A1vora</div></div>

--00000000000093831b0645947a40--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79980; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Dec 2025 07:41:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 10 02:41:13 2025
Received: from localhost ([127.0.0.1]:58473 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vTEoy-0007Jg-UL
	for submit <at> debbugs.gnu.org; Wed, 10 Dec 2025 02:41:13 -0500
Received: from lists.gnu.org ([2001:470:142::17]:43740)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1vTEow-0007JC-05
 for submit <at> debbugs.gnu.org; Wed, 10 Dec 2025 02:41:11 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1vTEoq-00066U-G5
 for bug-gnu-emacs@HIDDEN; Wed, 10 Dec 2025 02:41:04 -0500
Received: from mout-p-101.mailbox.org ([80.241.56.151])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256)
 (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1vTEon-0005Wx-Ri
 for bug-gnu-emacs@HIDDEN; Wed, 10 Dec 2025 02:41:04 -0500
Received: from smtp102.mailbox.org (smtp102.mailbox.org
 [IPv6:2001:67c:2050:b231:465::102])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4dR71j0qHVz9tQ4
 for <bug-gnu-emacs@HIDDEN>; Wed, 10 Dec 2025 08:40:57 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; 
 t=1765352457;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type;
 bh=Lxt1HcbBK+KFsTveAk+wopZK+lH0I/NpeQ422FUnlrc=;
 b=ZAySFu6Tuj8bGqNg4KJxyKUEni8pnaGZeTllOC4qInD1Ax+iiAWCzoa0ijyAgWT4HUCpev
 R65BFs92lccZc6ksQBDI5F5GZz0Da+wpgHXOBV1CHlTn+aKJiyET4Xf9qMBAPt1hogNeS9
 cUc+AGcVs5d7b1tK5WSM0U9xcF/OmduSmtFsxx8nCY8dakOiRQhTvAofmOz5I/EaUQsm07
 twbrO4eOT7cwtdXmfihOgRso/397pQEKguDvE7N0NCkWMDmVleUkvw+e+plCTM3kGpkjz/
 YHGfLXIenHAuFmIAW9/29D8V5zWoIUCIPxJJtxLala82w4QdHhGv1CRAlkswjw==
Authentication-Results: outgoing_mbo_mout; dkim=none;
 spf=pass (outgoing_mbo_mout: domain of juri@HIDDEN designates
 2001:67c:2050:b231:465::102 as permitted sender)
 smtp.mailfrom=juri@HIDDEN
From: Juri Linkov <juri@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: Eglot property support in imenu
Organization: LINKOV.NET
X-Debbugs-Cc: joaotavora@HIDDEN,  sbaugh@HIDDEN,
 azeng@HIDDEN
Date: Wed, 10 Dec 2025 09:34:58 +0200
Message-ID: <87345ikcwt.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Rspamd-Queue-Id: 4dR71j0qHVz9tQ4
Received-SPF: pass client-ip=80.241.56.151; envelope-from=juri@HIDDEN;
 helo=mout-p-101.mailbox.org
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--=-=-=
Content-Type: text/plain

The design of the imenu index data structure has a major limitation.
It prevents a non-leaf node from having both a position to jump
and child nodes.  It's either (NAME . POS) or (NAME CHILD ...).

Eglot overcomes this limitation by adding text properties 'breadcrumb-region'
to parent node names, that are now used for flattening by 'breadcrumb-jump'.

If changing the data structure returned from 'eglot-imenu' by adding
separate explicit parent nodes is not acceptable, then the only
possible solution is to do this in imenu, while flattening at the
presentation level, not at the internal data level.

Below is a patch that does this while supporting both cases:

1. when imenu-flatten is non-nil, it adds completion candidates
   for jumpable parent nodes using the 'breadcrumb-region' text property;

2. when imenu-flatten is nil, it adds a new menu entry ".."
   to be able to navigate to a non-leaf node:


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=imenu-flatten-parent.patch

diff --git a/lisp/imenu.el b/lisp/imenu.el
index 41c4b5cee91..258a10cc9b8 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -864,7 +864,30 @@ imenu--flatten-index-alist
                        (_ new-prefix))
 		     pos)))
 	(t
-	 (imenu--flatten-index-alist pos concat-names new-prefix)))))
+         (let ((subalist (imenu--flatten-index-alist
+                          pos concat-names new-prefix))
+               (reg (get-text-property 0 'breadcrumb-region name)))
+           (if reg
+               (append (imenu--flatten-index-alist
+                        (list (cons name (car reg))) concat-names prefix)
+                       subalist)
+             subalist))))))
+   index-alist))
+
+(defun imenu--parentify-index-alist (index-alist)
+  (mapcan
+   (lambda (item)
+     (let* ((name (car item))
+            (pos (cdr item)))
+       (cond
+        ((not (imenu--subalist-p item))
+         (list item))
+        (t
+         (let ((subalist (imenu--parentify-index-alist pos))
+               (reg (get-text-property 0 'breadcrumb-region name)))
+           (when reg
+             (setq subalist (append (list (cons ".." (car reg))) subalist)))
+           (list (cons name subalist)))))))
    index-alist))
 
 (defun imenu-choose-buffer-index (&optional prompt alist)
@@ -896,8 +919,9 @@ imenu-choose-buffer-index
     ;; Create a list for this buffer only when needed.
     (while (eq result t)
       (setq index-alist (if alist alist (imenu--make-index-alist)))
-      (when imenu-flatten
-        (setq index-alist (imenu--flatten-index-alist index-alist t)))
+      (if imenu-flatten
+          (setq index-alist (imenu--flatten-index-alist index-alist t))
+        (setq index-alist (imenu--parentify-index-alist index-alist)))
       (setq result
 	    (if (and imenu-use-popup-menu
 		     (or (eq imenu-use-popup-menu t) mouse-triggered))

--=-=-=--




Acknowledgement sent to Juri Linkov <juri@HIDDEN>:
New bug report received and forwarded. Copy sent to joaotavora@HIDDEN, sbaugh@HIDDEN, azeng@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to joaotavora@HIDDEN, sbaugh@HIDDEN, azeng@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#79980; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 10 Dec 2025 17:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.