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?
2 Answers
(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.
-
-
I think the
define-key
function need a key map which I can't figure out what the proper one for this case.– Enze ChiCommented Apr 23, 2015 at 0:42 -
Almost certainly
global-map
(in which case you could alternatively just useglobal-set-key
in place ofdefine-key
).– philsCommented Apr 23, 2015 at 0:46 -
-
It's not
global-map
, ido does it in a bit unconventional (to me) way. It does not have a globally accessiblemap
defvar. It has alet
boundmap
and it adds (cons 'ido-mode map)` directly tominor-mode-map-alist
. So we'd need to get cdr of the element from that alist whose car isido-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)
.
-
2The OP probably doesn't want to disable
ido-mode
but also doesn't want it to remapfind-file
; probably wants to bindido-find-file
to something else? Commented Apr 23, 2015 at 13:18 -
C-x C-f
launchesido-find-file
ifido-mode
is enabled. But hittingC-f
after that will callfind-file
; so you simply doC-x C-f C-f
forfind-file
andC-x C-f
forido-find-file
.