This is similar to many other questions but nothing is leaping out..
I'm a fan of selectrum (similar to helm and ido I gather):
M-x and start typing, it'll find matches and list them.
selectrum-mode enabled during all modes (at least prog-modes), but not during a shell (
M-x shell); I'm fine with a specific list of modes to disable it (i.e. enable for all, then disable selectively) or enable for specific modes, i.e. it's handy during non-prog to
find-file for opening, but when in shell I want regular shell (bash/etc) based tab completion to occur.
Simple enable of selectrum is:
But this is global in all modes, all the time, so the simpler tab-completion goes instead to selectrum.
I tried putting it in an add-hook:
(add-hook 'prog-mode-hook 'selectrum-mode)
but this just enables it globally when first entering a prog-mode, I think; its not limited to prog modes. And really, I'd like it on all the time, barring some modes. The question is can selectrum be non-global at all, and even if it's a global-only minor mode, can it be toggled on and off automagically?
selectrum-mode's code to be non-global (if that's possible), I wonder if there's a way to enable/disable it selectively per mode.
What is best practice?
If it's global, could it be toggled on and off when toggling buffers? Perhaps a code fragment to hook switching buffers and disable as appropriate; i.e. on switch buffer, check if entering the list of modes, and then check if
selectrum-mode is on, and then
(selectrum-mode -1) if needed. This seems cumbersome and likely there is a more elegant approach.
Your help is appreciated; always love to learn something!
edit: Noticed there is a hook
buffer-list-update-hook which might be usable, so perhaps I'll learn enough elisp to build the if-mode-active disable code, but I'm sure there's a much more elegant solution.