all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: master 0e8d8a72284: Fido-mode: never shadow 'external' completion style
       [not found] ` <20230505184529.69F06C22EED@vcs2.savannah.gnu.org>
@ 2023-05-05 18:57   ` João Távora
  2023-05-06  6:01     ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: João Távora @ 2023-05-05 18:57 UTC (permalink / raw)
  To: emacs-devel, Eli Zaretskii, Stefan Monnier

Hello Eli,

I'd like to backport this bugfix to emacs-29.

The commit message explains what's going on.

João


On Fri, May 5, 2023 at 7:45 PM João Távora <joaotavora@gmail.com> wrote:
>
> branch: master
> commit 0e8d8a72284f6b3aaa1bbce73d41c7d84bbc4d3c
> Author: João Távora <joaotavora@gmail.com>
> Commit: João Távora <joaotavora@gmail.com>
>
>     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 LSP
>     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#discussioncomment-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) = 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))))
>
>


-- 
João Távora



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: master 0e8d8a72284: Fido-mode: never shadow 'external' completion style
  2023-05-05 18:57   ` master 0e8d8a72284: Fido-mode: never shadow 'external' completion style João Távora
@ 2023-05-06  6:01     ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2023-05-06  6:01 UTC (permalink / raw)
  To: João Távora; +Cc: emacs-devel, monnier

> From: João Távora <joaotavora@gmail.com>
> Date: Fri, 5 May 2023 19:57:11 +0100
> 
> Hello Eli,
> 
> I'd like to backport this bugfix to emacs-29.
> 
> The commit message explains what's going on.

OK, thanks.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-06  6:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <168331232875.13507.14756021288523252464@vcs2.savannah.gnu.org>
     [not found] ` <20230505184529.69F06C22EED@vcs2.savannah.gnu.org>
2023-05-05 18:57   ` master 0e8d8a72284: Fido-mode: never shadow 'external' completion style João Távora
2023-05-06  6:01     ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.