ChatGPT解决这个技术问题 Extra ChatGPT

emacs create new file with ido enabled

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?


S
Steve Lianoglou

Try:

C-x C-f C-f

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


For other commands/in general (e.g. C-x C-w), C-x C-f will go to the "normal" version of the command.
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;)
I
I GIVE CRAP ANSWERS

C-j is the key combination you are seeking.


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.
Cool, this is actually what I wanted.
M
Matthew

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.


s
sabof

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

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