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: Updating *Completions* as you type Date: Sat, 25 Nov 2023 20:31:21 +0200 Organization: LINKOV.NET Message-ID: <86o7fhy9ae.fsf@mail.linkov.net> References: <87bkd3z9bi.fsf@catern.com> <87sf68unh1.fsf@catern.com> <86zg0fu99i.fsf@mail.linkov.net> <875y33v73h.fsf@catern.com> <87y1fztke8.fsf@catern.com> <86r0lrw17x.fsf@mail.linkov.net> <87il5xlf9b.fsf@catern.com> <86y1esuajx.fsf@mail.linkov.net> <86v89ws5t3.fsf@mail.linkov.net> <86v89vzf1o.fsf@mail.linkov.net> <87pm03jn3w.fsf@catern.com> <861qcjw3ch.fsf@mail.linkov.net> <86r0ki2on3.fsf@mail.linkov.net> <86leao519y.fsf@mail.linkov.net> <87fs0wk5oq.fsf@catern.com> <86edgfin4v.fsf@mail.linkov.net> <87o7fhixzv.fsf@catern.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11034"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: Spencer Baugh , emacs-devel@gnu.org To: Spencer Baugh Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 25 19:44:01 2023 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 1r6xdI-0002ej-PA for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Nov 2023 19:44:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r6xcb-0003Xr-NX; Sat, 25 Nov 2023 13:43:17 -0500 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 1r6xcU-0003Vz-OK for emacs-devel@gnu.org; Sat, 25 Nov 2023 13:43:11 -0500 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r6xcS-0000WM-F5 for emacs-devel@gnu.org; Sat, 25 Nov 2023 13:43:10 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id CC69AC0004; Sat, 25 Nov 2023 18:43:03 +0000 (UTC) In-Reply-To: <87o7fhixzv.fsf@catern.com> (Spencer Baugh's message of "Sat, 25 Nov 2023 16:44:50 +0000 (UTC)") X-GND-Sasl: juri@linkov.net Received-SPF: pass client-ip=217.70.183.198; envelope-from=juri@linkov.net; helo=relay6-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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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:313219 Archived-At: >>>> I don't think this is realistic to add an individual option in all cases. >>> >>> That's not necessary. We could also do possibility C that I described >>> before: >>> >>>>> C. >>>>> - Remove display-sort-function from the metadata >>>>> - add the 'read-kill category to the metadata >>>>> - add 'read-kill to completion-category-defaults >>>>> (diff is 3 lines) >>> >>> That seems simple and straightforward. >> >> Removing display-sort-function is still less safe >> than just adding a category. > > Why do you say that? > > The reason that comes to mind is that there are replacement completion > UIs which will need to explicitly add support for the category. So > removing display-sort-function will affect them immediately, when they > might not yet have support for getting display-sort-function from > completion-category-defaults. > > That is true. > > But that actually suggests a further argument in this direction: if we > use user options which change the display-sort-function in the table > metadata, we'll have support for all completion UIs out of the box. > > That seems really desirable! So maybe we do want a solution like A > where we add a user option? Since that user option will work for all > completion UIs. > > Announcing "you can now customize the sorting order of a bunch of > completing-read-based things in this new way" but having that new way > only work for the default completion UI is a bit sad, although of course > they can support the new way eventually. This is what I believe they should do: we add a category, and they support it as well. >>> Identity obviously keeps the original order, but what is the original >>> order? That is not documented anywhere and I don't think it's >>> intuitive. The user can always just try it and see, but that's a poor >>> substitute for documentation. >> >> In these rare cases when the default order is not intuitive, >> this can be explained in the docstring of the command that uses >> 'completing-read', e.g. in the docstring of 'read-from-kill-ring'. > > Hm, I do think the wording on that would be a bit tricky. Since > *actually* the default behavior today is alphabetical sorting. We would > want to say "if completions-sort is nil, read-buffer completions are in > buffer-list order". > > I guess it's not too bad, but we also need to document the category > symbol. And perhaps the version it was added in. All together it still > seems to me that it would be better to just mention > 'read-from-kill-ring-sort' in the docstring of 'read-from-kill-ring'. I'm still not convinced that a user option is needed for such minor thing. >>>> I still don't understand why do you worry about this precedence when >>>> the user option completion-category-overrides is nil by default. >>>> >>>> Could you describe a use cases when such precedence might become a problem? >>> >>> If some table needs an individual option (because the sorting needs to >>> affect the completion generation), but the table shares a category with >>> other tables, then that individual option will be overridden by the >>> category configuration. >> >> Agreed, this is a problem. >> >>> For example, project-prompt-project-name allows one to complete over >>> project names. If I wanted to sort its completions by some detail of >>> the underlying project (how recently the git repo was updated, maybe), >>> that would require the table to change behavior. So it would need an >>> individual option. >> >> Or an individual subcategory. >> >>> However, project-prompt-project-name uses the same category as >>> project-find-file. So if the user configured sorting for >>> project-find-file, it will override the table-specific option for >>> project-prompt-project-name. >> >> I believe they should use two different subcategories, e.g. >> 'project-file' and 'project-name'. > > I agree, but... > >>> I suppose another option is to simply declare that every table has to >>> have a unique category. That would make "category" a misnomer though. >> >> Even such subcategories as 'project-name' make sense to use in other >> possible cases when reading a project name. > > ...if the project-name category is used for other tables too, but the > option is supposed to be specific to an individual completion table, > then we have the same problem again. And an alternative to add separate options to all these tables doesn't look more attractive.