bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#22324: 25.0.50; completion-category-defaults style doesn't override


From: Stefan Monnier
Subject: bug#22324: 25.0.50; completion-category-defaults style doesn't override completion-styles (gets prepended instead)
Date: Wed, 26 Jan 2022 12:19:00 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> This sounds like a good idea to solve the issue and retain backward
> compatibility. It is like eating the cake backwards :) A `fail'
> completion style is pretty trivial. It boils down to adding `(fail
> ignore ignore "Fail with no completions")` to the
> `completion-styles-alist`, or did I miss something?

No, because `ignore` will return nil and so we'll just keep going to the
next style.  We need try/all-completion functions for this style to
return a non-nil value but that is like "no completion".

I suspect it can't be done quite right without changing `minibuffer.el`,
but we can probably get close enough to be tolerable with older Emacsen.

E.g. for the try-completion case, I think we can return (STRING . POINT)
and for all-completions maybe returning `0` will do the trick.

> I am aware of this distinction, but I chose to ignore it. Calling it
> "quite different" feels like an exaggeration, given that Emacs is
> supposed to be configurable throughout by the user - of course this is
> only my interpretation.

The users are indeed free to mess with anything they like, of course.
But packages are allowed to change `completion-category-defaults`
whereas they're not allowed to change `completion-category-override`.

While we're here, let's not forget the other problem with
`completion-category-defaults` which is when a package puts something
like `substring` in it because `partial-completion` is not "good
enough": this can end up taking precedence over the users's
customization of the default to something like `flex` which is probably
not what's wanted.

I'm not completely sure how to fix that one.  An cheap solution would be
to allow `completion-category-defaults` to specify a function rather
than a list of styles, and then this function will return the list of
styles to use so it can dynamically adapt to the user's chosen default.
But it's kind of a cop out because that function will need to "guess"
what is the relationship between the various styles, which is the crux
of the matter.

This problem doesn't apply to `completion-category-override` since we
can consider it to be the user's responsability to take `completion-styles`
into account when setting `completion-category-override`.


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]