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?

Andrew Swann
  • 3,436
  • 2
  • 15
  • 43
Snelephant
  • 814
  • 1
  • 7
  • 17
  • 1
    I know I can exit ido with C-f. That is not a satisfactory solution. – Snelephant Sep 06 '16 at 01: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 Sep 06 '16 at 02:12
  • I too am annoyed by this. My solution is just type file name and hit C-j. – Xah Lee Sep 06 '16 at 10:35
  • Lawlist, `(featurep 'ido)` returns t. So I assume the user configuration is loaded. – Snelephant Sep 07 '16 at 08: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 Sep 07 '16 at 08:26
  • @Snelephant I posted an answer. Try that, it should work. – Xah Lee Sep 24 '16 at 03:25

2 Answers2

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.

Xah Lee
  • 1,756
  • 12
  • 11
  • The second line produces `Wrong type argument: keymapp, nil` – Snelephant Oct 25 '16 at 02: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 Oct 28 '16 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 Dec 06 '16 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 Dec 07 '16 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)`. – Arch Stanton Feb 09 '20 at 09: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.

yPhil
  • 963
  • 5
  • 22