helm-find-files and tramp

800 views
Skip to first unread message

Eric Abrahamsen

unread,
Dec 30, 2014, 1:31:58 AM12/30/14
to emacs...@googlegroups.com
I'm a bit confused by using helm-find-files and tramp to open files on
remote servers. Say I have the server "bub" configured in my
~/.ssh/config file, I should be able to visit:

/scp:bub:file.txt

To open "file.txt" in my home directory on that server. I notice that,
if I run helm-find-files, then type this whole string in directly and
then hit RET, nothing happens -- helm-find-file returns me to whatever
buffer I was looking at before, and no file is opened.

If I pause as I type, and let helm catch up with what I'm doing (I have
no idea what's actually happening behind the scenes), then the regular
completion mechanism kicks in (correctly completing filenames on the
remote server), and eventually I can get to the file I want. This can
take a very long time, though, especially for deeply-nested files over a
bad ssh connection, and if at any point I lose patience and start typing
ahead, I get nothing when I hit RET.

Is this the normal behavior? Is there any way that, if I just type out
the full tramp filename and hit RET, helm can just pass that on tramp
and not help me complete?

Thanks,
Eric

Thierry Volpiatto

unread,
Dec 30, 2014, 2:37:44 AM12/30/14
to emacs...@googlegroups.com

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

> I'm a bit confused by using helm-find-files and tramp to open files on
> remote servers. Say I have the server "bub" configured in my
> ~/.ssh/config file, I should be able to visit:
>
> /scp:bub:file.txt

Not exactly, give always a full path i.e "/scp:bub:/home/you/file.text".
Not a problem as you should not have to type in this, see below:

1) enter in prompt "/scp:"
Completion should show "bub" and maybe others
(if it doesn't, that's mean tramp is not aware yet of your shortcut,
so type in "bub").
2) with cursor on bub, hit C-j (persistent action)
you should have now in prompt "/scp:bub"
3) add ":" in prompt
as soon as you enter this last ":" helm completion on remote starts,
and you should see soon (depend on connection) all candidates.
4) At initialization of connection you will have to hit C-j once to have
the full path in minibuffer, after first connection this will be done
alone.

Note that typing enter will run find-file (more or less) on what you
have in helm-buffer, and will fail of course if there is nothing there
or if connection is not initialized for any reason.

So if connection is too long for some reason hit C-g to interupt
connection, maybe run tramp-cleanup-all-connections and retry.

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

Eric Abrahamsen

unread,
Dec 30, 2014, 9:23:51 PM12/30/14
to emacs...@googlegroups.com
Thierry Volpiatto
<thierry....@gmail.com> writes:

> Eric Abrahamsen <er...@ericabrahamsen.net> writes:
>
>> I'm a bit confused by using helm-find-files and tramp to open files on
>> remote servers. Say I have the server "bub" configured in my
>> ~/.ssh/config file, I should be able to visit:
>>
>> /scp:bub:file.txt
>
> Not exactly, give always a full path i.e "/scp:bub:/home/you/file.text".
> Not a problem as you should not have to type in this, see below:

Hi, thanks for the reply,

> 1) enter in prompt "/scp:"
> Completion should show "bub" and maybe others
> (if it doesn't, that's mean tramp is not aware yet of your shortcut,
> so type in "bub").
> 2) with cursor on bub, hit C-j (persistent action)
> you should have now in prompt "/scp:bub"
> 3) add ":" in prompt
> as soon as you enter this last ":" helm completion on remote starts,
> and you should see soon (depend on connection) all candidates.
> 4) At initialization of connection you will have to hit C-j once to have
> the full path in minibuffer, after first connection this will be done
> alone.

All this works up until step three. When I hit C-j on "/scp:bub", it
gives me a completions window with "/scp:bub:/home/eric/." as the first
line, and the correct list of files in my remote home directory below
that.

But when I continue typing filepath elements, the completions window
blanks, and then (as far as I can tell) nothing more happens. These are
paths I can already see in the completions window, but the moment I
start typing, they disappear.

A little twist: if I use C-n to move to the directory I want, then C-j
to enter it, then C-n to select the next segment, etc etc, the
completions for each directory show correctly, and I can reach the file
I'm after without too much delay. But again, if I type any characters,
the completions window blanks and then nothing happens.

Ultimately, I still suspect my terrible connection to the server, but if
there's anything that could be adjusted on the helm end, that would be
great. Since I figured out the above trick, everything's fairly usable,
but of course it would be best if it just worked normally!

If you think a proper bug report is in order, let me know and I'll make
one on github.

Thanks,
Eric

Thierry Volpiatto

unread,
Dec 30, 2014, 11:44:09 PM12/30/14
to emacs...@googlegroups.com

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

> All this works up until step three. When I hit C-j on "/scp:bub", it
> gives me a completions window with "/scp:bub:/home/eric/." as the first
> line, and the correct list of files in my remote home directory below
> that.
>
> But when I continue typing filepath elements, the completions window
> blanks, and then (as far as I can tell) nothing more happens. These are
> paths I can already see in the completions window, but the moment I
> start typing, they disappear.
>
> A little twist: if I use C-n to move to the directory I want, then C-j
> to enter it, then C-n to select the next segment, etc etc, the
> completions for each directory show correctly, and I can reach the file
> I'm after without too much delay. But again, if I type any characters,
> the completions window blanks and then nothing happens.
>
> Ultimately, I still suspect my terrible connection to the server, but if
> there's anything that could be adjusted on the helm end, that would be
> great. Since I figured out the above trick, everything's fairly usable,
> but of course it would be best if it just worked normally!

There is no much to do I am afraid on the helm side, each time you enter
a character you make a directory-files request on the server, so if you
type very fast you will make several requests and you will have to wait
ages for a response, what you can do on this slow connection is hitting
C-! before typing a filename and then type in again C-! to restart helm.
Or type very slowly.

Here my connection is not very fast, but correct (850/1500ko/s) and
tramp stay very usable.
But tramp have its limitations, so when I have a big work to do, or copy
big files from or to remote, I use sshfs which is faster and don't
overload memory (tramp eat all memory when copying, especially when
your /tmp is mounted on tmpfs)

Eric Abrahamsen

unread,
Dec 31, 2014, 1:23:59 AM12/31/14
to emacs...@googlegroups.com
Thierry Volpiatto
I'm already typing as slowly as I can. :)

I'll give the C-! trick a try, thanks for that, and for your replies.
I'll look into sshfs...

Eric
Reply all
Reply to author
Forward
0 new messages