114

I reciently switched to emacs starter kit which includes the ido package.

ido has a nice feature that suggests paths when find-file which is usually very handy except when trying to create a new file. When the new file name matches a suggestion in another path ido automatically switches to that path assuming that's what I wanted, but usually its not and I find it annoying.

To workaround the issue I either touch newfile from shell, create a new buffer and save as, or M-x find-file to get the original behavior. I could of course rebind C-x C-f to find-file again but must of the time I like ido-find-file, I just want it to stop automatically switching paths when I type the path explicitly.

I figure there is probably some simple key I can press during ido-find-file to tell it that the file I'm looking for does not exist and to stop making suggestions, or some var I can set to get more desirable behavior?

Kurt Harriger
  • 2,507
  • 4
  • 20
  • 21
  • 2
    Duplicate: http://stackoverflow.com/questions/812524/ido-mode-is-too-smart-can-i-get-it-to-not-complete-a-filename – scottfrazer Feb 28 '11 at 14:48
  • See also http://stackoverflow.com/questions/7479565/emacs-ido-mode-and-creating-new-files-in-directories-it-keeps-changing-the-dire?rq=1 – Brian Burns Jun 29 '14 at 14:56

5 Answers5

152

Try:

C-x C-f C-f

It should kick you out of ido mode into "normal" find file mode

Steve Lianoglou
  • 7,183
  • 2
  • 25
  • 21
  • 7
    For other commands/in general (e.g. C-x C-w), C-x C-f will go to the "normal" version of the command. – Janus May 19 '11 at 05:58
  • 1
    This is the way to go (C-x C-f C-f) with C-j you have to be very quick and it often happens that another suggestion will have time to creep in and make a suggestion you do not want;) – FredrikHedman Nov 24 '15 at 15:18
55

C-j is the key combination you are seeking.

I GIVE CRAP ANSWERS
  • 18,739
  • 3
  • 42
  • 47
  • 5
    C-j appears to immediately create new file with currently typed path. This skips the [Confirm] which is useful, but if ido detects a file with same name detected in another recently used path ido switches automatically so C-j opens the suggested path. – Kurt Harriger Feb 28 '11 at 16:54
  • Cool, this is actually what I wanted. – Marco Jul 01 '11 at 20:52
30

As mentioned: being fast, using C-j to confirm immediately, and using and additional C-f to temporarily switch to the traditional mode are all useful.

Also, when ido has already selected an alternate file path, you can hit C-z to return where you were and temporarily disable that behavior.

Matthew
  • 301
  • 2
  • 2
2

A solution for a related problem - ido not asking overwrite confirmation.

http://lists.gnu.org/archive/html/bug-gnu-emacs/2010-11/msg00226.html

sabof
  • 8,062
  • 4
  • 28
  • 52
0

On Fido, M-j does the trick. It's bound to icomplete-fido-exit by default.

Luke
  • 4,908
  • 1
  • 37
  • 59