Subject: Re: bug#22324: 25.0.50; completion-category-defaults style doesn't override completion-styles (gets prepended instead)

From: Daniel Mendler <[email-masked]>
Date: Wed, 26 Jan 2022 14:49:48 +0100

> We can probably have our cake and eat it too by adding a `fail`
> completion style.  Such a style would always take responsibility
> (i.e. would never return nil to delegate to subsequent styles), but
> would always return a "useless" value that gives no completions.
> 
> Then entries in `completion-category-override/defaults` could choose to
> either be mere additions to the global default (as now) or be a full
> override (which they'd get by having this `fail` style at the end).

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?

>> Furthermore we've also got `completion-category-defaults`. It may make
>> sense to distinguish them by making the override a real override and
>> keep the current behavior for the defaults.
> 
> No, the role of those two is already quite different:
> `completion-category-defaults` is for packages to set, whereas
> `completion-category-override` is to be set by end-users.

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. I usually override
`completion-category-defaults` since I want to control the completion
precisely myself and I don't like if packages interfere with that. But
this is probably a special preference of someone who wrote multiple
completion UIs and likes to tweak the Orderless matching behavior... ;)
As far as I know `completion-category-defaults` is not used widely. I
don't have a single package installed which makes use of this
functionality, but once again, this is probably not representative.

Daniel