GNU bug report logs - #70846
Imenu flatten

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 Thu, 9 May 2024 16:37:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 70846) by debbugs.gnu.org; 13 May 2024 06:59:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 13 02:59:25 2024
Received: from localhost ([127.0.0.1]:58931 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1s6Pef-0003Hs-BQ
	for submit <at> debbugs.gnu.org; Mon, 13 May 2024 02:59:25 -0400
Received: from relay4-d.mail.gandi.net ([217.70.183.196]:33213)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1s6Ped-0003Hf-EE
 for 70846 <at> debbugs.gnu.org; Mon, 13 May 2024 02:59:23 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 11262E0009;
 Mon, 13 May 2024 06:58:56 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#70846: Imenu flatten
In-Reply-To: <86a5kvymof.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 12 May
 2024 20:17:36 +0300")
Organization: LINKOV.NET
References: <861q6b7xus.fsf@HIDDEN> <86le4j53y9.fsf@HIDDEN>
 <86ttj6nopi.fsf@HIDDEN> <86v83m3z0v.fsf@HIDDEN>
 <86o79dmx8u.fsf@HIDDEN> <8634qo3ag0.fsf@HIDDEN>
 <86o79bzfh1.fsf@HIDDEN> <865xvj1p56.fsf@HIDDEN>
 <86cyprx9z9.fsf@HIDDEN> <86a5kvymof.fsf@HIDDEN>
Date: Mon, 13 May 2024 09:57:43 +0300
Message-ID: <86frumtd08.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 70846
Cc: 70846 <at> debbugs.gnu.org
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 (-)

>> >> >> >> BTW, the manual says in (info "(emacs) Imenu"):
>> >> >> >>
>> >> >> >>      You can customize the way the menus are sorted by setting the
>> >> >> >>   variable ‘imenu-sort-function’.  By default, names are ordered as they
>> >> >> >>   occur in the buffer; if you want alphabetic sorting, use the symbol
>> >> >> >>   ‘imenu--sort-by-name’ as the value.  You can also define your own
>> >> >> >>   comparison function by writing Lisp code.
>> >> >>
>> >> >> The "menus" above are pertaining only to popup menus,
>> >> >> and the variable ‘imenu-sort-function’ can't be used
>> >> >> to change the sorting order of Imenu completion candidates.
>> >> >> Only the following customization changes this order:
>> >> >>
>> >> >>   (add-to-list 'completion-category-overrides
>> >> >>                '(imenu (display-sort-function . identity)))
>> >> >>
>> >> >> Using this setting is especially essential for Imenu
>> >> >> on a PDF document with doc-view.el to keep the order
>> >> >> of chapters for the table of contents.
>> >> >>
>> >> >> But I have no idea how to document this customization.
>> >> >
>> >> > Now I'm confused: I thought the change you installed was supposed to
>> >> > make sure the completion candidates are sorted using the same sort
>> >> > order as determined by imenu-sort-function.  If not, then what did
>> >> > your change do in this matter?
>> >>
>> >> Completions can be sorted only by 'display-sort-function'.
>> >> There is no other way to sort completions.
>> >
>> > Then what did the change you installed do wrt sorting of candidates?
>>
>> It allows the users to customize the sorting order of
>> completion candidates displayed by 'imenu'.
>
> And the only way to customize that is via add-to-list as above?  IOW,
> without the change you installed, even the add-to-list method would
> not have worked?

Yes, there was no way to customize sorting of Imenu completion candidates.

Ok, I could add display-sort-function directly to the imenu completing-read
that will depend on the value of display-sort-function.  Then there will be
no need to change the manual.




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

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


Received: (at 70846) by debbugs.gnu.org; 12 May 2024 17:17:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 12 13:17:45 2024
Received: from localhost ([127.0.0.1]:55477 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1s6CpU-0006kC-Lp
	for submit <at> debbugs.gnu.org; Sun, 12 May 2024 13:17:45 -0400
Received: from eggs.gnu.org ([209.51.188.92]:42410)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1s6CpT-0006k6-RA
 for 70846 <at> debbugs.gnu.org; Sun, 12 May 2024 13:17:44 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1s6CpO-0001gz-Fe; Sun, 12 May 2024 13:17:38 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=EzgGxRZtXBzH64hlV+Ndko8Z9VwO5NUtHaypfCjQSMg=; b=UmiWhEXGnV9N4w42fx4Z
 sKZsO5gviSaJOJbXnE/1fwon5cVr3hOuDa8KVVnhYSlZfVTxtKSYeqGFoFUuryqH1HhftFDOiy1W0
 1rwAfp/ROm2G3+FseQs1NtZo67A4z4k4JJWwSMMR+1HUEkp0OZ+kEDOG2iVLnxxuEEvvn4az4wax6
 8O2i68hzQQ+R6mPmrJ9rei2+OnvmeqJBjX6DBvgIKbnVMSFpgWwSxfRlbFbzuL1MqudXitrnWRWUx
 fVvllo79eHnqcttBGzTXdL+5sJfFaj7aFMOTjYFkqzk/UPDeVIPjzMfBRrNWdhsuyG9SyM4ngT9iF
 w6LfebEiOOg30g==;
Date: Sun, 12 May 2024 20:17:36 +0300
Message-Id: <86a5kvymof.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <86cyprx9z9.fsf@HIDDEN> (message from Juri Linkov on
 Sun, 12 May 2024 19:37:14 +0300)
Subject: Re: bug#70846: Imenu flatten
References: <861q6b7xus.fsf@HIDDEN> <86le4j53y9.fsf@HIDDEN>
 <86ttj6nopi.fsf@HIDDEN> <86v83m3z0v.fsf@HIDDEN>
 <86o79dmx8u.fsf@HIDDEN> <8634qo3ag0.fsf@HIDDEN>
 <86o79bzfh1.fsf@HIDDEN> <865xvj1p56.fsf@HIDDEN>
 <86cyprx9z9.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70846
Cc: 70846 <at> debbugs.gnu.org
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: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: 70846 <at> debbugs.gnu.org
> Date: Sun, 12 May 2024 19:37:14 +0300
> 
> >> >> >> BTW, the manual says in (info "(emacs) Imenu"):
> >> >> >>
> >> >> >>      You can customize the way the menus are sorted by setting the
> >> >> >>   variable ‘imenu-sort-function’.  By default, names are ordered as they
> >> >> >>   occur in the buffer; if you want alphabetic sorting, use the symbol
> >> >> >>   ‘imenu--sort-by-name’ as the value.  You can also define your own
> >> >> >>   comparison function by writing Lisp code.
> >> >>
> >> >> The "menus" above are pertaining only to popup menus,
> >> >> and the variable ‘imenu-sort-function’ can't be used
> >> >> to change the sorting order of Imenu completion candidates.
> >> >> Only the following customization changes this order:
> >> >>
> >> >>   (add-to-list 'completion-category-overrides
> >> >>                '(imenu (display-sort-function . identity)))
> >> >>
> >> >> Using this setting is especially essential for Imenu
> >> >> on a PDF document with doc-view.el to keep the order
> >> >> of chapters for the table of contents.
> >> >>
> >> >> But I have no idea how to document this customization.
> >> >
> >> > Now I'm confused: I thought the change you installed was supposed to
> >> > make sure the completion candidates are sorted using the same sort
> >> > order as determined by imenu-sort-function.  If not, then what did
> >> > your change do in this matter?
> >>
> >> Completions can be sorted only by 'display-sort-function'.
> >> There is no other way to sort completions.
> >
> > Then what did the change you installed do wrt sorting of candidates?
> 
> It allows the users to customize the sorting order of
> completion candidates displayed by 'imenu'.

And the only way to customize that is via add-to-list as above?  IOW,
without the change you installed, even the add-to-list method would
not have worked?




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

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


Received: (at 70846) by debbugs.gnu.org; 12 May 2024 16:39:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 12 12:39:41 2024
Received: from localhost ([127.0.0.1]:55311 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1s6CEf-0006Ed-AD
	for submit <at> debbugs.gnu.org; Sun, 12 May 2024 12:39:41 -0400
Received: from relay3-d.mail.gandi.net ([217.70.183.195]:49595)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1s6CEa-0006Dw-3k
 for 70846 <at> debbugs.gnu.org; Sun, 12 May 2024 12:39:40 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 8926660003;
 Sun, 12 May 2024 16:39:09 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#70846: Imenu flatten
In-Reply-To: <865xvj1p56.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 12 May
 2024 10:10:45 +0300")
Organization: LINKOV.NET
References: <861q6b7xus.fsf@HIDDEN> <86le4j53y9.fsf@HIDDEN>
 <86ttj6nopi.fsf@HIDDEN> <86v83m3z0v.fsf@HIDDEN>
 <86o79dmx8u.fsf@HIDDEN> <8634qo3ag0.fsf@HIDDEN>
 <86o79bzfh1.fsf@HIDDEN> <865xvj1p56.fsf@HIDDEN>
Date: Sun, 12 May 2024 19:37:14 +0300
Message-ID: <86cyprx9z9.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 70846
Cc: 70846 <at> debbugs.gnu.org
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 (-)

>> >> >> BTW, the manual says in (info "(emacs) Imenu"):
>> >> >>
>> >> >>      You can customize the way the menus are sorted by setting the
>> >> >>   variable ‘imenu-sort-function’.  By default, names are ordered as they
>> >> >>   occur in the buffer; if you want alphabetic sorting, use the symbol
>> >> >>   ‘imenu--sort-by-name’ as the value.  You can also define your own
>> >> >>   comparison function by writing Lisp code.
>> >>
>> >> The "menus" above are pertaining only to popup menus,
>> >> and the variable ‘imenu-sort-function’ can't be used
>> >> to change the sorting order of Imenu completion candidates.
>> >> Only the following customization changes this order:
>> >>
>> >>   (add-to-list 'completion-category-overrides
>> >>                '(imenu (display-sort-function . identity)))
>> >>
>> >> Using this setting is especially essential for Imenu
>> >> on a PDF document with doc-view.el to keep the order
>> >> of chapters for the table of contents.
>> >>
>> >> But I have no idea how to document this customization.
>> >
>> > Now I'm confused: I thought the change you installed was supposed to
>> > make sure the completion candidates are sorted using the same sort
>> > order as determined by imenu-sort-function.  If not, then what did
>> > your change do in this matter?
>>
>> Completions can be sorted only by 'display-sort-function'.
>> There is no other way to sort completions.
>
> Then what did the change you installed do wrt sorting of candidates?

It allows the users to customize the sorting order of
completion candidates displayed by 'imenu'.




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

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


Received: (at 70846) by debbugs.gnu.org; 12 May 2024 07:11:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 12 03:11:04 2024
Received: from localhost ([127.0.0.1]:52867 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1s63MN-0004E8-Kb
	for submit <at> debbugs.gnu.org; Sun, 12 May 2024 03:11:03 -0400
Received: from eggs.gnu.org ([209.51.188.92]:45072)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1s63ML-0004Dl-Cb
 for 70846 <at> debbugs.gnu.org; Sun, 12 May 2024 03:11:01 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1s63MB-0004Fe-W6; Sun, 12 May 2024 03:10:55 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=VNwl7QmnixXtBmWgiJDinkSln349QVUobiU7ET3WiSc=; b=LHtEYrxYHDVv47epSs38
 Ls7Bvh8K921flIpXBLXZgCZ94oUHX8JQ0OjUh+2rduyiEXzofNehuLUuZgGjasy/avXHm7z1EtpUu
 ipsx6UeHyzEx2ldjAxl8PErVnZ32V7x+uWQ3lTZQcn2Y5PABgfnaJ6IbY9GmNurMlTe53Cap+lsU9
 R/iTnjOAU+iiZJDu8/nx0JB7ooujpNA1HZ6xFufaFWHBY0utsjQt72LW8BpCMHBYOAZA3uxGife8P
 AqdgnVMi6/WdNaKxVi/YLzR9KhCMQDPVxRE0xKbjvWN/l8GZrwd+/JUIUYUM2ftcxZ85/MXxarELB
 UwZNVI2ZfByg+w==;
Date: Sun, 12 May 2024 10:10:45 +0300
Message-Id: <865xvj1p56.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <86o79bzfh1.fsf@HIDDEN> (message from Juri Linkov on
 Sun, 12 May 2024 09:55:38 +0300)
Subject: Re: bug#70846: Imenu flatten
References: <861q6b7xus.fsf@HIDDEN> <86le4j53y9.fsf@HIDDEN>
 <86ttj6nopi.fsf@HIDDEN> <86v83m3z0v.fsf@HIDDEN>
 <86o79dmx8u.fsf@HIDDEN> <8634qo3ag0.fsf@HIDDEN>
 <86o79bzfh1.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70846
Cc: 70846 <at> debbugs.gnu.org
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: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: 70846 <at> debbugs.gnu.org
> Date: Sun, 12 May 2024 09:55:38 +0300
> 
> >> >> BTW, the manual says in (info "(emacs) Imenu"):
> >> >>
> >> >>      You can customize the way the menus are sorted by setting the
> >> >>   variable ‘imenu-sort-function’.  By default, names are ordered as they
> >> >>   occur in the buffer; if you want alphabetic sorting, use the symbol
> >> >>   ‘imenu--sort-by-name’ as the value.  You can also define your own
> >> >>   comparison function by writing Lisp code.
> >>
> >> The "menus" above are pertaining only to popup menus,
> >> and the variable ‘imenu-sort-function’ can't be used
> >> to change the sorting order of Imenu completion candidates.
> >> Only the following customization changes this order:
> >>
> >>   (add-to-list 'completion-category-overrides
> >>                '(imenu (display-sort-function . identity)))
> >>
> >> Using this setting is especially essential for Imenu
> >> on a PDF document with doc-view.el to keep the order
> >> of chapters for the table of contents.
> >>
> >> But I have no idea how to document this customization.
> >
> > Now I'm confused: I thought the change you installed was supposed to
> > make sure the completion candidates are sorted using the same sort
> > order as determined by imenu-sort-function.  If not, then what did
> > your change do in this matter?
> 
> Completions can be sorted only by 'display-sort-function'.
> There is no other way to sort completions.

Then what did the change you installed do wrt sorting of candidates?

> So the question remains: whether to document and how
> the customization with 'completion-category-overrides' above?

I cannot answer that unless I understand what we just installed and
why.




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

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


Received: (at 70846) by debbugs.gnu.org; 12 May 2024 07:06:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 12 03:06:21 2024
Received: from localhost ([127.0.0.1]:52836 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1s63Hp-0004BQ-8y
	for submit <at> debbugs.gnu.org; Sun, 12 May 2024 03:06:21 -0400
Received: from relay1-d.mail.gandi.net ([217.70.183.193]:49951)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1s63Hk-0004BC-Gb
 for 70846 <at> debbugs.gnu.org; Sun, 12 May 2024 03:06:19 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 05694240004;
 Sun, 12 May 2024 07:05:49 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#70846: Imenu flatten
In-Reply-To: <8634qo3ag0.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 11 May
 2024 13:33:03 +0300")
Organization: LINKOV.NET
References: <861q6b7xus.fsf@HIDDEN> <86le4j53y9.fsf@HIDDEN>
 <86ttj6nopi.fsf@HIDDEN> <86v83m3z0v.fsf@HIDDEN>
 <86o79dmx8u.fsf@HIDDEN> <8634qo3ag0.fsf@HIDDEN>
Date: Sun, 12 May 2024 09:55:38 +0300
Message-ID: <86o79bzfh1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 70846
Cc: 70846 <at> debbugs.gnu.org
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 (-)

>> >> BTW, the manual says in (info "(emacs) Imenu"):
>> >>
>> >>      You can customize the way the menus are sorted by setting the
>> >>   variable ‘imenu-sort-function’.  By default, names are ordered as they
>> >>   occur in the buffer; if you want alphabetic sorting, use the symbol
>> >>   ‘imenu--sort-by-name’ as the value.  You can also define your own
>> >>   comparison function by writing Lisp code.
>>
>> The "menus" above are pertaining only to popup menus,
>> and the variable ‘imenu-sort-function’ can't be used
>> to change the sorting order of Imenu completion candidates.
>> Only the following customization changes this order:
>>
>>   (add-to-list 'completion-category-overrides
>>                '(imenu (display-sort-function . identity)))
>>
>> Using this setting is especially essential for Imenu
>> on a PDF document with doc-view.el to keep the order
>> of chapters for the table of contents.
>>
>> But I have no idea how to document this customization.
>
> Now I'm confused: I thought the change you installed was supposed to
> make sure the completion candidates are sorted using the same sort
> order as determined by imenu-sort-function.  If not, then what did
> your change do in this matter?

Completions can be sorted only by 'display-sort-function'.
There is no other way to sort completions.
So the question remains: whether to document and how
the customization with 'completion-category-overrides' above?




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

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


Received: (at 70846) by debbugs.gnu.org; 11 May 2024 10:33:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 11 06:33:13 2024
Received: from localhost ([127.0.0.1]:47609 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1s5k2T-0002Dk-7A
	for submit <at> debbugs.gnu.org; Sat, 11 May 2024 06:33:13 -0400
Received: from eggs.gnu.org ([209.51.188.92]:57148)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1s5k2Q-0002De-T9
 for 70846 <at> debbugs.gnu.org; Sat, 11 May 2024 06:33:12 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1s5k2L-0006Jq-NN; Sat, 11 May 2024 06:33:05 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=7h3Dz2zkuknpj8JkBuqxRXhlyWDAUaAtUCPkN6IfEvo=; b=PCd6mNYMV0/d3PCa4uu5
 NtwkJTe+zu7N8Sq+4CDjmAJr+m+RCfOV9RBDgTP8BlfRo/HNT6xwDMoRtgkZBukQegMOyVqwC9AFH
 +ybYlU0OMpBsjG/DO2yyc3eTEjgMQo94USs5F+2Njku4bAptZXICfBTCJ7FlGgioL4BQ02vsFzkWk
 PVS4bH74neWH331RM8zPzXW/Apm2Q4nK/acD7zmABAlFCJnaBToInjzLdX2OYlKg3QRT4LNuS44dq
 ws6kIafxhIyHyIj+dgr2ANPet1u6EjQB516VvlMPWpoUQBAuHm8EcDdBrx+aXjymz83GbvJpENTo9
 xvenJmrp4USN2g==;
Date: Sat, 11 May 2024 13:33:03 +0300
Message-Id: <8634qo3ag0.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <86o79dmx8u.fsf@HIDDEN> (message from Juri Linkov on
 Fri, 10 May 2024 19:45:37 +0300)
Subject: Re: bug#70846: Imenu flatten
References: <861q6b7xus.fsf@HIDDEN> <86le4j53y9.fsf@HIDDEN>
 <86ttj6nopi.fsf@HIDDEN> <86v83m3z0v.fsf@HIDDEN>
 <86o79dmx8u.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70846
Cc: 70846 <at> debbugs.gnu.org
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: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: 70846 <at> debbugs.gnu.org
> Date: Fri, 10 May 2024 19:45:37 +0300
> 
> >> BTW, the manual says in (info "(emacs) Imenu"):
> >>
> >>      You can customize the way the menus are sorted by setting the
> >>   variable ‘imenu-sort-function’.  By default, names are ordered as they
> >>   occur in the buffer; if you want alphabetic sorting, use the symbol
> >>   ‘imenu--sort-by-name’ as the value.  You can also define your own
> >>   comparison function by writing Lisp code.
> >>
> >> But imenu-sort-function affects only the mouse popup menu.
> >>
> >> To be able to customize sorting of imenu completion candidates
> >> in the minibuffer, another patch is needed that sets a category
> >> for sorting customization:
> >
> > I agree that it is better to sort the same way in both cases, so
> > changes to do that are welcome.
> 
> So now pushed.
> 
> > But please also amend the text in the manual to say so, because
> > currently it only talks about "menus", which could arguably be
> > interpreted as pertaining only to popup menus.
> 
> The "menus" above are pertaining only to popup menus,
> and the variable ‘imenu-sort-function’ can't be used
> to change the sorting order of Imenu completion candidates.
> Only the following customization changes this order:
> 
>   (add-to-list 'completion-category-overrides
>                '(imenu (display-sort-function . identity)))
> 
> Using this setting is especially essential for Imenu
> on a PDF document with doc-view.el to keep the order
> of chapters for the table of contents.
> 
> But I have no idea how to document this customization.

Now I'm confused: I thought the change you installed was supposed to
make sure the completion candidates are sorted using the same sort
order as determined by imenu-sort-function.  If not, then what did
your change do in this matter?




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

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


Received: (at 70846) by debbugs.gnu.org; 10 May 2024 17:07:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 10 13:07:48 2024
Received: from localhost ([127.0.0.1]:43096 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1s5Til-0004bT-Hi
	for submit <at> debbugs.gnu.org; Fri, 10 May 2024 13:07:48 -0400
Received: from relay4-d.mail.gandi.net ([217.70.183.196]:55625)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1s5TiU-0004bA-EM
 for 70846 <at> debbugs.gnu.org; Fri, 10 May 2024 13:07:45 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id B5E98E0006
 for <70846 <at> debbugs.gnu.org>; Fri, 10 May 2024 17:07:24 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: 70846 <at> debbugs.gnu.org
Subject: Re: bug#70846: Imenu flatten
In-Reply-To: <861q6b7xus.fsf@HIDDEN> (Juri Linkov's message of "Thu, 
 09 May 2024 19:29:15 +0300")
Organization: LINKOV.NET
References: <861q6b7xus.fsf@HIDDEN>
Date: Fri, 10 May 2024 20:06:07 +0300
Message-ID: <86frupmwao.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 70846
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 (-)

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

> +(defcustom imenu-flatten nil
> +  "If non-nil, popup the completion buffer with a flattened menu.
> +The string from `imenu-level-separator' is used to separate names of
> +nested levels while flattening nested indexes with name concatenation."
> +  :type 'boolean

Here is another useful value for `imenu-flatten' that
will show section names as a suffix instead of a prefix:


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

diff --git a/lisp/imenu.el b/lisp/imenu.el
index 9c0c1ae144e..ccf5a0dc576 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -147,10 +147,16 @@ imenu-level-separator
 
 (defcustom imenu-flatten nil
   "Whether to flatten the list of sections in an imenu or show it nested.
-If non-nil, popup the completion buffer with a flattened menu.
+If nil, use nested indexes.
+If t, popup the completion buffer with a flattened menu.
+If `annotation', use completion annotation as a suffix
+to append section names after the index names.
+
 The string from `imenu-level-separator' is used to separate names of
 nested levels while flattening nested indexes with name concatenation."
-  :type 'boolean
+  :type '(choice (const :tag "Nested" nil)
+                 (const :tag "By prefix" t)
+                 (const :tag "By suffix" annotation))
   :version "30.1")
 
 (defcustom imenu-generic-skip-comments-and-strings t
@@ -743,7 +749,10 @@ imenu--completion-buffer
     ;; Display the completion buffer.
     (minibuffer-with-setup-hook
         (lambda ()
-          (setq-local completion-extra-properties '(:category imenu))
+          (setq-local completion-extra-properties
+                      `( :category imenu
+                         :annotation-function
+                         ,(lambda (s) (get-text-property 0 'imenu-section s))))
           (unless imenu-eager-completion-buffer
             (minibuffer-completion-help)))
       (setq name (completing-read prompt
@@ -787,7 +796,11 @@ imenu--flatten-index-alist
 			       name))))
        (cond
 	((not (imenu--subalist-p item))
-	 (list (cons new-prefix pos)))
+	 (list (cons (if (and (eq imenu-flatten 'annotation) prefix)
+			 (propertize name 'imenu-section
+				     (format " (%s)" prefix))
+		       name)
+		     pos)))
 	(t
 	 (imenu--flatten-index-alist pos concat-names new-prefix)))))
    index-alist))

--=-=-=--




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

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


Received: (at 70846) by debbugs.gnu.org; 10 May 2024 16:49:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 10 12:49:24 2024
Received: from localhost ([127.0.0.1]:42975 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1s5TQy-0004Ke-5r
	for submit <at> debbugs.gnu.org; Fri, 10 May 2024 12:49:24 -0400
Received: from relay4-d.mail.gandi.net ([217.70.183.196]:51839)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1s5TQv-0004KK-QP
 for 70846 <at> debbugs.gnu.org; Fri, 10 May 2024 12:49:22 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 2CE5AE0008;
 Fri, 10 May 2024 16:48:54 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#70846: Imenu flatten
In-Reply-To: <86v83m3z0v.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 10 May
 2024 10:29:52 +0300")
Organization: LINKOV.NET
References: <861q6b7xus.fsf@HIDDEN> <86le4j53y9.fsf@HIDDEN>
 <86ttj6nopi.fsf@HIDDEN> <86v83m3z0v.fsf@HIDDEN>
Date: Fri, 10 May 2024 19:45:37 +0300
Message-ID: <86o79dmx8u.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 70846
Cc: 70846 <at> debbugs.gnu.org
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 (-)

>> BTW, the manual says in (info "(emacs) Imenu"):
>>
>>      You can customize the way the menus are sorted by setting the
>>   variable ‘imenu-sort-function’.  By default, names are ordered as they
>>   occur in the buffer; if you want alphabetic sorting, use the symbol
>>   ‘imenu--sort-by-name’ as the value.  You can also define your own
>>   comparison function by writing Lisp code.
>>
>> But imenu-sort-function affects only the mouse popup menu.
>>
>> To be able to customize sorting of imenu completion candidates
>> in the minibuffer, another patch is needed that sets a category
>> for sorting customization:
>
> I agree that it is better to sort the same way in both cases, so
> changes to do that are welcome.

So now pushed.

> But please also amend the text in the manual to say so, because
> currently it only talks about "menus", which could arguably be
> interpreted as pertaining only to popup menus.

The "menus" above are pertaining only to popup menus,
and the variable ‘imenu-sort-function’ can't be used
to change the sorting order of Imenu completion candidates.
Only the following customization changes this order:

  (add-to-list 'completion-category-overrides
               '(imenu (display-sort-function . identity)))

Using this setting is especially essential for Imenu
on a PDF document with doc-view.el to keep the order
of chapters for the table of contents.

But I have no idea how to document this customization.




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

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


Received: (at 70846) by debbugs.gnu.org; 10 May 2024 07:30:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 10 03:30:31 2024
Received: from localhost ([127.0.0.1]:41671 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1s5Ki7-0008Uw-1f
	for submit <at> debbugs.gnu.org; Fri, 10 May 2024 03:30:31 -0400
Received: from eggs.gnu.org ([209.51.188.92]:41620)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1s5Ki5-0008Ui-K9
 for 70846 <at> debbugs.gnu.org; Fri, 10 May 2024 03:30:30 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1s5Ki1-0006C7-0v; Fri, 10 May 2024 03:30:25 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=zvPw9sU+qBnMVq4KKZ9sRRKIVu8tRIUODzop+SaxOvA=; b=DtPWiVmVK0uwaCcUl0VD
 YrZ722798bQp2bAvsySuinfcueUp+IuRI2w6bqlLiVx7txGah1bzc1tcw4F8qXW7U4q135A+paIAt
 RpJirwnDVfFjYLwYHebnhLT8FRNkzFzm8L2PekWc46kaDWfpcd5EwtlsDW/v0yPJ82jgE2YMEBaK5
 dUS8+g/8tuEi4licQMEHZ4GOc8JtykRm0gbYx2UdDLZirs6I8RG/jveRqu2vB9sTSJJTMh97llDNH
 buHL8lMH5dQEYYpjqs7Pp1WE+lo9gqxEGgwnlY+SuqIeoAy3W7mLNIoRIXdqY2vbhEtu0/N3W2ssf
 jZTMzZEsduRidQ==;
Date: Fri, 10 May 2024 10:29:52 +0300
Message-Id: <86v83m3z0v.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <86ttj6nopi.fsf@HIDDEN> (message from Juri Linkov on
 Fri, 10 May 2024 09:52:25 +0300)
Subject: Re: bug#70846: Imenu flatten
References: <861q6b7xus.fsf@HIDDEN> <86le4j53y9.fsf@HIDDEN>
 <86ttj6nopi.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70846
Cc: 70846 <at> debbugs.gnu.org
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: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: 70846 <at> debbugs.gnu.org
> Date: Fri, 10 May 2024 09:52:25 +0300
> 
> BTW, the manual says in (info "(emacs) Imenu"):
> 
>      You can customize the way the menus are sorted by setting the
>   variable ‘imenu-sort-function’.  By default, names are ordered as they
>   occur in the buffer; if you want alphabetic sorting, use the symbol
>   ‘imenu--sort-by-name’ as the value.  You can also define your own
>   comparison function by writing Lisp code.
> 
> But imenu-sort-function affects only the mouse popup menu.
> 
> To be able to customize sorting of imenu completion candidates
> in the minibuffer, another patch is needed that sets a category
> for sorting customization:

I agree that it is better to sort the same way in both cases, so
changes to do that are welcome.  But please also amend the text in the
manual to say so, because currently it only talks about "menus", which
could arguably be interpreted as pertaining only to popup menus.

Thanks.




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

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


Received: (at 70846) by debbugs.gnu.org; 10 May 2024 06:56:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 10 02:56:07 2024
Received: from localhost ([127.0.0.1]:41619 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1s5KAp-0007y3-4H
	for submit <at> debbugs.gnu.org; Fri, 10 May 2024 02:56:07 -0400
Received: from relay3-d.mail.gandi.net ([217.70.183.195]:59155)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1s5KAm-0007xX-Qi
 for 70846 <at> debbugs.gnu.org; Fri, 10 May 2024 02:56:05 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id A7C0D60005;
 Fri, 10 May 2024 06:55:39 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#70846: Imenu flatten
In-Reply-To: <86le4j53y9.fsf@HIDDEN> (Eli Zaretskii's message of "Thu, 09 May
 2024 19:45:50 +0300")
Organization: LINKOV.NET
References: <861q6b7xus.fsf@HIDDEN> <86le4j53y9.fsf@HIDDEN>
Date: Fri, 10 May 2024 09:52:25 +0300
Message-ID: <86ttj6nopi.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 70846
Cc: 70846 <at> debbugs.gnu.org
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 (-)

>> This patch revives the feature existed in the initial version of imenu.el,
>> but that was unfortunately removed later.
>>
>> When comparing it with the version in breadcrumb-jump that was discussed in
>> https://lists.gnu.org/archive/html/emacs-devel/2023-12/msg00278.html
>> the advantage of this version is that it doesn't use 'cl-loop':
>
> Thanks.  If this is installed, I think it needs a NEWS entry.

So now pushed with a NEWS entry, and also with changes in the manual.

BTW, the manual says in (info "(emacs) Imenu"):

     You can customize the way the menus are sorted by setting the
  variable ‘imenu-sort-function’.  By default, names are ordered as they
  occur in the buffer; if you want alphabetic sorting, use the symbol
  ‘imenu--sort-by-name’ as the value.  You can also define your own
  comparison function by writing Lisp code.

But imenu-sort-function affects only the mouse popup menu.

To be able to customize sorting of imenu completion candidates
in the minibuffer, another patch is needed that sets a category
for sorting customization:

diff --git a/lisp/imenu.el b/lisp/imenu.el
index f628936cedc..5671b49cdf4 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -733,10 +740,12 @@ imenu--completion-buffer
                          (imenu--in-alist name prepared-index-alist)
                          ;; Default to `name' if it's in the alist.
                          name))))
-    (let ((minibuffer-setup-hook minibuffer-setup-hook))
-      ;; Display the completion buffer.
-      (if (not imenu-eager-completion-buffer)
-	  (add-hook 'minibuffer-setup-hook 'minibuffer-completion-help))
+    ;; Display the completion buffer.
+    (minibuffer-with-setup-hook
+        (lambda ()
+          (setq-local completion-extra-properties '(:category imenu))
+          (unless imenu-eager-completion-buffer
+            (minibuffer-completion-help)))
       (setq name (completing-read prompt
 				  prepared-index-alist
 				  nil t nil 'imenu--history-list name)))




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

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


Received: (at 70846) by debbugs.gnu.org; 9 May 2024 16:46:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 09 12:46:31 2024
Received: from localhost ([127.0.0.1]:56249 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1s56uc-0008CH-JL
	for submit <at> debbugs.gnu.org; Thu, 09 May 2024 12:46:30 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:34048)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1s56uY-0008Bn-8x
 for 70846 <at> debbugs.gnu.org; Thu, 09 May 2024 12:46:29 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1s56u2-00070m-Jd; Thu, 09 May 2024 12:45:54 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=jdHkzPgF0uGLHVEX8nA8jjQWA+BP6dynBhaJVEfQ3mE=; b=Nl/ZKFAhCwSM
 1NTjIAXadsLxliwAnfA/sPYrAQLwxBtwuZVL7B5XU9qzxu5s9+pR3mk7ZNshaqvfNEPGFm59Tyf5M
 e/TcTgQQRcVE9+IjVvhQxQfhzySsu/HCTRuhHx5tnD7QAqw/shzEODISrB4cYdwjRJ9ZI3dvYv7Ae
 T75DDYngszqasbRLPHRdcmJl0IPNuzDu6GnGTEEw7B9hfuRW618JmmiazVJGIeDgItN6Otzeeuuyh
 qZuDWKD1PEs3dBsjPTR/DP71D4LCuDlVGd8TBMoIaXbYk68dIl92eTadvnfnM19aCRzgQlgwh6q+0
 rhRddhRkV2/WIgv506fGpw==;
Date: Thu, 09 May 2024 19:45:50 +0300
Message-Id: <86le4j53y9.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <861q6b7xus.fsf@HIDDEN> (message from Juri Linkov on
 Thu, 09 May 2024 19:29:15 +0300)
Subject: Re: bug#70846: Imenu flatten
References: <861q6b7xus.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70846
Cc: 70846 <at> debbugs.gnu.org
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: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Date: Thu, 09 May 2024 19:29:15 +0300
> 
> This patch revives the feature existed in the initial version of imenu.el,
> but that was unfortunately removed later.
> 
> When comparing it with the version in breadcrumb-jump that was discussed in
> https://lists.gnu.org/archive/html/emacs-devel/2023-12/msg00278.html
> the advantage of this version is that it doesn't use 'cl-loop':

Thanks.  If this is installed, I think it needs a NEWS entry.




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

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


Received: (at submit) by debbugs.gnu.org; 9 May 2024 16:36:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 09 12:36:53 2024
Received: from localhost ([127.0.0.1]:56201 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1s56lI-00082w-NH
	for submit <at> debbugs.gnu.org; Thu, 09 May 2024 12:36:53 -0400
Received: from lists.gnu.org ([2001:470:142::17]:33968)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1s56lC-00082q-Lp
 for submit <at> debbugs.gnu.org; Thu, 09 May 2024 12:36:51 -0400
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 1s56kh-0007zy-1K
 for bug-gnu-emacs@HIDDEN; Thu, 09 May 2024 12:36:15 -0400
Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1s56ke-00040h-RV
 for bug-gnu-emacs@HIDDEN; Thu, 09 May 2024 12:36:14 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 6FFB4240004
 for <bug-gnu-emacs@HIDDEN>; Thu,  9 May 2024 16:36:05 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: Imenu flatten
Organization: LINKOV.NET
Date: Thu, 09 May 2024 19:29:15 +0300
Message-ID: <861q6b7xus.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-GND-Sasl: juri@HIDDEN
Received-SPF: pass client-ip=2001:4b98:dc4:8::221;
 envelope-from=juri@HIDDEN; helo=relay1-d.mail.gandi.net
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, RCVD_IN_DNSWL_LOW=-0.7,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.7 (/)
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.3 (/)

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

This patch revives the feature existed in the initial version of imenu.el,
but that was unfortunately removed later.

When comparing it with the version in breadcrumb-jump that was discussed in
https://lists.gnu.org/archive/html/emacs-devel/2023-12/msg00278.html
the advantage of this version is that it doesn't use 'cl-loop':


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

diff --git a/lisp/imenu.el b/lisp/imenu.el
index f628936cedc..ccc73fe42d2 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -66,6 +66,13 @@ imenu
   :group 'convenience
   :link '(custom-manual "(elisp)Imenu"))
 
+(defcustom imenu-flatten nil
+  "If non-nil, popup the completion buffer with a flattened menu.
+The string from `imenu-level-separator' is used to separate names of
+nested levels while flattening nested indexes with name concatenation."
+  :type 'boolean
+  :version "30.1")
+
 (defcustom imenu-use-markers t
   "Non-nil means use markers instead of integers for Imenu buffer positions.
 
@@ -142,8 +149,7 @@ imenu-space-replacement
 
 (defcustom imenu-level-separator ":"
   "The separator between index names of different levels.
-Used for making mouse-menu titles and for flattening nested indexes
-with name concatenation."
+Used for flattening nested indexes with name concatenation."
   :type 'string)
 
 (defcustom imenu-generic-skip-comments-and-strings t
@@ -763,6 +770,26 @@ imenu--mouse-menu
                                            menu)))))
     (popup-menu map event)))
 
+(defun imenu--flatten-index-alist (index-alist &optional concat-names prefix)
+  ;; Takes a nested INDEX-ALIST and returns a flat index alist.
+  ;; If optional CONCAT-NAMES is non-nil, then a nested index has its
+  ;; name and a space concatenated to the names of the children.
+  ;; Third argument PREFIX is for internal use only.
+  (mapcan
+   (lambda (item)
+     (let* ((name (car item))
+	    (pos (cdr item))
+	    (new-prefix (and concat-names
+			     (if prefix
+				 (concat prefix imenu-level-separator name)
+			       name))))
+       (cond
+	((or (markerp pos) (numberp pos))
+	 (list (cons new-prefix pos)))
+	(t
+	 (imenu--flatten-index-alist pos concat-names new-prefix)))))
+   index-alist))
+
 (defun imenu-choose-buffer-index (&optional prompt alist)
   "Let the user select from a buffer index and return the chosen index.
 
@@ -792,6 +819,8 @@ 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)))
       (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 bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#70846; 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: Mon, 13 May 2024 07:15:01 UTC

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