41

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?

woodings
  • 7,503
  • 5
  • 34
  • 52

3 Answers3

42

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.

Bozhidar Batsov
  • 55,802
  • 13
  • 100
  • 117
16

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.

itsjeyd
  • 5,070
  • 2
  • 30
  • 49
Diogo
  • 842
  • 2
  • 11
  • 15
12

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.

itsjeyd
  • 5,070
  • 2
  • 30
  • 49
woodings
  • 7,503
  • 5
  • 34
  • 52
  • 2
    or set `ido-auto-merge-work-directories-length` to `-1` to disable – assem Aug 01 '13 at 11:00
  • @woodings, this problem really annoyed me for a while when I use ido, finally, I decided to search the solution. Before I got this page, I found that when you using ido, you can just use C-f to go back to normal mode instead of ido, but your solution seems better. Thank you! – CodyChan Jan 15 '14 at 20:05