GNU bug report logs -
#38101
User's customization to completion-styles requires tweak to completion-category-defaults
Previous Next
Full log
Message #29 received at 38101 <at> debbugs.gnu.org (full text, mbox):
>> > (setq completion-styles '(flex))
>> > (setq completion-category-defaults nil)
Right: `completion-category-defaults` lets us specify different default
completion styles for particular cases, but it doesn't clearly says "how
different" and instead just overrides the global setting.
In practice it's been used so far to override the default (mostly)
prefix completion with substring completion, IOW the override is
performed in order to use a "more lax" completion (where "lax" here can
be understood as the size of the set of matching candidates for a given
pattern: `substring` matches more candidates than `basic` so it is "more
lax").
But if the user sets the default completion style to a "very lax" style
such as `flex` then the override doesn't work as intended any more.
It won't completely prevent the use of `flex` luckily:
(defun completion--styles (metadata)
(let* ((cat (completion-metadata-get metadata 'category))
(over (completion--category-override cat 'styles)))
(if over
(delete-dups (append (cdr over) (copy-sequence completion-styles)))
completion-styles)))
So, if the default `completion-styles` is `(flex)` and the
`completion-category-defaults` specifies, say, `(basic substring)`, then
the result is to use `(basic substring flex)` which still includes
`flex` (hence the problem is not too crippling) but `flex` will only be
used when both `basic` and `substring` fail to find any matching
candidates, which is not what was desired. In this specific case is
`basic` or `substring` find matching candidates those would also have
been returned by `flex` and (presumably) with the best scores, so the
end result (compared to only using `flex`) is mostly that *Completions*
gets truncated.
Stefan
This bug report was last modified 3 years and 106 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.