From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: master 431f8ff1e38: * lisp/imenu.el: Support more values for imenu-flatten (bug#70846) Date: Fri, 09 Aug 2024 09:59:40 +0300 Organization: LINKOV.NET Message-ID: <86cymi2nc3.fsf@mail.linkov.net> References: <171558357066.26019.9766615061719600757@vcs2.savannah.gnu.org> <86ikzhq6ja.fsf@mail.linkov.net> <86o798x5hz.fsf@gnu.org> <86bk572e6a.fsf@mail.linkov.net> <861q62pb8y.fsf@mail.linkov.net> <864jayjd8u.fsf@gnu.org> <86le49ymsl.fsf@mail.linkov.net> <86msoo4cf3.fsf@mail.linkov.net> <865xv9ugjx.fsf@mail.linkov.net> <867cffdsp8.fsf@mail.linkov.net> <86ttgs78eu.fsf@mail.linkov.net> <86msmj9adm.fsf@mail.linkov.net> <864j7wkf66.fsf@mail.linkov.net> <86zfpogu1v.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24826"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: Stefan Monnier , Eli Zaretskii , emacs-devel@gnu.org To: Eshel Yaron Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Aug 09 09:05:32 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1scJgq-0006KO-Fj for ged-emacs-devel@m.gmane-mx.org; Fri, 09 Aug 2024 09:05:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1scJg9-0004rv-4W; Fri, 09 Aug 2024 03:04:49 -0400 Original-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 ) id 1scJg7-0004rk-AD for emacs-devel@gnu.org; Fri, 09 Aug 2024 03:04:47 -0400 Original-Received: from relay7-d.mail.gandi.net ([217.70.183.200]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1scJg5-0004as-5T; Fri, 09 Aug 2024 03:04:46 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id CBE7220009; Fri, 9 Aug 2024 07:04:38 +0000 (UTC) In-Reply-To: <86zfpogu1v.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 07 Aug 2024 19:46:20 +0300") X-GND-Sasl: juri@linkov.net Received-SPF: pass client-ip=217.70.183.200; envelope-from=juri@linkov.net; helo=relay7-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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:322548 Archived-At: >> Both of these changes look like nice improvements to me :) > > Now the documentation change is pushed to emacs-30, > but implementation of the 'suffix' value is problematic > since I remembered it's ambiguous: > https://lists.gnu.org/archive/html/emacs-devel/2024-05/msg01224.html > So probably need two separate suffix values. Ok, here are two new suffix values for both variants: " " and " " diff --git a/lisp/imenu.el b/lisp/imenu.el index 8f1b1f22a67..99d9d4a5582 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -154,6 +154,10 @@ imenu-flatten If the value is `prefix', pop up the completion buffer with a flattened menu where section names are prepended to completion candidates as prefixes. +If the value is `suffix', use section names appended to completion +candidates as suffixes. +The value `suffix-reverse' is like `suffix', but the section names +are in reverse order. If the value is `annotation', annotate each completion candidate with a suffix that is the section name to which it belongs. If the value is `group', split completion candidates into groups @@ -168,6 +172,8 @@ imenu-flatten names of completion candidates." :type '(choice (const :tag "Show nested list" nil) (const :tag "Flat list with sections as prefix" prefix) + (const :tag "Flat list with sections as suffix" suffix) + (const :tag "Flat list with reverse sections as suffix" suffix-reverse) (const :tag "Flat list annotated with sections" annotation) (const :tag "Flat list grouped by sections" group)) :version "30.1") @@ -816,7 +822,9 @@ imenu--flatten-index-alist (pos (cdr item)) (new-prefix (and concat-names (if prefix - (concat prefix imenu-level-separator name) + (if (eq imenu-flatten 'suffix-reverse) + (concat name imenu-level-separator prefix) + (concat prefix imenu-level-separator name)) name)))) (cond ((not (imenu--subalist-p item)) @@ -830,6 +838,9 @@ imenu--flatten-index-alist ('group (propertize name 'imenu-section (or prefix "*") 'imenu-choice item)) + ('suffix (if prefix + (concat name imenu-level-separator prefix) + name)) (_ new-prefix)) pos))) (t