In my environment, the find-file is remapped to ido-find-file. How could I cancel the remap and just get the non-Ido version?

  • This does not answer this question but the end result might be what you are interested in: C-x C-f launches ido-find-file if ido-mode is enabled. But hitting C-f after that will call find-file; so you simply do C-x C-f C-f for find-file and C-x C-f for ido-find-file. Commented Apr 23, 2015 at 13:20
  • Probably related solution: emacs.stackexchange.com/a/5399/115 Commented Apr 23, 2015 at 13:22

2 Answers 2

(define-key KEYMAP [remap find-file] nil)

where KEYMAP is the keymap where the remapping was done. For example, it might be the variable global-map.

The keymap is apparently not accessible directly by a variable, but it is the cdr of the cons that is pointed to by variable ido-minor-mode-map-entry. So this should pretty much do it:

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

(That assumes that ido-mode has been called at least once. If not, call it. ;-))

In sum, you bind the remapping of find-file to nil, which means that you give it no binding (you unbind it). Binding to nil is how you unbind a key generally. In this case, the "key" to be unbound is [remap find-file], which is a pseudo-key, a remapping.

  • Is it missing the map name? Commented Apr 23, 2015 at 0:22
  • I think the define-key function need a key map which I can't figure out what the proper one for this case.
    – Enze Chi
    Commented Apr 23, 2015 at 0:42
  • Almost certainly global-map (in which case you could alternatively just use global-set-key in place of define-key).
    – phils
    Commented Apr 23, 2015 at 0:46
  • Oops; sorry, yes, I forgot the KEYMAP argument.
    – Drew
    Commented Apr 23, 2015 at 2:01
  • It's not global-map, ido does it in a bit unconventional (to me) way. It does not have a globally accessible map defvar. It has a let bound map and it adds (cons 'ido-mode map)` directly to minor-mode-map-alist. So we'd need to get cdr of the element from that alist whose car is ido-mode, modify that and put that modified map back in alist. Is there a simpler way? Commented Apr 23, 2015 at 2:15

Normally, you do that with (ido-mode -1).

  • 2
    The OP probably doesn't want to disable ido-mode but also doesn't want it to remap find-file; probably wants to bind ido-find-file to something else? Commented Apr 23, 2015 at 13:18
  • Could be, but it's far from clear from his question, IMO.
    – Stefan
    Commented Apr 23, 2015 at 13:25

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.