6

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. – Kaushal Modi Apr 23 '15 at 13:20
  • Probably related solution: emacs.stackexchange.com/a/5399/115 – Kaushal Modi Apr 23 '15 at 13:22
5
(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.

| improve this answer | |
  • Is it missing the map name? – Kaushal Modi Apr 23 '15 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 Apr 23 '15 at 0:42
  • Almost certainly global-map (in which case you could alternatively just use global-set-key in place of define-key). – phils Apr 23 '15 at 0:46
  • Oops; sorry, yes, I forgot the KEYMAP argument. – Drew Apr 23 '15 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? – Kaushal Modi Apr 23 '15 at 2:15
-1

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

| improve this answer | |
  • 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? – Kaushal Modi Apr 23 '15 at 13:18
  • Could be, but it's far from clear from his question, IMO. – Stefan Apr 23 '15 at 13:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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