dropping to regular find-files

25 views
Skip to first unread message

Eric Abrahamsen

unread,
Sep 3, 2015, 5:14:01 AM9/3/15
to emacs...@googlegroups.com
The help for `helm-find-files' says that I can hit "C-x C-f" a second
time to drop into the vanilla find-files interface. That key seems to be
currently bound to `helm-ff-run-locate', however.

I don't mind that, but it would be nice if the regular `find-files' were
still accessible. When accessing files on a remote server through tramp,
it's *really* nice not to have to fight with remote completion -- my
connection is just too slow.

Thanks!
Eric

Thierry Volpiatto

unread,
Sep 3, 2015, 5:35:48 AM9/3/15
to emacs...@googlegroups.com

Eric Abrahamsen <er...@ericabrahamsen.net> writes:

> The help for `helm-find-files' says that I can hit "C-x C-f" a second
> time to drop into the vanilla find-files interface.

Where did you see this info, I can't find it, it is not true anyway, C-x
C-f switch to locate.

> That key seems to be currently bound to `helm-ff-run-locate', however.

Yes.

> I don't mind that, but it would be nice if the regular `find-files' were
> still accessible.

What you can do is disable helm completion for `find-file':
(add-to-list 'helm-completing-read-handlers-alist '(find-file . nil))

> When accessing files on a remote server through tramp, it's *really*
> nice not to have to fight with remote completion -- my connection is
> just too slow.

Can you develop on this, what's wrong with helm+tramp ?

--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997

Eric Abrahamsen

unread,
Sep 3, 2015, 6:17:42 AM9/3/15
to emacs...@googlegroups.com
Thierry Volpiatto
<thierry....@gmail.com> writes:

> Eric Abrahamsen <er...@ericabrahamsen.net> writes:
>
>> The help for `helm-find-files' says that I can hit "C-x C-f" a second
>> time to drop into the vanilla find-files interface.
>
> Where did you see this info, I can't find it, it is not true anyway, C-x
> C-f switch to locate.

If you hit "C-h m" while in the helm-find-files interface, the
documentation buffer still says "C-x C-f" will drop you into the basic
`find-files' interface.

>> That key seems to be currently bound to `helm-ff-run-locate', however.
>
> Yes.
>
>> I don't mind that, but it would be nice if the regular `find-files' were
>> still accessible.
>
> What you can do is disable helm completion for `find-file':
> (add-to-list 'helm-completing-read-handlers-alist '(find-file . nil))

I don't want to disable helm for find-file, I like using it! I only want
to occasionally disable it in special circumstances.

>> When accessing files on a remote server through tramp, it's *really*
>> nice not to have to fight with remote completion -- my connection is
>> just too slow.
>
> Can you develop on this, what's wrong with helm+tramp ?

I'm in China and my ssh connection to overseas servers is ghastly slow.
If I just type out the path to the file I want to edit and hit RET,
helm-find-files simply ends -- no file is opened, no error is raised. If
I want to really get the file open, I have to wait at each filepath
segment for the completion information to come back. That really takes a
long time, and its fragile: I feel like if I type anything unexpected,
the whole process quits and I have to start over.

In most cases I know what config file I'm after, and the path is short
-- I'd much rather just type out the path and get the file.

E

Thierry Volpiatto

unread,
Sep 3, 2015, 6:26:01 AM9/3/15
to emacs...@googlegroups.com

Eric Abrahamsen <er...@ericabrahamsen.net> writes:

> If you hit "C-h m" while in the helm-find-files interface, the
> documentation buffer still says "C-x C-f" will drop you into the basic
> `find-files' interface.

Sorry but I still do not see this, and I don't remember having wrote
this in documentation (helm never did this).

>
> I'm in China and my ssh connection to overseas servers is ghastly slow.
> If I just type out the path to the file I want to edit and hit RET,
> helm-find-files simply ends -- no file is opened, no error is raised. If
> I want to really get the file open, I have to wait at each filepath
> segment for the completion information to come back. That really takes a
> long time, and its fragile: I feel like if I type anything unexpected,
> the whole process quits and I have to start over.
>
> In most cases I know what config file I'm after, and the path is short
> -- I'd much rather just type out the path and get the file.

Ok, I see, you can still use vanilla `find-file' without helm completion
like described in previous post.
So for such case just use M-x find-file.

Eric Abrahamsen

unread,
Sep 3, 2015, 11:07:18 PM9/3/15
to emacs...@googlegroups.com
Thierry Volpiatto
<thierry....@gmail.com> writes:

> Eric Abrahamsen <er...@ericabrahamsen.net> writes:
>
>> If you hit "C-h m" while in the helm-find-files interface, the
>> documentation buffer still says "C-x C-f" will drop you into the basic
>> `find-files' interface.
>
> Sorry but I still do not see this, and I don't remember having wrote
> this in documentation (helm never did this).

It's in the helm.el in helm-core: the `helm-help-message' variable,
under "Miscellaneous Commands". Maybe that's not meant to show up in the
help for `helm-find-files', but it does: the line:

\\[helm-quit-and-find-file] : Drop into `find-file'.

Ends up being displayed as keyed to C-x C-f.


>> I'm in China and my ssh connection to overseas servers is ghastly slow.
>> If I just type out the path to the file I want to edit and hit RET,
>> helm-find-files simply ends -- no file is opened, no error is raised. If
>> I want to really get the file open, I have to wait at each filepath
>> segment for the completion information to come back. That really takes a
>> long time, and its fragile: I feel like if I type anything unexpected,
>> the whole process quits and I have to start over.
>>
>> In most cases I know what config file I'm after, and the path is short
>> -- I'd much rather just type out the path and get the file.
>
> Ok, I see, you can still use vanilla `find-file' without helm completion
> like described in previous post.
> So for such case just use M-x find-file.

Okay.

Thanks,
Eric

Michael Heerdegen

unread,
Sep 4, 2015, 12:08:51 AM9/4/15
to emacs...@googlegroups.com
Eric Abrahamsen <er...@ericabrahamsen.net>
writes:

> It's in the helm.el in helm-core: the `helm-help-message' variable,
> under "Miscellaneous Commands". Maybe that's not meant to show up in the
> help for `helm-find-files', but it does: the line:
>
> \\[helm-quit-and-find-file] : Drop into `find-file'.

That's a typo, it means `helm-find-files' in fact.


> Ends up being displayed as keyed to C-x C-f.

For `helm-find-files', that binding is even shadowed AFAICT.


Anyway, if you are sure you really want to do that, here is a start.
Redefine `helm-quit-and-find-file' to use what you want instead of Helm
in the `helm-run-after-exit' call. Something like

--8<---------------cut here---------------start------------->8---
(defun helm-quit-and-find-file ()
"Drop into `find-files' from `helm'."
(interactive)
(require 'helm-grep)
(helm-run-after-exit
(lambda (f)
(let ((default-directory
(if (file-directory-p f)
f
(file-name-directory f))))
(unwind-protect
(progn
(helm-mode -1)
(call-interactively #'find-file))
(helm-mode +1))))
<rest>))

(define-key helm-map [(control ?x) ?f] #'helm-quit-and-find-file)
--8<---------------cut here---------------end--------------->8---

A command that would call vanilla `find-file' right from the top level
would be easier to define though.


HTH,

Michael.

Eric Abrahamsen

unread,
Sep 4, 2015, 12:40:17 AM9/4/15
to emacs...@googlegroups.com
Michael Heerdegen <michael_...@web.de>
writes:

> Eric Abrahamsen <er...@ericabrahamsen.net>
> writes:
>
>> It's in the helm.el in helm-core: the `helm-help-message' variable,
>> under "Miscellaneous Commands". Maybe that's not meant to show up in the
>> help for `helm-find-files', but it does: the line:
>>
>> \\[helm-quit-and-find-file] : Drop into `find-file'.
>
> That's a typo, it means `helm-find-files' in fact.
>
>
>> Ends up being displayed as keyed to C-x C-f.
>
> For `helm-find-files', that binding is even shadowed AFAICT.

Right. Actually I think the present behavior is fine, but the docs
aren't quite up to speed.

> Anyway, if you are sure you really want to do that, here is a start.
> Redefine `helm-quit-and-find-file' to use what you want instead of Helm
> in the `helm-run-after-exit' call. Something like
>
> (defun helm-quit-and-find-file ()
> "Drop into `find-files' from `helm'."
> (interactive)
> (require 'helm-grep)
> (helm-run-after-exit
> (lambda (f)
> (let ((default-directory
> (if (file-directory-p f)
> f
> (file-name-directory f))))
> (unwind-protect
> (progn
> (helm-mode -1)
> (call-interactively #'find-file))
> (helm-mode +1))))
> <rest>))
>
> (define-key helm-map [(control ?x) ?f] #'helm-quit-and-find-file)
>
> A command that would call vanilla `find-file' right from the top level
> would be easier to define though.

Actually, as Thierry suggests, it's simple enough just to "M-x
find-file" on those occasions when I need it.

Thanks,
Eric

Thierry Volpiatto

unread,
Sep 4, 2015, 1:00:41 AM9/4/15
to emacs...@googlegroups.com

Eric Abrahamsen <er...@ericabrahamsen.net> writes:

> It's in the helm.el in helm-core: the `helm-help-message' variable,
> under "Miscellaneous Commands". Maybe that's not meant to show up in the
> help for `helm-find-files', but it does: the line:
>
> \\[helm-quit-and-find-file] : Drop into `find-file'.
>
> Ends up being displayed as keyed to C-x C-f.

Ah! Indeed this message is a vestige of anything before I wrote
helm-find-files !

Thanks to show me this.

--
Thierry

https://emacs-helm.github.io/helm/

Eric Abrahamsen

unread,
Sep 4, 2015, 1:12:48 AM9/4/15
to emacs...@googlegroups.com
Thierry Volpiatto
My pleasure :)

Thierry Volpiatto

unread,
Sep 4, 2015, 1:16:14 AM9/4/15
to emacs...@googlegroups.com

Eric Abrahamsen <er...@ericabrahamsen.net> writes:

> Actually, as Thierry suggests, it's simple enough just to "M-x
> find-file" on those occasions when I need it.

Another solution from helm-find-files:

Enter at prompt:(ssh for example but use scp or whatever)

/ssh:

At this point you have completion on your hosts,
move cursor on your host and hit C-j.
Now before tramp kick in only the last ":" is missing,
intead of entering it or hitting again C-j, hit first C-!
and then enter:
:/path/to/your/file
when done hit again C-j

You will avoid with this all the successives costly tramp completions to
reach your file.

NOTE: C-! is usable anywhere in helm.

--
Thierry

https://emacs-helm.github.io/helm/

Eric Abrahamsen

unread,
Sep 4, 2015, 1:26:13 AM9/4/15
to emacs...@googlegroups.com
Thierry Volpiatto
Ah, this seems like the "right" solution, thank you. I have noticed
that, once I've got a file open on the server, say in the "/etc"
directory, it's usually worth it to use Helm to open other files in the
same directory, or nearby -- the wait isn't that bad.

Mostly it was just with long filepaths -- if I got ahead of Helm/tramp
and typed a complete segment, followed by the next "/", then the whole
process would fall apart and I wouldn't get my file.

Anyway, using "C-!" to selectively disable completion definitely seems
like the right thing to do.

Thanks again,
Eric

Reply all
Reply to author
Forward
0 new messages