Emacs: disable automatic file search in ido mode
Asked Answered
R

3

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?

Riband answered 1/8, 2013 at 5:56 Comment(6)
alias 'open new file' as some key other then C-x C-f (M-x find-file is the right name of the action)Skewback
@Skewback @Riband From ido-find-file you can just hit C-x C-f again to drop down into the traditional find-file interfaceOglesby
@Oglesby I don't want to fall back to normal find-file. I need ido but not search in other directories.Riband
@Oglesby It's just C-f.Lease
@Lease oh, yes indeed it is, thanksOglesby
I think this is the most annoying feature of all time.Christcross
R
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.

Riband answered 1/8, 2013 at 6:10 Comment(2)
or set ido-auto-merge-work-directories-length to -1 to disableOglesby
@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!Stacte
S
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.

Soto answered 6/8, 2013 at 19:42 Comment(1)
M-x customize-variable ido-auto-merge-work-directories-lengthCognize
S
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.

Spiccato answered 6/1, 2015 at 20:4 Comment(0)
R
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.

Riband answered 1/8, 2013 at 6:10 Comment(2)
or set ido-auto-merge-work-directories-length to -1 to disableOglesby
@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!Stacte

© 2022 - 2024 — McMap. All rights reserved.