0

Linux Mint 20

Emacs 27.1

Install package: Consult, Vertico, Embark

Steps:

M-x shell 

enter image description here

Input

cat test. 

and press TAB

enter image description here Open window *Completions* with possible candidates. Nice... but the cursor is not focus on this buffer. Cursor is still stay on shell buffer. So as result I need to press M-<arrow down> (windmove-down) to switch to window *Completions* and select desire candidate. enter image description here

It's not very convenient. Is it possible when press TAB to automate switch to window *Completions* ?

4
  • 1
    What I do is to use the completions window to figure out how much to type before pressing TAB again to restrict the choices further. E.g. here if you want the first file, type a TAB RET. I find that much faster than switching windows (although I do that too occasionally when I decide it would take too much typing - but I certainly don't want it done automatically). Commented Sep 17, 2021 at 15:04
  • @NickD This help: (setq completion-in-region-function (lambda (&rest args) (apply (if vertico-mode #'consult-completion-in-region #'completion--in-region) args))) Commented Sep 19, 2021 at 15:02
  • Can you explain? What does this help? Is it an answer to your question? (if so, you should make it a proper answer). Commented Sep 19, 2021 at 16:51
  • @NickD I added my anser Commented Sep 19, 2021 at 17:24

1 Answer 1

0

Here solution: In my init.el

(require 'consult) ;; Auto switch to buffer *Completition* when press TAB. ;; Use `consult-completion-in-region' if Vertico is enabled. ;; Otherwise use the default `completion--in-region' function. (setq completion-in-region-function (lambda (&rest args) (apply (if vertico-mode #'consult-completion-in-region #'completion--in-region) args))) 

Here help: consult-completion-in-region

1
  • If this answers your question, please accept this answer so the question will be removed from the "unanswered" queue Commented Jun 11, 2023 at 21:20

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.