[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Saving a remote buffer into a local file
From: |
Dani Moncayo |
Subject: |
Re: Saving a remote buffer into a local file |
Date: |
Wed, 25 Jan 2017 09:42:42 +0100 |
Hi Stefan and Eli,
On Tue, Jan 24, 2017 at 5:10 PM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>> 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
That works here[1] too. That's an easier way of creating the local
file. Thank you!
On Tue, Jan 24, 2017 at 5:00 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> [...]
>> Answering myself: Yes, it seems so: Just quote the local path with "/:":
>>
>> C-x C-w /:~/file2
Actually, what I did was
C-x C-w C-a C-k /:~/file2
> Yes. However, don't expect this to resolve to a file in your local
> home directory. That's what currently happens on MS-Windows (not on
> Unix),
For the record: this ("/:~" resolving to my local home directory)
does happen here[1].
> but it will go away in Emacs 26, where "~/" will no longer
> expand to HOME in quoted file names. Instead, you will get
> DEFDIR/~/file2, where DEFDIR is the default-directory of the buffer
> from which you invoke the command. That's because "/:" is supposed to
> quote the tilde as well, allowing to use it as a literal character in
> a file name.
Ok, so IIUC, from Emacs 26 onwards, if I want to save the remote
buffer into a local file, I will have to specify an explicit, absolute
quoted path like "/:/home/dani/foo" (or follow Stefan's suggestion,
which is easier actually).
Thanks.
--
Dani Moncayo
Footnotes:
[1] My environment: Cygwin + Emacs 25.1 (distributed with cygwin).