From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Dani Moncayo Newsgroups: gmane.emacs.help Subject: Re: Saving a remote buffer into a local file Date: Wed, 25 Jan 2017 09:42:42 +0100 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1485333807 17702 195.159.176.226 (25 Jan 2017 08:43:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 25 Jan 2017 08:43:27 +0000 (UTC) To: "help-gnu-emacs@gnu.org list" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 25 09:43:21 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cWJAk-0003v1-5o for geh-help-gnu-emacs@m.gmane.org; Wed, 25 Jan 2017 09:43:18 +0100 Original-Received: from localhost ([::1]:58121 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWJAp-0007oB-FQ for geh-help-gnu-emacs@m.gmane.org; Wed, 25 Jan 2017 03:43:23 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34123) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWJAD-0007ms-Lc for help-gnu-emacs@gnu.org; Wed, 25 Jan 2017 03:42:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cWJAC-0007V8-OK for help-gnu-emacs@gnu.org; Wed, 25 Jan 2017 03:42:45 -0500 Original-Received: from mail-lf0-x235.google.com ([2a00:1450:4010:c07::235]:32891) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cWJAC-0007Uz-Hb for help-gnu-emacs@gnu.org; Wed, 25 Jan 2017 03:42:44 -0500 Original-Received: by mail-lf0-x235.google.com with SMTP id x1so38128477lff.0 for ; Wed, 25 Jan 2017 00:42:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=GY5RKyH9dR5xfTbXCdmEp0ESkXEgpwbyBbin241Sc28=; b=GaWrBYtIHRAC0Hi9YtXHnsX4Dxr5my29PyKijRNYtcyg00wQa3OpemYEooN13/9KiN 6VqRrHjqcQU4464tvnH4nTkdcR2N9F5sNHe2NGA+F6bdxG38bQlCoI7clvEbI7SR8Qe1 yBoLB9ad+yb0rhTMGcrgPh8xnPT87xzcloe8XB0553oEQcCVZt1AadhMaHYjS90nRP8r jg0WcvrqVEXvcLDY/BojlJbnYn8kezbhkLF7X5hLuNrbwu9BIE06bE0hjuO2cTJ59fR/ sD5krgI9ckT+iXVtGdQEX0FGEklYWhIe5JmfDfuHuWN4/NSKng9iaa+nUqJH4G1/o1D0 pWLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=GY5RKyH9dR5xfTbXCdmEp0ESkXEgpwbyBbin241Sc28=; b=FNKaD8m1lh0hpMDwM/LKd2fq0UScjU96GnzGlfOSYMfKE+zObtDZGtuH6lddMHjIk8 e2/dzpWf5p9FnHTNq/z3g/TvUEic8ywizZAcmz2Rtvd9g8wEwVCLOhosFfCOUwAf8Vu0 CdG7SKAEXexw/2adyjgMPxiu4mXoDIkKh8l64hCEZUWElj3VxmZjgqJEsIqLtnUTyvor gJy9q5eUB1/1IBBp5zKM1z13VO3p4dJZieFp+quVMHEtWcmKSj+LCY3jxkTJ79bXB69g Pz6VKbPPRa6GvTJp75uwPwYid58R9PyUwpP+anbMjajXd+dIoUGLBwvxXLaEqs/st1Ho rscA== X-Gm-Message-State: AIkVDXICOiP0udLh4yVThxW2PNW8OCuSEn2WqZS+9+gl0Y+kHDyts/dl0WPxmyHBvAwNNF2KB74iOrkHctTygA== X-Received: by 10.25.199.9 with SMTP id x9mr4406804lff.95.1485333762902; Wed, 25 Jan 2017 00:42:42 -0800 (PST) Original-Received: by 10.25.24.194 with HTTP; Wed, 25 Jan 2017 00:42:42 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::235 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:112157 Archived-At: Hi Stefan and Eli, On Tue, Jan 24, 2017 at 5:10 PM, Stefan Monnier 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 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).