I am finding completion in Emacs system to work similarly to bash completion, in the sense that upon pressing TAB, it presents the user with a list of possible options.

However, I am looking for something more similar to zsh, where pressing TAB completes my input to the nearest match, and pressing TAB again subsequently cycles through remaining matches. Does something like this exist in Emacs?

1 Answer 1


Such TAB completion is available in Emacs, and not just for M-x (completing command names).

  1. With vanilla Emacs, that is, without any additional library, you can have TAB cycle among completions by customizing user option completion-cycle-threshold to a number or the value t. If a number N then TAB cycles only when there are fewer than N completions of your input. If t then TAB always cycles, no matter how many completions there are.

    See the Emacs manual, node Completion Options, for more info. (You can get to this doc in Emacs itself using C-h r g completion options.)

  2. In addition, there are several 3rd-party libraries that offer very useful TAB completion, including these:

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.