From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Spencer Baugh <sbaugh@catern.com>
Newsgroups: gmane.emacs.devel
Subject: Re: Updating *Completions* as you type
Date: Tue, 17 Oct 2023 22:57:27 +0000 (UTC)
Message-ID: <87bkcwx3ft.fsf@catern.com>
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>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="21939"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: emacs-devel@gnu.org
To: Juri Linkov <juri@linkov.net>
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Oct 18 00:58:42 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 1qst1N-0005Rn-6z
	for ged-emacs-devel@m.gmane-mx.org; Wed, 18 Oct 2023 00:58:41 +0200
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 1qst0K-0002qI-DL; Tue, 17 Oct 2023 18:57:36 -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 <bounces+21787432-489d-emacs-devel=gnu.org@em8926.catern.com>)
 id 1qst0J-0002pv-4m
 for emacs-devel@gnu.org; Tue, 17 Oct 2023 18:57:35 -0400
Original-Received: from s.wfbtzhsv.outbound-mail.sendgrid.net ([159.183.224.104])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1)
 (envelope-from <bounces+21787432-489d-emacs-devel=gnu.org@em8926.catern.com>)
 id 1qst0G-00014X-HO
 for emacs-devel@gnu.org; Tue, 17 Oct 2023 18:57:34 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com;
 h=from:subject:in-reply-to:references:mime-version:to:cc:content-type:
 content-transfer-encoding:cc:content-type:from:subject:to;
 s=s1; bh=pMH1Rf1iKNCIkLnmTsDQbfD5VtcE8WoPJfMCiZwoCMU=;
 b=M59q5Pe0gjamD7OWqG2pfZ0mKiGjuWN8nWZ3JzVCaNaidssxa9O2Qy7MvVA82pOE4mCs
 TSOJbfoKafxsdmu3kDVNdOZqf6mft1NWa8Opv5tvaHFJUjiXT32qbCz/uvkhgSDRK+uhgT
 LRvK7xBV2F7MtOJPcTwEwxT6fOQrhHbRbIy8Cr3qeuKgiSLhb4lmqph3X+9ukApBRIxMJ5
 /zLJeqKVWt3v/vR5ZIes/ItyYfM7ELcLAko/FNT664KoacHIHUmqLDmKXLvXWhbWWc+FGS
 g5mWal6AUKc2j/NKlpCaMV8ZOTVhBpWlgNWpIlZJF3OERYt8gqr0STB5e8/XwWRA==
Original-Received: by filterdrecv-d585b8d85-mjcsw with SMTP id
 filterdrecv-d585b8d85-mjcsw-1-652F1157-19
 2023-10-17 22:57:27.775061432 +0000 UTC m=+15449.109407640
Original-Received: from earth.catern.com (unknown) by geopod-ismtpd-24 (SG) with ESMTP
 id ktk0EdGnTDmh8kvKGjLhqQ Tue, 17 Oct 2023 22:57:27.554 +0000 (UTC)
X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost;
 envelope-from=sbaugh@catern.com; receiver=linkov.net 
Original-Received: from localhost (localhost [IPv6:::1])
 by earth.catern.com (Postfix) with ESMTPSA id DACEA66964;
 Tue, 17 Oct 2023 18:57:26 -0400 (EDT)
In-Reply-To: <86wmvlw178.fsf@mail.linkov.net>
X-SG-EID: =?us-ascii?Q?GW3oCMoYnalRiojMOuLzE6x2H5kORXvlCdz1UwQVRMVT4fbh9ODEfCogOe74cO?=
 =?us-ascii?Q?rI4e0V+MFZgakz9Re5a6=2FCgvSM4FM=2FIQ+nFATMf?=
 =?us-ascii?Q?gkFmD7v=2FKtgWTSQ89mwG0jJzM15csLwnnm0wpIk?=
 =?us-ascii?Q?DnVXXIwIWyDUmRyeXpkItmqkTNbO7I=2FN0OzgDEt?=
 =?us-ascii?Q?qoND4GBpRAZOWLtVAl0nagzZTkqfp1qNpaDWlfQ?=
 =?us-ascii?Q?dTaShGbI=2FqePppcwCrhpzFHQSN5CxbmF6zwRcP?=
X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q==
Received-SPF: pass client-ip=159.183.224.104;
 envelope-from=bounces+21787432-489d-emacs-devel=gnu.org@em8926.catern.com;
 helo=s.wfbtzhsv.outbound-mail.sendgrid.net
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,
 RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 UNPARSEABLE_RELAY=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." <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:311549
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/311549>

Juri Linkov <juri@linkov.net> writes:
>> On reflection, I think adding a new option for completions-sort is
>> indeed what we should do.  Otherwise, we won't get historical sorting
>> for non-programmed completing-read, which is a pretty common kind of
>> completing-read.  Here's a patch to do that.
>
>> We can always add display-sort-functions later for buffers and files, if
>> that ends up being desirable.
>
> Thanks, this is a nice first step that paves the way to later
> additions of display-sort-functions and keys for toggling
> sorting in *Completions*.
>
>> Also, tangentially, I think probably we should rework
>> minibuffer-complete-history and minibuffer-complete-defaults to be
>> persistent - as in, regular TAB afterwards continues to complete history
>> or defaults.  And there should be some way to reset back to normal.
>> That would be a good complement to this completions-sort change, by
>> maybe giving a way to switch on-demand to alphabetical sorting.  (I've
>> long thought this would be good and useful, but in particular it's
>> relevant for completions-auto-update since that will otherwise nearly
>> immediately reset the displayed completions back to normal.)
>
> I think we should choose a key to toggle completion type between
> history/default/regular completion.

That works too of course, although it causes some more proliferation of
keys.

I'm curious, what is the intended usage of
minibuffer-complete-{history,defaults}?  The fact that they only do a
single completion has made them not very usable for me.

>> Subject: [PATCH] Add a historical option to completions-sort
>>
>> This causes completion to sort based on history.  This is useful for
>> getting, e.g., most-recently-used order from C-x b.
>
> Actually for 'C-x b' I'd prefer to sort buffers by the order of (buffer-list),
> not by the order buffers occur in the minibuffer history (that I'd like
> to use for everything else).

Reasonable.  I suggest that this should be achieved by adding a
display-sort-function, though.  (And... actually, that
display-sort-function could maybe just be identity, since the
completions are generated from buffer-list so they are in that order
anyway?)