From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: Add user customization fido-completion-styles Date: Mon, 01 Jun 2020 00:43:15 +0100 Message-ID: <87r1uzn018.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="90076"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (gnu/linux) Cc: emacs-devel@gnu.org To: Andrew Schwartzmeyer Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jun 01 01:44:16 2020 Return-path: 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 ) id 1jfXcm-000NLu-0X for ged-emacs-devel@m.gmane-mx.org; Mon, 01 Jun 2020 01:44:16 +0200 Original-Received: from localhost ([::1]:33920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfXcl-0007kA-1w for ged-emacs-devel@m.gmane-mx.org; Sun, 31 May 2020 19:44:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfXbu-0007GK-Cx for emacs-devel@gnu.org; Sun, 31 May 2020 19:43:22 -0400 Original-Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:39327) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jfXbt-0002ar-EJ for emacs-devel@gnu.org; Sun, 31 May 2020 19:43:22 -0400 Original-Received: by mail-wr1-x442.google.com with SMTP id t18so9704230wru.6 for ; Sun, 31 May 2020 16:43:20 -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=zzouLD9cpLo8A5gGiu8IG1JEwBU5BPvDuqLmRS4M01k=; b=T1opaEjcDy1G6xQw6D0+IQwMbsHRI2S3OveewUgDJ/nhCtm0S3/rL6M3/HMRrWcJao iySieCriBDQ12cT0eysfCse34ANq+95lwT+l6qd8Y2XZYXV4k6i0tTKNqpp4uNKenaJQ 51dLxmYx8T/uzXYwtbov7as4kRQ1FDamaPBGKcabspKm+GGHhVAfCHRI22JSKmftbml9 1yA+aTKmhpjgeUFVb2SwCGq3cpp5p22bhfJbOvz/9gEmxcuENQ67VFMiFMaornWfUSlD IvELvw1m9t8Edd7ih3vkdEz0JZhSKdCRJtoS9z4iqAYFOfy8dnXyWph3ReOv2CwZA6G4 x6UA== 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=zzouLD9cpLo8A5gGiu8IG1JEwBU5BPvDuqLmRS4M01k=; b=UdwBTQS5m0Rs47vYB4H8mN9EE7R8/Q49kb5weLUvCJ1I9tetrVlqcJa5Bc4SEWv8dl J4AKr7rF7aeSFcTfcwFDjXPPNjlGmYvNfrWFWgbf9tyl15c47Dr8n01i1HlO68p7TVjv M6VGJfeLbh2x9gLvos4gwXoOEDkv2gp1FMm7cG9MijFp8GYUIxFGNCp2fhnDJoQdNjf4 G7h5KX62vsBQekWmH3hzxm4iJxlEIsHWtaYcwDSPT7XMva6Cm2B6KBplqMdDK/bgUP73 y69k2UBWa5tKe13mEimyNr2/SEJF8m6dgPMGkMKZgVcBFrtd4QXiqy/hcM4zUjJs+qWa ZBrA== X-Gm-Message-State: AOAM531r7KRZEnU6rsguThrmX8W3/W67N+qauCWE/lKX2thy2j6PWqRw 2T/esFfn90qyGQeZ8TGAVzRCfslUEh0= X-Google-Smtp-Source: ABdhPJyDecNS2EwiDmGyEeKN7BIfNrreKnbGy2LiwmWFZF9hULzN/9rJL3KwEHBGWJh/UWeqBm69Bg== X-Received: by 2002:a5d:5704:: with SMTP id a4mr17643593wrv.389.1590968599085; Sun, 31 May 2020 16:43:19 -0700 (PDT) Original-Received: from krug (89-180-151-241.net.novis.pt. [89.180.151.241]) by smtp.gmail.com with ESMTPSA id p16sm18915914wru.27.2020.05.31.16.43.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 16:43:18 -0700 (PDT) In-Reply-To: (Andrew Schwartzmeyer's message of "Sun, 31 May 2020 14:02:28 -0700") Received-SPF: pass client-ip=2a00:1450:4864:20::442; envelope-from=joaotavora@gmail.com; helo=mail-wr1-x442.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_FROM=0.001, FROM_EXCESS_BASE64=0.979, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:251701 Archived-At: Andrew Schwartzmeyer writes: > Hi, > > Users of fido-mode (like me) may want to customize the completion style i= t uses, so add a variable to allow them to > do so. > > For instance, I really like using the =E2=80=9Cinitials=E2=80=9D style so= =E2=80=9Cvlm=E2=80=9D > quickly completes visual-line-mode, and then falling back to > flex. There are also neat packages like orderless > (https://github.com/oantolin/orderless) which add a new > completion-style, which folks may want to plug-in and use. Anyway, it > seems like it ought to be customizable. Actually, it is, just not with custom. These two lines should do the trick: (add-hook 'icomplete-minibuffer-setup-hook 'my-flex-styles) (defun my-flex-styles () (setq-local completion-styles '(initials flex))) Or just use a lambda, which is even shorter. I'd like to avoid a duplicate version of completion-styles customization vars.=20=20 I am however, receptive to customizing the default styles used in fido mode. We could come up with a "smarter" flex that values matches following "-" a bit more. Or maybe '(initials flex) is a good fit already, I'll play around a bit with it. Or we could even think about making two styles merge "sooner", since currently we skip to the next one only once the previous no longer matches anything. Maybe that could be changed, i.e. adding the matches of the secondary style once the first one only has two or three matches. > P.S. I wish =E2=80=9Cflex=E2=80=9D were a bit faster. On my circa 2012 Ma= cBook, M-x is > noticeably slow with =E2=80=9Cflex=E2=80=9D for commands. Yes, flex isn't blazing fast, particularly with short patterns. The solution is (likely) to port parts of it in C, which isn't particularly hard, just a bit tedious. However, the slowness of flex shouldn't affect the ability to type fast after M-x, since very new character typed should interrupt the lenghty calculation. Let me know if that is somehow not the case with your completion experience. > Also, I don=E2=80=99t know what =E2=80=9C:version=E2=80=9D to put on the = defcustom, and the > docs could be improved a bit. That would depend on what version you intend the patch to target. Since fido-mode is a new thing in Emacs 27.1, it is my understanding (from earlier feedback of Eli) that we can to push to emacs-27, since we won't, by definition, introduce regressions. But I would refrain from doing so this late in the game, unless we are fixing severe misbehaviour. Also, "orderless" looks cool. Is it faster than flex? Jo=C3=A3o