From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#48841: fido-mode is slower than ido-mode with similar settings Date: Thu, 17 Jun 2021 05:23:53 +0300 Message-ID: <33224e9c-2185-29c0-5aa9-f798b2f3ccaf@yandex.ru> References: <87eedgy7pt.fsf@gmail.com> <1f659c88-4d9d-8fc9-733a-5e6068f9ed4a@yandex.ru> <87a6o3x5j7.fsf@gmail.com> <87y2bnv5xc.fsf@gmail.com> <35be6652-9c8d-ee21-e9eb-9598ad6777eb@yandex.ru> <858682b2-b8fd-898b-bef3-97dbe5e4debc@yandex.ru> <878s3gugqj.fsf@gmail.com> <87zgvtu9bm.fsf@gmail.com> <033e12e5-86e2-cb0c-ac8b-6753b96fa4b2@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2029"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 Cc: Stefan Monnier , 48841@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 17 04:25:13 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 1lthiT-0000Q3-GK for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 17 Jun 2021 04:25:13 +0200 Original-Received: from localhost ([::1]:41972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lthiS-0000Wv-Dp for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 16 Jun 2021 22:25:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60848) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lthiI-0000Ti-Pc for bug-gnu-emacs@gnu.org; Wed, 16 Jun 2021 22:25:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42023) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lthiI-0005GH-I6 for bug-gnu-emacs@gnu.org; Wed, 16 Jun 2021 22:25:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lthiI-0004Ez-AH for bug-gnu-emacs@gnu.org; Wed, 16 Jun 2021 22:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 Jun 2021 02:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48841 X-GNU-PR-Package: emacs Original-Received: via spool by 48841-submit@debbugs.gnu.org id=B48841.162389664316224 (code B ref 48841); Thu, 17 Jun 2021 02:25:02 +0000 Original-Received: (at 48841) by debbugs.gnu.org; 17 Jun 2021 02:24:03 +0000 Original-Received: from localhost ([127.0.0.1]:53569 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lthhL-0004Db-5c for submit@debbugs.gnu.org; Wed, 16 Jun 2021 22:24:03 -0400 Original-Received: from mail-wm1-f45.google.com ([209.85.128.45]:35661) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lthhK-0004D5-1i for 48841@debbugs.gnu.org; Wed, 16 Jun 2021 22:24:02 -0400 Original-Received: by mail-wm1-f45.google.com with SMTP id o39-20020a05600c5127b02901d23584fd9bso2474103wms.0 for <48841@debbugs.gnu.org>; Wed, 16 Jun 2021 19:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=5Wk59ATAthGiUvW1ihcv+1BOgjM0MwXfUCBJokeYIBY=; b=Fe/265fWNdnCDbP71tXObxdb5THku2P3Dfli0p3vqI85bXklL81o+j4HsCL54Va73H FbSExDP9KQ4ZksVfOrAcE3y4nOPlsmAKyANZuomyBBOLb9kAIfbtfR7hLhcafinjBKa6 8E2yrGDNHfBHW9/hQ1mxKCUiz95MTy6vQEkQPhBg2wS7i7NNLnwE3M1gJlH3P24sMmEd K493AsKBxbMtunIBSML88PHXZNPf6EWoupfnCMD4bovOABOBq3oE058zV5V1b3o7Zx/+ nfyXH4Vh8UDguP3MhHjR4w7TXUH1i+tGy09bmy4/BSFfEexe/+UM3Djh57lznc0Bm39N J1SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=5Wk59ATAthGiUvW1ihcv+1BOgjM0MwXfUCBJokeYIBY=; b=hcCaNdrbXg7ZftMjunFah6u1vn4X6PAiZwQ8VYadwBnfzPgWLWyC0LysKQThlPAPzE iZXW7Gt49LWlS+pcs//jVgwhelpzZcsF/b42M/9rbLhYT9aUZqk8oYhTdj0diIjA7zLV OGw08ZuewNi1HFOIfNg0+i1w3GESG3dOMqlC4lNMPWtBHenKc+mx70zdQb1/2ypYv7S1 bGH9jrpcvTHGn+L73QpG1OCAFmr19h2LdYQl4DuSqzcXPtyi1sSpZBlJHZ9tYBixSGO9 KV4xBfe+3SDspuqFUYroue6o7sxIoAHHLicXhPKDK/dDCuxXoUfDPAg0kyPWxo/ieWxz BCqg== X-Gm-Message-State: AOAM530nwo/qMSdO+xw0AofjpwsrRJ4Q0XxdJi2/rILwfzgYZtGxaiVs tDo5p7X0OQ7FLuqJkRvimr00XtsoJAs= X-Google-Smtp-Source: ABdhPJzttqT822jGQbY8HET5xQTq78tFechMoeXLpEAKj+TiLagJyq8cfS4hE7kz/Qk3lQPDGmyCrw== X-Received: by 2002:a05:600c:358b:: with SMTP id p11mr2154206wmq.112.1623896636085; Wed, 16 Jun 2021 19:23:56 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id w23sm6917457wmi.0.2021.06.16.19.23.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Jun 2021 19:23:55 -0700 (PDT) In-Reply-To: Content-Language: en-US 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:208652 Archived-At: On 14.06.2021 03:16, João Távora wrote: >> Perhaps predicate it on the value of icomplete-hide-common-prefix instead? >> >> fido-mode sets it to nil, and this way we retain a better level of >> abstraction, and better backward compatibility for vanilla >> icomplete-mode users. > This is a good idea, the level of abstraction. But what is this > "common prefix" anyway? Is it the the same as the "determ" > thing, or the "[mplete...] dance" as I called it earlier. Shouldn't > fido-mode then_hide_ it? > > I'm confused, but if you're not, go ahead and make that more > abstract change instead of relying on fido-mode. So... it's a bit more complex than that. The 'most' value computes the biggest "fuzzy" match (taking into account completion styles) and bases the resulting display of the "single match" on that. Before your patch the output could look like: starfshe|(...t-file-process-shell-command) [Matched] with the patch it's much less informative: starfshe| [Matched] ...so it has value, whether the variable I mentioned above is t or nil. It seems there are two ways to proceed from here: - Just alter the printing logic in the "single match" case to print the match text in full is it's not equal to the input string. I haven't puzzled out the logic doing that yet. - Try to keep the current behavior while avoiding the duplicate work. About the latter option: the result of that most-try stuff is only useful when there is only one match, right? But that work is performed unconditionally. Unless I'm missing something and the value does see some use in the multiple-matches situations, the patch below both keeps the current behavior and gives the same performance improvement: diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 08b4ef2030..fc88e2a3e0 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -859,13 +859,14 @@ icomplete-completions (base-size (prog1 (cdr last) (if last (setcdr last nil)))) (most-try - (if (and base-size (> base-size 0)) + (unless (cdr comps) + (if (and base-size (> base-size 0)) + (completion-try-completion + name candidates predicate (length name) md) + ;; If the `comps' are 0-based, the result should be + ;; the same with `comps'. (completion-try-completion - name candidates predicate (length name) md) - ;; If the `comps' are 0-based, the result should be - ;; the same with `comps'. - (completion-try-completion - name comps nil (length name) md))) + name comps nil (length name) md)))) (most (if (consp most-try) (car most-try) (if most-try (car comps) ""))) ;; Compare name and most, so we can determine if name is