I would like to prevent completions to the empty string in python and in inferior-python-mode.

To explain a bit better - when the prompt or the string is empty, there are no completions proposed. When I type something, say "a", I get a number of completions (such as abs, all, any, etc.). If I backspace and get back to the empty string, instead of just getting back to a normal cursor, I get empty string completions such as "%%!", "%%HTML" and more irrelevant options of the sort.

My completion-at-point-functions are (python-shell-completion-at-point comint-completion-at-point t)

I'm using spacemacs with the basic python layer and not too many changes (using ipython as my REPL, with python-shell-completion-native-enable set to true). I hope this might be enough information already to suggest a solution.

The issue seems to be with python-shell-completion-at-point since the behavior is maintained when I leave only that function in my local completion-at-point-functions alist.

1 Answer 1


Setting company-minimum-prefix-length to 2 for inferior-python-mode solved this.

On spacemacs

    :backends (company-files company-capf)
    :modes inferior-python-mode
    company-minimum-prefix-length 2
    company-idle-delay 0.5)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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