help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving a remote buffer into a local file


From: Michael Albinus
Subject: Re: Saving a remote buffer into a local file
Date: Wed, 25 Jan 2017 10:51:01 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Suppose I visit some remote file:
>>    C-x C-f /ssh:user1@host1:/path1/file1
>> Now, I want to save the resulting buffer into a local file.  Doing:
>>   C-x C-w ~/file2
>> does not work, since in will create a file in the remote host (host1).
>
> It works for me if I add a "C-a C-k":
>
>     C-x C-w C-a C-k ~/file2
>
> Yet, if I do like you suggest, I see a bug: while typing "~/file2" the
> leading "/ssh:user1@host1:/path1/" text is greyed out, giving the
> incorrect impression that it won't be used.

No. Only "/path1/" is greyed out, telling you that *this* part won't be
used.

Remote file names have a special meaning of double slash and slash tilde
in file name completion. It removes the leading part of the remote file
name's local part. You need another slash for removing the whole file
name in the minibuffer. Therefore, doing

  C-x C-w /~/file2

would suffice. You will see also the grey part of the minibuffer being
changed to the whole line. Personally, when I want to save a remote file
locally, I have the attitude typing three slashes first. Meanwhile, I do
this even w/o thinking about :-)

See (info "(tramp) File name completion") for discussion.

>         Stefan

Best regards, Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]