From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Juri Linkov <juri@linkov.net>
Newsgroups: gmane.emacs.devel
Subject: Re: Updating *Completions* as you type
Date: Fri, 24 Nov 2023 09:58:24 +0200
Organization: LINKOV.NET
Message-ID: <86edgfin4v.fsf@mail.linkov.net>
References: <87bkd3z9bi.fsf@catern.com> <87bkcwx3ft.fsf@catern.com>
 <86y1g076vh.fsf@mail.linkov.net> <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>
 <ierleas4fcr.fsf@janestreet.com> <86v89ws5t3.fsf@mail.linkov.net>
 <iercyw445tu.fsf@janestreet.com> <86v89vzf1o.fsf@mail.linkov.net>
 <87pm03jn3w.fsf@catern.com> <861qcjw3ch.fsf@mail.linkov.net>
 <ier1qcin8db.fsf@janestreet.com> <86r0ki2on3.fsf@mail.linkov.net>
 <ierttpdlqe4.fsf@janestreet.com> <86leao519y.fsf@mail.linkov.net>
 <87fs0wk5oq.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="36262"; 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 <sbaugh@janestreet.com>,  emacs-devel@gnu.org
To: sbaugh@catern.com
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 24 09:23:07 2023
Return-path: <emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org>
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 <emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org>)
	id 1r6RSt-0009E0-LD
	for ged-emacs-devel@m.gmane-mx.org; Fri, 24 Nov 2023 09:23:07 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-devel-bounces@gnu.org>)
	id 1r6RRy-000497-3m; Fri, 24 Nov 2023 03:22:10 -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 <juri@linkov.net>) id 1r6RRx-00048z-Ax
 for emacs-devel@gnu.org; Fri, 24 Nov 2023 03:22:09 -0500
Original-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@linkov.net>) id 1r6RRv-00044k-I2
 for emacs-devel@gnu.org; Fri, 24 Nov 2023 03:22:09 -0500
Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 54658240007;
 Fri, 24 Nov 2023 08:22:04 +0000 (UTC)
In-Reply-To: <87fs0wk5oq.fsf@catern.com> (sbaugh@catern.com's message of "Thu, 
 23 Nov 2023 12:36:28 +0000 (UTC)")
X-GND-Sasl: juri@linkov.net
Received-SPF: pass client-ip=2001:4b98:dc4:8::221;
 envelope-from=juri@linkov.net; 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,
 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." <emacs-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-devel>,
 <mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-devel>
List-Post: <mailto:emacs-devel@gnu.org>
List-Help: <mailto:emacs-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-devel>,
 <mailto:emacs-devel-request@gnu.org?subject=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:313173
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/313173>

>> 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.

> 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'.

>> 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 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.