6

IDO had this disable the special mode and fall back to vanilla find-files. It was useful to be able to use environment variables and their expansion in path names for example.

Is there something similar for helm-find-files (a key to hit during helm-mode-find-file which falls back to find-files?

Moreover, my C-x C-f is not bound to helm-find-files, yet I still get helm-mode-find-file when I hit C-x C-f (or when M-x find-file for that matter). Also puzzled by this. Any ideas?

4

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.

5

There is a built-in way to disable helm taking over a completing-read handler:

(add-to-list 'helm-completing-read-handlers-alist '(find-file))

Execute this after enabling helm-mode. Alternatively, wrap it with eval-after-load:

(eval-after-load 'helm-mode
  '(add-to-list 'helm-completing-read-handlers-alist '(find-file)))

As for the other question, there is nothing built-in to switch back to vanilla file finding. The best you can do is deactivating automatic expansion by hitting C-<Backspace>.

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.