From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: master 0e8d8a72284: Fido-mode: never shadow 'external' completion style Date: Fri, 5 May 2023 19:57:11 +0100 Message-ID: References: <168331232875.13507.14756021288523252464@vcs2.savannah.gnu.org> <20230505184529.69F06C22EED@vcs2.savannah.gnu.org> 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="9465"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel , Eli Zaretskii , Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri May 05 20:56:04 2023 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 1pv0b6-0002HY-0O for ged-emacs-devel@m.gmane-mx.org; Fri, 05 May 2023 20:56:04 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pv0aL-0004Ci-9s; Fri, 05 May 2023 14:55:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pv0aJ-0004CM-5p for emacs-devel@gnu.org; Fri, 05 May 2023 14:55:15 -0400 Original-Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pv0aF-0003W0-SK; Fri, 05 May 2023 14:55:14 -0400 Original-Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3908c252609so1209987b6e.1; Fri, 05 May 2023 11:55:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683312910; x=1685904910; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=PtfC/UXp8G6G+UpIMZqkUu/2i2YJe1aa+gVfj65jnpA=; b=F04jbalPh4KPhaxvjdq3nj7soZKa9p34V0WayGH+8Usrl9MpB1erxZB3tsgXnvsaLC NIIjuxIs+/kqcoPvDFDD4diH8RmXRrK7eBKdS+TkQ4jyUBr1qM7bBzZVUwLRpVVFJTA/ d6iy4iC7voWcKbW/86gUVOc/iJ3fT5xJZE0HxrMMexAyArC3ccBsoQZ1cP4kMVaXSlqg 1Otu+710xJoZaGNg0Mb55AVVHij/lfWqq6nxTADvzkr3LCrYhKCG9RpQu6oW2mSKxj91 Oj2/QXa/MCFShr1++WcXtvJjPMdv9CKziUiCgVDsuXCoGWeOWUfFNAn4YDmw9urOEt1Z 381g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683312910; x=1685904910; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PtfC/UXp8G6G+UpIMZqkUu/2i2YJe1aa+gVfj65jnpA=; b=ROHfT6qktQRo57qH5FwMxDp3HEY5wlcDoSUZIVk02vIQk66Ea9VfNLBNAgkyF6GjF7 ZX7QcgPmtFwxQPrUb0+IDJMJIz08Yyrh0/MMGKEItyzxMT/OWWlXu4c22QntnBJNRGe1 nzTYkk6k2GlUPSV049U74fVBt1hfCKPFtYLU4iyRply0IjkfMeALvZ/dvi6ARJD8/hv+ /722IJkk15soQN9D8oNzVpqFHnP4m5h6nPN7C6djqywJkjfNgS2dY8Dp1KB27x+HVufI iNlvNImSmZkBMGLm2FTvdCV1IDMGPishWeFPDs+P+ktYPxSUq+reQSBS1aS5v9STf7nt 0YSw== X-Gm-Message-State: AC+VfDzHDyLrEFIKco0yVh1rlEpIHoIH9oQMsiIittzBFvvRmTMOd9pT C0A/srbizSHh4mJCKSH1bUY+UbGJ38MN2QWHBlNAbcQQ X-Google-Smtp-Source: ACHHUZ6oeuy8fQq6Ik5XQM6bXUJxO6JnPIfVObS9Bdj3ixWM/UOdFQNh4bPHTO8/jR/uPJCDEGy2zRj5Hil8L+Xqkas= X-Received: by 2002:a05:6808:6246:b0:38d:ed6f:536 with SMTP id dt6-20020a056808624600b0038ded6f0536mr1011576oib.42.1683312910092; Fri, 05 May 2023 11:55:10 -0700 (PDT) In-Reply-To: <20230505184529.69F06C22EED@vcs2.savannah.gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::22c; envelope-from=joaotavora@gmail.com; helo=mail-oi1-x22c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:305886 Archived-At: Hello Eli, I'd like to backport this bugfix to emacs-29. The commit message explains what's going on. Jo=C3=A3o On Fri, May 5, 2023 at 7:45=E2=80=AFPM Jo=C3=A3o T=C3=A1vora wrote: > > branch: master > commit 0e8d8a72284f6b3aaa1bbce73d41c7d84bbc4d3c > Author: Jo=C3=A3o T=C3=A1vora > Commit: Jo=C3=A3o T=C3=A1vora > > Fido-mode: never shadow 'external' completion style > > As explained in the manual (20.7.2 Fast minibuffer selection) > 'fido-mode' and 'fido-vertical-mode' give priority the "flex" > completion style. > > In fact, bug#62015 was recently fixed in commit because that priority > was not taking place correctly and some completions were missed. > > However, an exception must be made for the 'external' completion > style. > > That style, made available by the lisp/external-completion.el library= , > is specifically designed to work with backends that provide only a > partial view of all completions. If we allow 'flex' to step in front > of 'external' it could mean that 'flex' matches something and > 'external' isn't triggered as it probably should. > > To reproduce have the rust-mode ELPA package and the rust-analyzer LS= P > server handy. Then: > > emacs -Q -f package-initialize main.rs > > Where main.rs is this content: > > fn foo1() {} fn foo2() {} fn foo3() {} > fn foobar1() {} fn foobar2() {} fn foobar3() {} > > The rust-analyzer server can be quickly configured to return only 3 > workspace symbols max, so evaluate: > > (setq-default eglot-workspace-configuration > '(:rust-analyzer > (:workspace (:symbol (:search (:limit 3)))))) > > Now start M-x eglot and M-x fido-vertical-mode and type C-u M-. to > find an arbitrary symbol in this one-file project. > > Type 'f'. You will see the three foo's are listed, correctly. > > Now type '3'. You will only see "foo3". > > But that's wrong because "foobar3" was available, if only the server > had been asked for it. This commit fixes the situation and no > completions are lost. > > As an unfortunate side-effect of this commit, the fontification of > completions-common-part on the matches is lost, but that is not worse > than missing out on completions and there are better ways to recover > the fontification anyway (in external-completion.el). > > See also: > https://github.com/joaotavora/eglot/discussions/1219#discussioncommen= t-5818336 > > * lisp/icomplete.el (icomplete--fido-ccd): Do not touch entries > with 'external in them. > --- > lisp/icomplete.el | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/lisp/icomplete.el b/lisp/icomplete.el > index 6ed2cbe395c..e6fdd1f1836 100644 > --- a/lisp/icomplete.el > +++ b/lisp/icomplete.el > @@ -427,7 +427,10 @@ if that doesn't produce a completion match." > for (cat . alist) in completion-category-defaults collect > `(,cat . ,(cl-loop > for entry in alist for (prop . val) =3D entry > - if (eq prop 'styles) > + if (and (eq prop 'styles) > + ;; Never step in front of 'external', as that > + ;; might lose us completions. > + (not (memq 'external val))) > collect `(,prop . (flex ,@(delq 'flex val))) > else collect entry)))) > > --=20 Jo=C3=A3o T=C3=A1vora