From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] scratch/new-flex-completion-style 2c75775 2/2: Score, sort and annotate flex-style completions according to match tightness Date: Wed, 27 Feb 2019 12:12:16 -0500 Message-ID: References: <20190202232827.27331.87300@vcs0.savannah.gnu.org> <20190202232828.4AE452159A@vcs0.savannah.gnu.org> <556bfb2e-4720-c86a-c964-f057b50041b6@yandex.ru> <87va1xw7ms.fsf@gmail.com> <212f7cc9-c0c6-bcf8-f200-ea74db261dc3@yandex.ru> <2733dee8-f5a6-396f-228a-84f225d43a1c@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="208242"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 27 18:13:30 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gz2lt-000s42-Ia for ged-emacs-devel@m.gmane.org; Wed, 27 Feb 2019 18:13:29 +0100 Original-Received: from localhost ([127.0.0.1]:47764 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gz2ls-0008TT-GK for ged-emacs-devel@m.gmane.org; Wed, 27 Feb 2019 12:13:28 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gz2lN-0008GT-AO for emacs-devel@gnu.org; Wed, 27 Feb 2019 12:12:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gz2lG-00062N-KY for emacs-devel@gnu.org; Wed, 27 Feb 2019 12:12:54 -0500 Original-Received: from [195.159.176.226] (port=38606 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gz2l8-0005vb-6f for emacs-devel@gnu.org; Wed, 27 Feb 2019 12:12:43 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1gz2kr-000qsE-4P for emacs-devel@gnu.org; Wed, 27 Feb 2019 18:12:25 +0100 X-Injected-Via-Gmane: http://gmane.org/ Cancel-Lock: sha1:m6RfhdKvHnvncuXzWjTA8RYFX/8= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:233665 Archived-At: > This may be off topic now, but to the best of my recollection this > discussion started from the question of the ability to add flex matching to > particular completion tables. So that's where I was coming from, FWIW. I see. I was taking the point of view of a generic `flex` method for use anywhere you like (I think the original motivation was to use it in conjunction with `icomplete-mode` to more closely match to `ido` behavior). > Also also, combining the flex sorting with most other kinds will most likely > make the flex sorting hard to notice. Depends on the ordering (see below). >> - Add global sorting config var(s?), to choose which kind of sorting to >> use, which would default to sorting based on "scores first and >> alphabetical after that". > > Put those defaults into completion-category-defaults, and you basically have > my proposal, isn't that right? completion-category-defaults is an alist providing extra settings for specific categories, so it's not "global" in the sense I meant above because can't be used to choose the sorting used for categories not mentioned in completion-category-defaults. >> - What about the distinction between cycle-sort and display-sort? > TBH, I still don't know what's the difference between these. display-sort is the sorting used when displaying the candidates in a list like *Completions* whereas cycle-sort is the sorting used when your TAB cycles through possible candidates (and it's also used in icomplete-mode). In display-sort we currently sort alphabetically whereas in cycle-sort we want to use a heuristic that puts more likely choices first. Maybe we should drop this distinction and just use the same sorting everywhere (which would have to be the cycle-sort by default I think, because the alphabetical sort is really a poor choice when cycling in my experience). The downside of the heuristic sort of cycle-sort is that sometimes/often the heuristic is poor (by default it's just based on string length ;-( ), so the *Completions* buffer would look "unsorted". >> In any case, in the mean time we can probably just introduce the new >> sorting based on "scores first and alphabetical after that" and use it >> by default. > *thumbsup* OK, let's go with that for now. Stefan