3

In Emacs, I don't want the *Completions* buffer to pop up, even when I press tab to autocomplete in the minibuffer and there are multiple results. It's distracting and jarring.

How can I do this?

Even better, I would like an alternative that isn't distracting or jarring -- such as requiring one tab for autocomplete if available, but requiring two tabs to open a Completions buffer. This way, I don't get the Completions buffer when I'm expecting an autocomplete. This is what the OS X terminal does to show tab completion possibilities.

I think the cause is the minibuffer-completion-help command, which is run automatically, described here: https://www.gnu.org/software/emacs/manual/html_node/elisp/Completion-Commands.html

I use ido and smex, but the problem occurs in a vanilla Emacs too.

EDIT: I found a hack to fix this. Using M-x find-function, I found and copied the function definition of minibuffer-completion-help into my .emacs.d/init.el file. Then, I renamed the version I copied my-minibuffer-completion-help and changed (with-displayed-buffer-window *Completions* to '(with-displayed-buffer-window *Completions* (putting a quote in front so it is just interpreted as a string. Finally, I overrode the call to minibuffer-completion-help by putting

(advice-add 'minibuffer-completion-help
        :override #'my-minibuffer-completion-help)

after the my-minibuffer-completion-help function in my .emacs.d/init.el file. There must be a better way.

EDIT 2: quoting out (message "Making completion list...") in my-minibuffer-completion-help has the added benefit of getting rid of the flicker in autocomplete that is caused by flashing another message during autocomplete. Is it possible to do this another way?

1 Answer 1

4

Set the variable completion-auto-help to lazy. The documentation says:

Non-nil means automatically provide help for invalid completion input.
If the value is t the *Completion* buffer is displayed whenever completion
is requested but cannot be done.
If the value is ‘lazy’, the *Completions* buffer is only displayed after
the second failed attempt to complete.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.