From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron Newsgroups: gmane.emacs.devel Subject: Re: master 431f8ff1e38: * lisp/imenu.el: Support more values for imenu-flatten (bug#70846) Date: Tue, 16 Jul 2024 08:57:08 +0200 Message-ID: References: <171558357066.26019.9766615061719600757@vcs2.savannah.gnu.org> <20240513065931.0D83AC12C31@vcs2.savannah.gnu.org> <86v83hwxjs.fsf@mail.linkov.net> <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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36226"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Stefan Monnier , Eli Zaretskii , emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jul 16 08:58:13 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 1sTc8a-0009D8-QX for ged-emacs-devel@m.gmane-mx.org; Tue, 16 Jul 2024 08:58:12 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTc7m-0003Js-Kb; Tue, 16 Jul 2024 02:57:24 -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 1sTc7h-0003JV-1n for emacs-devel@gnu.org; Tue, 16 Jul 2024 02:57:17 -0400 Original-Received: from mail.eshelyaron.com ([107.175.124.16] helo=eshelyaron.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTc7e-0000OI-25; Tue, 16 Jul 2024 02:57:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1721113030; bh=NrCC6Prs8mrxRf6PzPKuNb5+HFcmgvt+iCMYO27EZxI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ry5vB0uM5tTyhNWdySzSuF3oL/BZYw5qZCRvbYLcAsrPRWUY0OhahpnwaG227udwM AZPMqdOGGzTJcxAd4INGZhQtgvmr1LypM4k6Dr9DBKFueha/TfX9dLOBCDwjsev+kK z17iZcxlPddJnt106MmsjmSPBqPcf6oOpIVk1QKOVcxGrujTIGPcckydBp/bNwo5nj jHKhqpZx8n/ELmH3PXzhleotr4uRIR1gF1mxg4WGVaPp7D80FCKIW+4VQzFk+GuEx+ WfOs7glTTjG7W4FMj3x3zPWZ8wAHwCg6EmZLEJpeoJpbIp3DiCd9g1rXs2jOM/hsp2 N9DAErZ+156Hw== In-Reply-To: <86msmj9adm.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 14 Jul 2024 20:00:37 +0300") Received-SPF: pass client-ip=107.175.124.16; envelope-from=me@eshelyaron.com; helo=eshelyaron.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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:321687 Archived-At: Hi Juri, Juri Linkov writes: >>> Maybe then imenu--completion-buffer should try to get the text property >>> from the end of completion? Provided that completion--replace will keep >>> some properties at the end instead of using insert-and-inherit. >> >> I'm not sure, I think that might work in some cases, but since >> completion--replace also keeps the common suffix it may still suffer >> from the same issue when going from candidate "foo-baz" to "bar-baz". >> >> Then there's the problem of what happens when you simply type the >> candidate you want to jump to, without completion. For example >> M-g i imenu RET goes to the imenu function when imenu-flatten=nil, >> but if imenu-flatten=annotation then it goes to the defgroup. I forgot to mention that this also affects using previous minibuffer inputs with M-p: the text properties aren't recorded in the history list, so you get an ambiguous input that doesn't always take you to where you went when you previously used that input. >> What I would suggest is to ensure completion candidates are unambiguous >> as strings rather than relying on text properties. Namely: > > Unfortunately, that'd be a step back. Maybe at least we could document > limitations that annotations work only by selection. Indeed my suggestion was to take a step back of sorts. If it's too late for that, I agree it's a good idea to document the known issues. > >> - Restore imenu-flatten to a boolean option: either flat or nested. >> - If imenu-flatten is non-nil, prepend the full prefix to each candidate, >> like imenu-flatten=prefix does currently. This takes care of >> disambiguating the candidate strings. > > It can't be boolean, because a more reliable replacement for annotations > would be appending the suffix, i.e. by the new value 'suffix'. That makes sense. >> - If completions-group is also non-nil, then group candidates according >> to their prefix and trim the prefix in the group-function when >> transforming candidates for display. > > The disadvantage of completions-group is its too wide coverage. > We should strive for more specific options where possible. Right. The advantage, on the other hand, is that you can toggle completions-group on the fly in the minibuffer, either with toggle-option or with a dedicated command. The wide coverage of completions-group means there's just one variable to toggle, always. > Or better: let's enable groups by category. I don't know why we have > such a glaring omission that groups still can't be enabled by > category. This should be simple to implement: Doesn't the group-function metadata entry give enough control already? If a category or a specific completion table wants to disable grouping, it can simply avoid providing a group-function. If it wants to enable grouping, then it does provide a group-function, and now it's up to the user's preferences which they express by setting completions-group. Maybe your suggestion yields more flexibility in some cases? Best, Eshel