40
votes

I use ido mode. Here is how I set in .emacs

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

When I open a file, I do C-x C-f my_file and if it doesn't exist in current directory, emacs will try to search for it in other recent used directories in about a second. However, most of the time I was just trying to create new files. I had to type the file name really fast and then C-j to confirm it. How can I stop ido from doing this?

3
alias 'open new file' as some key other then C-x C-f (M-x find-file is the right name of the action)user2141046
@user2141046 @woodings From ido-find-file you can just hit C-x C-f again to drop down into the traditional find-file interfaceassem
@assem I don't want to fall back to normal find-file. I need ido but not search in other directories.woodings
@assem It's just C-f.abo-abo
@abo-abo oh, yes indeed it is, thanksassem

3 Answers

42
votes

The following will completely disable the feature:

(setq ido-auto-merge-work-directories-length -1)

I've never seen any value in it, so disabling it completely might make sense for a lot of people.

15
votes

Here is another option using Ido:

  1. Type C-x C-f as usual.
  2. Find the directory you want to create the new file in using Ido search.
  3. At any moment type C-f again, and Emacs will go back to the old find-file functionality.

You can then type the file name you want and Emacs will create a new buffer. So, if you type C-x C-f C-f file_name RET it will create a buffer called file_name temporarily in the current directory.

11
votes

I found an easy solution:

(setq ido-auto-merge-delay-time 9)

The time here is in seconds. I could set a very large number to completely disable this feature.