From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Omar =?UTF-8?Q?Antol=C3=ADn?= Camarena Newsgroups: gmane.emacs.bugs Subject: bug#45260: 28.0.50; Maybe flex should only sort when there is no sorting metadata? Date: Tue, 17 Aug 2021 10:27:23 -0500 Message-ID: <8735r8852c.fsf@matem.unam.mx> References: <86a6uehpod.fsf@matem.unam.mx> <87v944wdxu.fsf@gmail.com> <847fabdb-8b06-dd0f-b2ad-6c71d2f5c3cd@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23747"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 45260@debbugs.gnu.org, =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 17 17:28:11 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1mG10c-00061Z-BY for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Aug 2021 17:28:10 +0200 Original-Received: from localhost ([::1]:33362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mG10b-0008S5-D3 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Aug 2021 11:28:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mG10T-0008P0-Tw for bug-gnu-emacs@gnu.org; Tue, 17 Aug 2021 11:28:01 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42290) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mG10T-00061x-N3 for bug-gnu-emacs@gnu.org; Tue, 17 Aug 2021 11:28:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mG10T-0001tC-KN for bug-gnu-emacs@gnu.org; Tue, 17 Aug 2021 11:28:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Omar =?UTF-8?Q?Antol=C3=ADn?= Camarena Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Aug 2021 15:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45260 X-GNU-PR-Package: emacs Original-Received: via spool by 45260-submit@debbugs.gnu.org id=B45260.16292140527219 (code B ref 45260); Tue, 17 Aug 2021 15:28:01 +0000 Original-Received: (at 45260) by debbugs.gnu.org; 17 Aug 2021 15:27:32 +0000 Original-Received: from localhost ([127.0.0.1]:53835 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mG100-0001sN-7O for submit@debbugs.gnu.org; Tue, 17 Aug 2021 11:27:32 -0400 Original-Received: from gauss.matem.unam.mx ([132.248.17.1]:44772) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mG0zx-0001sA-GW for 45260@debbugs.gnu.org; Tue, 17 Aug 2021 11:27:30 -0400 Original-Received: from penguin (unknown [187.207.151.156]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: omar) by gauss.matem.unam.mx (Postfix) with ESMTP id 1FFCC54221; Tue, 17 Aug 2021 10:27:27 -0500 (CDT) In-Reply-To: (Dmitry Gutov's message of "Tue, 17 Aug 2021 17:49:39 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:212092 Archived-At: Jo=C3=A3o said: > I've not seen an example of a table where its original sorting > mattered more _when_ there is some search pattern. I'd argue the case I mentioned in the bug report is a good example. That was the case of the consult-line command from Daniel Mendler's consult package. That commands prompts for a line to go to using completions. The completion candidates thus are all the lines in the current buffer. The lines are prefixed with their line numbers in an affixation-function and the display-sort-function is set to identity, so that the candidates appear in the order they occur in the buffer. The flex completion style is a pretty reasonable one to use with that command, and it is a powerful way to find a line in a buffer by typing realtively few characters in the line. But if you use a completion UI that displays the candidates automatically while you type, such as icomplete-mode (preferably icomplete-vertical-mode since these candidates are full lines!), it is jarring that flex jumbles the line order. I believe this to be a natural example where you want to keep the candidates' order. But also feel free to close this issue if you strongly disagree with it. I'm not that invested since I do have what Jo=C3=A3o suggested: an "omar-flex" style that doesn't sort (through a completion-style I wrote called orderless which includes a flex substyle, and to be honest I hardly ever use flex, either Jo=C3=A3o's version or the version in orderless). Also, if I really want to use flex it is easy enough to disable the sorting for specific commands such as consult-line: (defun keep-flex-from-sorting (fn &rest args) (put 'flex 'completion--adjust-metadata nil) (unwind-protect (apply fn args) (put 'flex 'completion--adjust-metadata 'completion--flex-adjust-metada= ta))) (advice-add 'consult-line :around #'keep-flex-from-sorting) Since flex's sorting is what you want for the vast majorit of commands, I think this advice approach is a perfectly serviceable work around. [Since in Emacs I can usually work around any issue without needing any upstream changes, I feel my debating skills have deteriorated: I don't have to convince people my suggestions are a good idea! So I just suggest but then don't insist. ;) ] --=20 Omar