Subject: bug#34089: 27.0.50; Substring icomplete broken for M-x switch-to-buffer

From: Stefan Monnier <[email-masked]>
Date: Tue, 15 Jan 2019 21:02:59 -0500

> Now type "M".  The minibuffer suggest the buffer "Messages", but what
> about "*Messages"?  Why isn't it considered?

Your (setq completion-styles '(substring)) is ignored by `C-x b`
because that command uses category `buffer` which has
a setting in completion-category-defaults of (styles basic substring),
so before trying `substring` it tries `basic`.

IOW, by default C-x b first tries prefix match and when that fails falls
back on `substring` and if you want to use `substring` without using
`basic` before, you'll need

    (add-to-list 'completion-category-overrides '(buffer (styles substring)))

Arguably this is a bug: the purpose of this completion-category-defaults
settings is to add substring after the global default `basic` style, so
if the global default starts with `substring` the better behavior would
be to just use the global default.

Not sure how to write the code that combines category-default-styles and
global styles in order to get that behavior.

        Stefan