Disabling helm mode for find-file
Adding an action
There doesn't appear to be a built-in way to switch from helm-filnd-files back to the default Emacs' find-files
. However, you can add an action
to do this:
(defun old-ff (&optional no-op) (interactive)
(call-interactively 'find-file))
(helm-add-action-to-source "Fallback find-file"
'old-ff
helm-source-find-files)
Binding a key to the action
With this code, you will get a new option in the "Action Menu" called "Fallback find-file". However, getting there is a bit awkward - you need to invoke the "Action Menu" first (TAB by default), then scroll to the entry. To add a keybinding to access this directly from the mini-buffer, use the following:
(define-key helm-map (kbd "C-q")
(lambda () (interactive)
(helm-quit-and-execute-action 'old-ff))
I'm a little confused by this system, and the documentation is not clear. From my experiments you must use a named function in helm-add-function-to-source
if you want to later call that function from helm-quit-and-execute-action
. However, helm-add-function-to-source
requires a function that takes one argument, and helm-quit-and-execute
will only call the function without passing an argument. I've worked around this incompatibility by defining old-ff
to take an optional argument that doesn't actually get used.
Config
To get this code invoked at the appropriate time, I use use-package
as follows:
(use-package helm
:ensure helm
:config
(progn
(defun old-ff (&optional no-op) (interactive)
(call-interactively 'find-file))
(helm-add-action-to-source "Fallback find-file"
'old-ff
helm-source-find-files)
(define-key helm-map (kbd "C-q")
(lambda () (interactive)
(helm-quit-and-execute-action 'old-ff)))))
Getting rid of helm mode for C-x C-f
Regarding your second question, you probably have set (helm-mode 1)
in your init. This will over-ride the normal C-x C-f
keybinding to provide the helm interface instead.