3

I was not the only one who thought ido is very inconvenient when trying to write a new file. The emacs wiki has a section dedicated to disabling ido for write-file:

Disable ido mode for particular commands, e.g. write-file

Their suggestion is to turn off ido for write file using:

 (define-key (cdr ido-minor-mode-map-entry) [remap write-file] nil)

This does not seem to work for me. ido still runs when I hit C-x C-w. Any suggestions?

6
  • 1
    I know I can exit ido with C-f. That is not a satisfactory solution.
    – Snelephant
    Commented Sep 6, 2016 at 1:19
  • FYI: The ido.el library is disabled by default when starting with emacs -q -- i.e., no user configuration. If you start with no user configuration and then type M-x eval-expression RET (featurep 'ido) RET you will see that the return value is nil because it is not loaded by default.
    – lawlist
    Commented Sep 6, 2016 at 2:12
  • I too am annoyed by this. My solution is just type file name and hit C-j.
    – Xah Lee
    Commented Sep 6, 2016 at 10:35
  • Lawlist, (featurep 'ido) returns t. So I assume the user configuration is loaded.
    – Snelephant
    Commented Sep 7, 2016 at 8:20
  • Xah Lee (honored), My motivation is that I need to save frequent iterations of a file (long_filename_01, long_filename_02, etc. and git style versioning is not an option) so I use C-x C-w C-f M-n to edit just the last character in the filename. That is lot of chording for such a common and important action.
    – Snelephant
    Commented Sep 7, 2016 at 8:26

2 Answers 2

1

the following should work.

(require 'ido)
(ido-mode)
(define-key (cdr ido-minor-mode-map-entry) [remap write-file] nil)

the problem was caused by ido not initialized. Need the (ido-mode) line there.

5
  • The second line produces Wrong type argument: keymapp, nil
    – Snelephant
    Commented Oct 25, 2016 at 2:21
  • that means for some reason you don't have ido-minor-mode-map-entry defined. (the cdr part of that variable should be a keymap, but you got nil) What emacs version are you using? also, did you run that require ido line?
    – Xah Lee
    Commented Oct 28, 2016 at 21:51
  • The code is in my init.el exactly as shown in your answer, including the require ido line. No other references to ido in my initialization. Version: Emacs 25.1.1 (x86_64-w64-mingw32)
    – Snelephant
    Commented Dec 6, 2016 at 15:09
  • i modified the answer. need the (ido-mode) line. try that. I tried, worked now. also on emacs 25.1.
    – Xah Lee
    Commented Dec 7, 2016 at 18:22
  • If you use (setq ido-everywhere t) you'll need also (add-to-list 'ido-read-file-name-non-ido 'write-file). Commented Feb 9, 2020 at 9:10
1

Use C-x C-f C-f to bypass ido-mode when it gets in the way.

To "save as", same: C-x C-w C-w but this time you stay in ido-mode, only you can edit the prompt.

1
  • I think it's C-f to bypass ido-mode even when in "Write file"
    – Oin
    Commented Apr 13, 2019 at 21:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.