When I do C-x C-f .emacs.d/i TAB Emacs displays a new buffer which presents "Possible completions", which are in my case auto-save-list/, history and init.el. I would like to have it complete to just .emacs.d/init.el.

I have the following inside init.el regarding ido:

(require 'ido)
(ido-mode 1)
(setq ido-enable-flex-matching t)

You can control this by setting the variable ido-enable-prefix to t:

(setq ido-enable-prefix t)

From the documentation:

Non-nil means only match if the entered text is a prefix of file name. This behavior is like the standard Emacs completion. If nil, match if the entered text is an arbitrary substring. Value can be toggled within Ido using ido-toggle-prefix.

The value of ido-enable-flex-matching does not interfere with this setting.

Of course, if .emacs.d/i is a prefix for more than one file, Emacs will still list possible completions.

  • 1
    It seems like ido-enable-prefix means flex matching will never be used. Is there a case I'm missing where having both turned on is useful? I prefer to enable flex matching and then toggle prefix matching on the fly (using C-p) when I need it. – glucas Nov 4 '14 at 19:38

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.