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: Mon, 20 Nov 2023 09:51:46 +0200
Organization: LINKOV.NET
Message-ID: <86y1esuajx.fsf@mail.linkov.net>
References: <87bkd3z9bi.fsf@catern.com> <86cyxjyr1y.fsf@mail.linkov.net>
 <ier34ye4a3x.fsf@janestreet.com> <86r0lxm7um.fsf@mail.linkov.net>
 <87sf6dx954.fsf@catern.com> <87ttqpwea9.fsf@catern.com>
 <86wmvlw178.fsf@mail.linkov.net> <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>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="38520"; 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: emacs-devel@gnu.org
To: sbaugh@catern.com
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 20 08:56:44 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 1r4z9A-0009su-Bc
	for ged-emacs-devel@m.gmane-mx.org; Mon, 20 Nov 2023 08:56:44 +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 1r4z8D-0003Bo-CY; Mon, 20 Nov 2023 02:55:45 -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 1r4z82-0003BR-2h
 for emacs-devel@gnu.org; Mon, 20 Nov 2023 02:55:34 -0500
Original-Received: from relay9-d.mail.gandi.net ([2001:4b98:dc4:8::229])
 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 1r4z7z-0002A8-PR
 for emacs-devel@gnu.org; Mon, 20 Nov 2023 02:55:33 -0500
Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 990A4FF80A;
 Mon, 20 Nov 2023 07:55:23 +0000 (UTC)
In-Reply-To: <87il5xlf9b.fsf@catern.com> (sbaugh@catern.com's message of "Sun, 
 19 Nov 2023 19:22:49 +0000 (UTC)")
X-GND-Sasl: juri@linkov.net
Received-SPF: pass client-ip=2001:4b98:dc4:8::229;
 envelope-from=juri@linkov.net; helo=relay9-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:313039
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/313039>

> Finally got to it, I've added that in this patch (which combines both
> the read-buffer-sort and completions-sort changes).

Thanks, a quick test shows that everything works nicely.

> +      Lisp_Object res = list2 (Fcons (Qcategory, Qbuffer),
> +			       Fcons (Qcycle_sort_function, Qidentity));
> +      if (EQ (Vread_buffer_sort, Qbuffer_list))
> +	res = Fcons (Fcons (Qdisplay_sort_function, Qidentity), res);
> +      else if (FUNCTIONP (Vread_buffer_sort))
> +	res = Fcons (Fcons (Qdisplay_sort_function, Vread_buffer_sort), res);
> +      return Fcons (Qmetadata, res);

I still have doubts about adding separate sorting options for
every completion category.

What do you think about adding customization of display-sort-function
to the existing option completion-category-overrides?

This would allow users such customization for 'C-x b' and 'C-x p p'
to sort buffers and projects by history:

  (setopt completion-category-overrides
    '((buffer (display-sort-function . minibuffer-sort-by-history))
      (project-file (display-sort-function . minibuffer-sort-by-history))

And default values could be specified in completion-category-defaults.