reddit / emacs

Does Vertico have its plugin switch-to-buffer implementation?

vfclists · 2022-06-26 09:38
I have set `C-x b` to `switch-to-buffer` and it defaults to `ido-switch-to-buffer`. I thought after switching to vertico-mode Vertico would substitute its own interface for the `ido-switch-to-buffer` but its not. What configuration option am I missing?
pwnedary · 2022-06-26 10:18
> [...] `switch-to-buffer` and it defaults to `ido-switch-to-buffer`. It does not, `switch-to-buffer` is `switch-to-buffer` and to prompt for the buffer it uses `completing-read` which Vertico augments.
igorepst · 2022-06-26 10:24
And the interface is augmented by `consult` by the same author: https://github.com/minad/consult
holgerschurig · 2022-06-26 11:35
vertico "just" hooks into completing-read, which is used by several built-in Emacs functions. There is a function called `consult-buffer`, but it's in consult.el, a package that most users of vertico also load. It supports buffers, recently used files, bookmarks and ... acording to it's doc-text ... views. No idea that Emacs has views, and what they do :-) And no, `switch-to-buffer` doesn't default to `ido-switch-to-buffer`, at least not in pure Emacs (e.g. called `emacs -Q`). Personally I bound C-x b to `ibuffer` and C-x C-b to `consult-buffer`. I almost always use C-x C-b, it's easier to type for me because I keep the Ctrl key depressed the whole time.
vfclists · 2022-06-26 13:47
This what it says in Help >switch-to-buffer is an interactive compiled Lisp function in ‘window.el’. >Its keys are remapped to ‘ido-switch-buffer’. Without this remapping, it would be bound to C-x b, <menu-bar> <buffer> <select-named-buffer>. >(switch-to-buffer BUFFER-OR-NAME &optional NORECORD FORCE-SAME-WINDOW) > Probably introduced at or before Emacs version 17. >This function has :around advice: ‘ad-Advice-switch-to-buffer’. >Display buffer BUFFER-OR-NAME in the selected window. >WARNING: This is NOT the way to work on another buffer temporarily within a Lisp program! Use ‘set-buffer’ instead. That avoids messing with the window-buffer correspondences.
pwnedary · 2022-06-26 14:16
How are you reading that? Because it says exactly what I tried to explain: Ido has replaced switch-to-buffer with its own variant, whereas the default would have used Vertico.
vfclists · 2022-06-27 06:00
Your right I checked and it looks like in some undocumented indirect way Ido had changed switch-to-buffer to its own variant. It is not in the init.el, but it seems configured in its default settings.