[Top][All Lists]

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

bug#29440: Tramp put drive_c in the backup file name when backuping in l

From: Michael Albinus
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux)

Shuguang Sun <address@hidden> writes:

> 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/address@hidden",
> 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:address@hidden:/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:address@hidden:/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 "address@hidden".
And (expand-file-name ...) returns then 

Unexpected, indeed. I believe, this must be fixed, because "c:" is
converted to "/drive_c" later on. The final backup name is


Best regards, Michael.

reply via email to

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