Juri Linkov <juri@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 70846) by debbugs.gnu.org; 29 May 2024 18:07:27 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 29 14:07:27 2024 Received: from localhost ([127.0.0.1]:47335 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sCNhv-0002K6-0S for submit <at> debbugs.gnu.org; Wed, 29 May 2024 14:07:27 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:52447) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1sCNht-0002Jh-1b; Wed, 29 May 2024 14:07:25 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id D749540005; Wed, 29 May 2024 18:06:47 +0000 (UTC) From: Juri Linkov <juri@HIDDEN> To: 70846 <at> debbugs.gnu.org Subject: Re: bug#70846: Imenu flatten In-Reply-To: <86mso9akmp.fsf@HIDDEN> (Juri Linkov's message of "Tue, 28 May 2024 20:53:18 +0300") Organization: LINKOV.NET References: <861q6b7xus.fsf@HIDDEN> <86frupmwao.fsf@HIDDEN> <86mso9akmp.fsf@HIDDEN> Date: Wed, 29 May 2024 21:05:32 +0300 Message-ID: <86sey0lcib.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 X-GND-Sasl: juri@HIDDEN X-Spam-Score: -0.7 (/) 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 (-) close 70846 30.0.50 thanks >>> +(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: > > Here is the final patch that adds an option to group Imenu completions. So now pushed and closed.
bug-gnu-emacs@HIDDEN
:bug#70846
; Package emacs
.
Full text available.Received: (at 70846) by debbugs.gnu.org; 28 May 2024 17:59:34 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 28 13:59:34 2024 Received: from localhost ([127.0.0.1]:49778 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sC16j-0006PQ-No for submit <at> debbugs.gnu.org; Tue, 28 May 2024 13:59:34 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:49871) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1sC16i-0006P6-C0 for 70846 <at> debbugs.gnu.org; Tue, 28 May 2024 13:59:33 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 55D8C1BF204 for <70846 <at> debbugs.gnu.org>; Tue, 28 May 2024 17:58:55 +0000 (UTC) From: Juri Linkov <juri@HIDDEN> To: 70846 <at> debbugs.gnu.org Subject: Re: bug#70846: Imenu flatten In-Reply-To: <86frupmwao.fsf@HIDDEN> (Juri Linkov's message of "Fri, 10 May 2024 20:06:07 +0300") Organization: LINKOV.NET References: <861q6b7xus.fsf@HIDDEN> <86frupmwao.fsf@HIDDEN> Date: Tue, 28 May 2024 20:53:18 +0300 Message-ID: <86mso9akmp.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.7 (/) 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: Here is the final patch that adds an option to group Imenu completions. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=imenu-flatten-group.patch diff --git a/lisp/imenu.el b/lisp/imenu.el index 93d84106ec1..3aec32fa708 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -151,15 +151,18 @@ imenu-level-separator (defcustom imenu-flatten nil "Whether to flatten the list of sections in an imenu or show it nested. If nil, use nested indexes. -If t, pop up the completion buffer with a flattened menu. +If `prefix', pop up the completion buffer with a flattened menu +where section names are used as a prefix. If `annotation', use completion annotation as a suffix to append section names after the index names. +If `group', split completions into groups. The string from `imenu-level-separator' is used to separate names of nested levels while flattening nested indexes with name concatenation." :type '(choice (const :tag "Nested" nil) - (const :tag "By prefix" t) - (const :tag "By suffix" annotation)) + (const :tag "By prefix" prefix) + (const :tag "By annotation" annotation) + (const :tag "By group" group)) :version "30.1") (defcustom imenu-generic-skip-comments-and-strings t @@ -758,7 +761,13 @@ imenu--completion-buffer ,@(when (eq imenu-flatten 'annotation) `(:annotation-function ,(lambda (s) (get-text-property - 0 'imenu-section s)))))) + 0 'imenu-section s)))) + ,@(when (eq imenu-flatten 'group) + `(:group-function + ,(lambda (s transform) + (if transform s + (get-text-property + 0 'imenu-section s))))))) (unless imenu-eager-completion-buffer (minibuffer-completion-help))) (setq name (completing-read prompt @@ -801,15 +810,20 @@ imenu--flatten-index-alist (new-prefix (and concat-names (if prefix (concat prefix imenu-level-separator name) - (if (eq imenu-flatten 'annotation) - (propertize name 'imenu-choice item) - name))))) + name)))) (cond ((not (imenu--subalist-p item)) - (list (cons (if (and (eq imenu-flatten 'annotation) prefix) - (propertize name 'imenu-section - (format " (%s)" prefix)) - new-prefix) + (list (cons (pcase imenu-flatten + ('annotation + (if prefix + (propertize name + 'imenu-section (format " (%s)" prefix) + 'imenu-choice item) + (propertize new-prefix 'imenu-choice item))) + ('group (propertize name + 'imenu-section (or prefix "*") + 'imenu-choice item)) + (_ new-prefix)) pos))) (t (imenu--flatten-index-alist pos concat-names new-prefix))))) --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#70846
; Package emacs
.
Full text available.Received: (at 70846) by debbugs.gnu.org; 14 May 2024 06:34:28 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 14 02:34:28 2024 Received: from localhost ([127.0.0.1]:37398 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1s6lk3-0000YS-VE for submit <at> debbugs.gnu.org; Tue, 14 May 2024 02:34:28 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57968) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1s6lk1-0000YI-OJ for 70846 <at> debbugs.gnu.org; Tue, 14 May 2024 02:34:26 -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 1s6ljv-0005rR-2h; Tue, 14 May 2024 02:34:19 -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=TC9Ar2fGzGlNVEqwvD7VFR4Qs3rqk8PhafYPQGiGQ6g=; b=GyYNyLjPlrKN qhjhj4k+IIRTYEpqKQYkbi1ne6qV1ONddqJ09Kvoijf+chnEiPo4mWxk5WOZ50/kzmzqC8BSnyqkn B7KuwNxBqxnZMYGG39CNEgGBdph5y8JB/7su+RWQm0HHLmkUouJNz9CxRaFHknaD6+0kHUnRrYU5z I6pfpG4XNT9l+f6dcxL3iMyoFH/CznQMfHJxbdMoL4QQ/GOsrqvusdEQ2qKhuAI56sJyDsX8a7NLQ l1fGNmSmem2nejj2w08hQnyypMJJYNvKKKwYYL4CBLARxmSMg4D+cv2AFIwTsHNl1XOecgFpPADpt 2xvhUNuTy2o+PVH5wEleSA==; Date: Tue, 14 May 2024 09:34:11 +0300 Message-Id: <86pltox5p8.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Juri Linkov <juri@HIDDEN> In-Reply-To: <86v83hq71e.fsf@HIDDEN> (message from Juri Linkov on Tue, 14 May 2024 09:05:09 +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> <86a5kvymof.fsf@HIDDEN> <86frumtd08.fsf@HIDDEN> <86r0e6xig7.fsf@HIDDEN> <86v83hq71e.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> > Cc: 70846 <at> debbugs.gnu.org > Date: Tue, 14 May 2024 09:05:09 +0300 > > >> 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. > > > > Except we should then remove the reference to "menus", right? Because > > if you do that, the customization of sorting order will affect both > > the menus and the completion, right? > > Indeed, this will require removing the reference to the mouse menus. > > But when I tried to use imenu-sort-function for sorting the completions, > I found a problem that makes such change impossible. > > The problem is that the default value of imenu-sort-function is nil. > This means that by default the items on the mouse menu are unsorted. > But the completions are sorted, and we can't change this default > behavior. Therefore, imenu-sort-function can't define how the > completions are sorted. So this is just a documentation task > that is done in this patch: Thanks, SGTM.
bug-gnu-emacs@HIDDEN
:bug#70846
; Package emacs
.
Full text available.Received: (at 70846) by debbugs.gnu.org; 14 May 2024 06:08:37 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 14 02:08:36 2024 Received: from localhost ([127.0.0.1]:37260 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1s6lL2-0008Ux-Hm for submit <at> debbugs.gnu.org; Tue, 14 May 2024 02:08:36 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:60543) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1s6lL0-0008UX-0G for 70846 <at> debbugs.gnu.org; Tue, 14 May 2024 02:08:35 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id CEF1D20009; Tue, 14 May 2024 06:08:26 +0000 (UTC) From: Juri Linkov <juri@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#70846: Imenu flatten In-Reply-To: <86r0e6xig7.fsf@HIDDEN> (Eli Zaretskii's message of "Mon, 13 May 2024 10:46:32 +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> <86frumtd08.fsf@HIDDEN> <86r0e6xig7.fsf@HIDDEN> Date: Tue, 14 May 2024 09:05:09 +0300 Message-ID: <86v83hq71e.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.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 (-) --=-=-= Content-Type: text/plain >> 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. > > Except we should then remove the reference to "menus", right? Because > if you do that, the customization of sorting order will affect both > the menus and the completion, right? Indeed, this will require removing the reference to the mouse menus. But when I tried to use imenu-sort-function for sorting the completions, I found a problem that makes such change impossible. The problem is that the default value of imenu-sort-function is nil. This means that by default the items on the mouse menu are unsorted. But the completions are sorted, and we can't change this default behavior. Therefore, imenu-sort-function can't define how the completions are sorted. So this is just a documentation task that is done in this patch: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=imenu-completion-sort.patch diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index 01a1462044c..8ab5033795d 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -378,6 +378,10 @@ Imenu symbol @code{imenu--sort-by-name} as the value. You can also define your own comparison function by writing Lisp code. + You can also customize how Imenu completions are sorted by changing +the variable @code{completion-category-overrides} and setting its +@code{display-sort-function} for the category @code{imenu}. + If Eglot is activated for the current buffer's project (@pxref{Projects}) and the current buffer's major mode, Eglot provides its own facility for producing the buffer's index based on the diff --git a/etc/NEWS b/etc/NEWS index 8a2c8950fd8..19564062d9f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1046,6 +1046,11 @@ point is not in a comment or a string. It is by default bound to It defines whether to flatten the list of sections in an imenu or show it nested. ++++ +*** Imenu completions now can be sorted. +You can customize the option 'completion-category-overrides' +and set 'display-sort-function' for the category 'imenu'. + ** Which Function mode +++ diff --git a/lisp/imenu.el b/lisp/imenu.el index 93a544ff550..f255dcc7148 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -115,7 +115,10 @@ imenu-after-jump-hook (defcustom imenu-sort-function nil "The function to use for sorting the index mouse-menu. -Affects only the mouse index menu. +Affects only the mouse index menu. If you want to change +the sorting order of completions, you can customize +the option `completion-category-overrides' and set +`display-sort-function' for the category `imenu'. Set this to nil if you don't want any sorting (faster). The items in the menu are then presented in the order they were found --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#70846
; Package emacs
.
Full text available.Received: (at 70846) by debbugs.gnu.org; 13 May 2024 07:47:03 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 13 03:47:03 2024 Received: from localhost ([127.0.0.1]:59187 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1s6QOk-0000zv-T8 for submit <at> debbugs.gnu.org; Mon, 13 May 2024 03:47:03 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53650) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1s6QOg-0000zX-9x for 70846 <at> debbugs.gnu.org; Mon, 13 May 2024 03:47: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 1s6QOa-0001Hg-3u; Mon, 13 May 2024 03:46:52 -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=B/pn0hYpTG1tsmwtUB/p0bKjqswjTGLMC9d5TzT6Kmk=; b=dBJzVGdPGy/LC9leZTZ5 0eXfcDzFYzJW+D1Pr8nW+q/Vxzfjvd4Qzry2l8no71m35hLS1J31bALHmr8IS1Vs0i0AYnFHitJIC fwAfJOK8MehHtdL8wQLEtdEwAHW2nlj4HRg4/zs1aUr7DVCkHDI55Kt2JZhQ0OUet6h0uZdkkW9Mv 0ivaZYny1Te/f9bYhWYC7h/RkA+VAQc7/wm3NI7I1OTZEsaROkv7D1FpfH1SijDvLs5FntNEpEnY+ d8KwbCYq2M/PFw0l6byH5pRc4WqeEqwjZH4Tl4C1ChudVbtg/4EglkUhPhdcc0AZa+XebeNxE58Bp lizkJmWPf/6N+w==; Date: Mon, 13 May 2024 10:46:32 +0300 Message-Id: <86r0e6xig7.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Juri Linkov <juri@HIDDEN> In-Reply-To: <86frumtd08.fsf@HIDDEN> (message from Juri Linkov on Mon, 13 May 2024 09:57:43 +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> <86a5kvymof.fsf@HIDDEN> <86frumtd08.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: Mon, 13 May 2024 09:57:43 +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? > > 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. Except we should then remove the reference to "menus", right? Because if you do that, the customization of sorting order will affect both the menus and the completion, right?
bug-gnu-emacs@HIDDEN
:bug#70846
; Package emacs
.
Full text available.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.
bug-gnu-emacs@HIDDEN
:bug#70846
; Package emacs
.
Full text available.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?
bug-gnu-emacs@HIDDEN
:bug#70846
; Package emacs
.
Full text available.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'.
bug-gnu-emacs@HIDDEN
:bug#70846
; Package emacs
.
Full text available.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.
bug-gnu-emacs@HIDDEN
:bug#70846
; Package emacs
.
Full text available.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?
bug-gnu-emacs@HIDDEN
:bug#70846
; Package emacs
.
Full text available.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?
bug-gnu-emacs@HIDDEN
:bug#70846
; Package emacs
.
Full text available.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)) --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#70846
; Package emacs
.
Full text available.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.
bug-gnu-emacs@HIDDEN
:bug#70846
; Package emacs
.
Full text available.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.
bug-gnu-emacs@HIDDEN
:bug#70846
; Package emacs
.
Full text available.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)))
bug-gnu-emacs@HIDDEN
:bug#70846
; Package emacs
.
Full text available.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.
bug-gnu-emacs@HIDDEN
:bug#70846
; Package emacs
.
Full text available.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)) --=-=-=--
Juri Linkov <juri@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#70846
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.