From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= 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 17:38:22 +0100 Message-ID: <87v944uiv5.fsf@gmail.com> 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="33615"; 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, Omar =?UTF-8?Q?Antol=C3=ADn?= Camarena To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 17 18:39: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 1mG27K-0008Ws-T3 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Aug 2021 18:39:11 +0200 Original-Received: from localhost ([::1]:52862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mG27J-0003y4-4T for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Aug 2021 12:39:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mG27C-0003w4-C0 for bug-gnu-emacs@gnu.org; Tue, 17 Aug 2021 12:39:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42380) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mG27C-0006u9-26 for bug-gnu-emacs@gnu.org; Tue, 17 Aug 2021 12:39:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mG27C-0003lk-0S for bug-gnu-emacs@gnu.org; Tue, 17 Aug 2021 12:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Aug 2021 16:39: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.162921831414454 (code B ref 45260); Tue, 17 Aug 2021 16:39:01 +0000 Original-Received: (at 45260) by debbugs.gnu.org; 17 Aug 2021 16:38:34 +0000 Original-Received: from localhost ([127.0.0.1]:53926 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mG26k-0003l3-8t for submit@debbugs.gnu.org; Tue, 17 Aug 2021 12:38:34 -0400 Original-Received: from mail-wr1-f41.google.com ([209.85.221.41]:42849) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mG26i-0003kq-Cr for 45260@debbugs.gnu.org; Tue, 17 Aug 2021 12:38:33 -0400 Original-Received: by mail-wr1-f41.google.com with SMTP id q11so29555226wrr.9 for <45260@debbugs.gnu.org>; Tue, 17 Aug 2021 09:38:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=TBT4kVHUg5VZvUkdkoSNP0qmWaZp8QXX3gIDYUfptes=; b=BQUJiwvsE+/UhMbiKdAFSDAB7ILv4+fQW7ctLgolV2OCBpIr0p9DmAf8iY85rv3AsV tMfKVC2JL/wzSBImyFIC6JwLtEf9BArRB3nZXcRB9/dX708PnngN17PwzW2De87HgjoH MGuNq0xzCYM1o0PzxePfWBmSi0z8DwmHFawXcSzmKe/oc/jLwNocUuCa4mnG77C+8gUF 7gfw0mX6LXbkJZC5nkNfeWbR3NeI7/2GSYo2l3YzrxJ4jvS5x1FzxBDiHmVnvCZuGGji HrOsM1fB7PFOCs9qn4IbVmrcVhB8CPuZQxMEblWr3U4ICnj2rl4Yy7cCIJ8rIdFJOJ2X LmVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=TBT4kVHUg5VZvUkdkoSNP0qmWaZp8QXX3gIDYUfptes=; b=Sq35DSOlz61abxHsNgMgRTJJVgUeq3fdkcUloz0VUhujrI6YQbPxoK5d+jKZmE/JMb p676tQb/1qxSBn4MeEaH/Fy0jefHDvgcDbeSttlU/g2Nuoty1k9V/tniMoqMlVrlItVN yweSfb6+22yGt58EgJFo62TWtlaIXhG3tTFzF7AVjAHpEjDRYipwwpoJTnuOekl3faSh jISG1Cu4c5lTVAHR4ai1b+agc3JciQuwfJnJh8ELzGLM+siv9517yyxpylarkdc+pNqU gTrjvPWu0BeNwzOcVGYZn7c+QOxZv17nnyA1/nC5N5bbWoNNoRUroR4a21uyAYfq0Pn5 j7kQ== X-Gm-Message-State: AOAM533FP4msWG93d1oWIl2adPhcr4DZH7bK+sWJS6318w4y1tvr31/z TxjQ8lRLC6L7keZ+U0AoGdA= X-Google-Smtp-Source: ABdhPJxCDRjRz6qbvx0LYJqsvDLBcytMhqmBSDP4tSFcsmOSffBUk7qgRPXubhwPmS1K5ojywzLQdg== X-Received: by 2002:a5d:474d:: with SMTP id o13mr5276115wrs.256.1629218306409; Tue, 17 Aug 2021 09:38:26 -0700 (PDT) Original-Received: from krug (a94-133-27-132.cpe.netcabo.pt. [94.133.27.132]) by smtp.gmail.com with ESMTPSA id p6sm3150439wrw.50.2021.08.17.09.38.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Aug 2021 09:38:25 -0700 (PDT) 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:212095 Archived-At: Dmitry Gutov writes: > On 17.08.2021 17:05, Jo=C3=A3o T=C3=A1vora wrote: >> On Tue, Aug 17, 2021, 13:43 Dmitry Gutov > > wrote: >> On 17.08.2021 13:41, Jo=C3=A3o T=C3=A1vora wrote: >> > I've >> > not seen an example of a table where its original sorting >> mattered more >> > _when_=C2=A0 there is some search pattern. >> Do you have examples of completion tables which do specify >> sorting, but >> where flex sorting obviously should take precedence? >> No, do you? Love to see them, or the converse. But does it matter? >> Flex is for searching with patterns, stable sorted by scores, >> solving ties with whatever sort order came first. Dmitry/flex, or >> Flix, or Flax, may be something else, you understand? It's by design >> like this. > > If there aren't any such significant cases, flex could do what Omar is > suggesting, solving the reported problem with no real downside. OK. Let's see the code and then it's easier to evaluate if there's "no real downside". If it's indeed true, than no problem. If it helps, I'll just repeat that flex is a pattern-matching scoreing thing. You type "foo" and if the first element is "fabrobazo" and the last one is "foobarbaz", the last one will sort before the first. A guy who made something called "hotfuzz" which is the same principle, apparently, even better I guess. https://github.com/axelf4/hotfuzz. Anyway, I'd like it to stay that way even if the table says "fabrobazo" is more important than "foobarbaz". When there's no flexy stuff happening, that's fine, when flex kicks in, it takes over. > I would admit it to be a hackish move, but no more so than the recent > commit ab23fa4. I must admit to tire easily of adjectives like "hackish", "improper", "dirty", "faux" along with "not my cup of tee" and "there will be subtle bugs" and judgements based on some vague principia. These things matter close to 0 to me. I need to hear criticism in the form of "there's a bug when I do xyz", "it becomes 123% slower", or "it duplicates x lines of code found in lalaland.el". That's really the only useful criticism of my programs that I can address. In this case ab23fa4, bug#49888 directly solves a pretty solid and very well described bug report that pointed to a vacuum in the flex completion style. It reuses functions `minibuffer--sort-by-length-alpha' and `minibuffer--sort-by-position' that someone else wrote to maximize code reuse. To concrete things: can code reuse and abstractions be improved even further there? I wanted to, but there were the problems noted in the FIXME. You're welcome to fix those, if you can. Sorting takes time and patternless flex became somewhat slower, but it'll become much faster soon, hopefully. > Having multiple similar styles is of course an option, but it comes > with code duplication and associated inconveniences (how many such > styles should Emacs include OOTB?). Code duplication if you make duplicated. If you don't make it duplicated there won't be duplication. Different styles already reuse lots of code. How many styles? As many as you think are worth including, I guess. > That could be solved with some more general approach, like have both > styles and completion tables return sorting scores (with documented > possible values and meanings), and do the combined sorting somewhere > in the layer above. Then the user could choose the combining strategy, > configured separately. Sure, I guess, let's see some code. I trust you to make lots of good code that generally solves problems well and cares about backward compatibility. So let's do that and lay off the vague rethoric, please. Jo=C3=A3o