unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#34089: 27.0.50; Substring icomplete broken for M-x switch-to-buffer
@ 2019-01-16  0:11 João Távora
  2019-01-16  2:02 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: João Távora @ 2019-01-16  0:11 UTC (permalink / raw)
  To: 34089; +Cc: monnier

Hi maintainers,

In my newfound icomplete adventures, I've come across a very annoying
bug I just cannot catch:

    Emacs -Q
    M-x icomplete-mode
    M-: (setq completion-styles '(substring)) RET
    M-: (generate-new-buffer "Messages") RET
    C-x b

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

If, instead of "M", I type "essa", then "Messages" and "*Messages*"
_are_ both considered, correctly.

Tracing completion-substring-try/all-completion shows that it is not
being called in the first situation: why???

João









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

* bug#34089: 27.0.50; Substring icomplete broken for M-x switch-to-buffer
  2019-01-16  0:11 bug#34089: 27.0.50; Substring icomplete broken for M-x switch-to-buffer João Távora
@ 2019-01-16  2:02 ` Stefan Monnier
  2019-01-16  6:48   ` João Távora
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2019-01-16  2:02 UTC (permalink / raw)
  To: João Távora; +Cc: 34089

> 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





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

* bug#34089: 27.0.50; Substring icomplete broken for M-x switch-to-buffer
  2019-01-16  2:02 ` Stefan Monnier
@ 2019-01-16  6:48   ` João Távora
  0 siblings, 0 replies; 3+ messages in thread
From: João Távora @ 2019-01-16  6:48 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 34089, 34089-done

[-- Attachment #1: Type: text/plain, Size: 467 bytes --]

On Wed, Jan 16, 2019, 02:04 Stefan Monnier <monnier@iro.umontreal.ca wrote:

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


Delete everything and try again?

I kid, I kid... :-) Thanks Stefan, I was hoping for such an easy answer!

BTW how do you debug this stuff?  Edebug is akward because of the
minibuffer usage (and the second frame technique doesn't always work).

João

[-- Attachment #2: Type: text/html, Size: 916 bytes --]

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

end of thread, other threads:[~2019-01-16  6:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-16  0:11 bug#34089: 27.0.50; Substring icomplete broken for M-x switch-to-buffer João Távora
2019-01-16  2:02 ` Stefan Monnier
2019-01-16  6:48   ` João Távora

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).