From: Michael Albinus <michael.albinus@gmx.de>
To: Shuguang Sun <shuguang@gmail.com>
Cc: 29440@debbugs.gnu.org
Subject: bug#29440: Tramp put drive_c in the backup file name when backuping in local PC/windows
Date: Mon, 27 Nov 2017 18:24:45 +0100 [thread overview]
Message-ID: <87y3mrljmq.fsf@gmx.de> (raw)
In-Reply-To: <CACspjXfUm+uwXmfagyiuOTqWH9S4nrLAtcXRk48B47-A_MSBCA@mail.gmail.com> (Shuguang Sun's message of "Sun, 26 Nov 2017 00:08:42 +0800")
Shuguang Sun <shuguang@gmail.com> writes:
> Hi,
Hi,
> backup-directory-alist:
> ("\\.[rR]\\(md\\)?$" . "~/.emacs.d/autosave/Rfiles")
>
> When I open a file in tramp and edit it, the backup file will be and
> was backuped in the local direcory: ~/.emacs.d/autosave/Rfiles
> (c:/Users/username/HOME/.emacs.d/autosave/Rfiles). However the
> backfile is named
> "c:/Users/username/HOME/.emacs.d/autosave/Rfiles/!drive_c!plink!!username@host!!!opt!bee!home!username!test!coxph_bench.r.~2~",
> where "dirve_c" was put in.
I've hijacked a Windows 7 machine today. It runs Emacs 25.1 only, but
this should be good enough. I have prepared a similar setting, with
--8<---------------cut here---------------start------------->8---
backup-directory-alist is a variable defined in `files.el'.
Its value is (("." . "c:/Users/lb01177/AppData/Roaming/.emacs.d/backup"))
--8<---------------cut here---------------end--------------->8---
I have used file "/plink:albinus@192.168.178.30:/home/albinus/tmp/123" as
test file. The interesting function is make-backup-file-name-1, which
I debug.
When I enter line 4422, the (when (memq system-type '(windows-nt ms-dos cygwin))
part, backup-directory is
"c:/Users/lb01177/AppData/Roaming/.emacs.d/backup", and file is still
"/plink:albinus@192.168.178.30:/home/albinus/tmp/123". As expected.
The interesting part is here:
--8<---------------cut here---------------start------------->8---
;; Replace any invalid file-name characters (for the
;; case of backing up remote files).
(setq file
(expand-file-name (convert-standard-filename file)))
--8<---------------cut here---------------end--------------->8---
(convert-standard-filename file) returns "\\plink!albinus@192.168.178.30!\\home\\albinus\\tmp\\123".
And (expand-file-name ...) returns then "c:/plink!albinus@192.168.178.30!/home/albinus/tmp/123".
Unexpected, indeed. I believe, this must be fixed, because "c:" is
converted to "/drive_c" later on. The final backup name is
"c:/Users/lb01177/AppData/Roaming/.emacs.d/backup/!drive_c!plink!!albinus@192.168.178.30!!!home!albinus!tmp!123.~3~"
Eli?
Best regards, Michael.
next prev parent reply other threads:[~2017-11-27 17:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-25 16:08 bug#29440: Tramp put drive_c in the backup file name when backuping in local PC/windows Shuguang Sun
2017-11-25 19:18 ` Eli Zaretskii
2017-11-26 6:00 ` Shuguang Sun
2017-11-27 17:24 ` Michael Albinus [this message]
2017-11-27 18:07 ` Eli Zaretskii
2017-11-27 20:21 ` Michael Albinus
2017-11-30 19:23 ` Michael Albinus
2017-12-01 18:20 ` Eli Zaretskii
2017-12-01 10:42 ` Eli Zaretskii
2017-12-02 11:34 ` Michael Albinus
2018-02-05 13:31 ` Michael Albinus
2018-02-06 9:12 ` Shuguang Sun
2018-02-07 7:37 ` Michael Albinus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y3mrljmq.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=29440@debbugs.gnu.org \
--cc=shuguang@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.