[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Changing name format for backup files
From: |
Nick Helm |
Subject: |
Re: Changing name format for backup files |
Date: |
Wed, 13 Jan 2016 11:32:42 +1300 |
User-agent: |
mu4e 0.9.15; emacs 24.5.1 |
> However, often there are variables that control how some feature works.
> For your case, those seems to apply:
>
> C-h v make-backup-file-name-function
Thanks,
The trouble is, I also use numbered backups and in this case, when I set
make-backup-file-name-function to a custom function (as described in help), it
has no effect. For example, if I eval this:
(defun nick-backup-file-naming-function (file)
"Return a backup file name with prefix dot and suffix tilde."
(concat (file-name-directory file) "." (file-name-nondirectory file) "~"))
(setq make-backup-file-name-function 'nick-backup-file-naming-function)
(setq version-control 'never) ;; or nil
(make-backup-file-name "/Users/nick/Desktop/sample.txt")
it returns "/Users/nick/Desktop/.sample.txt~" as expected. However, with
(setq version-control t)
it returns "/Users/nick/Desktop/sample.txt.~1~" , that is, backup names are
correctly versioned, but the name is missing the prefix dot. It appears as if
`make-backup-file-name' is not being called in this case.
Looking at `files.el' it seems like `find-backup-file-name' calls
`make-backup-file-name-1' directly, bypassing the custom fuction.
Changing that line to call `make-backup-file-name' still doesn't give the
desired behaviour though, returning backup names with the format
"/Users/nick/Desktop/.sample.txt~.~1~" instead.
Any ideas what I'm doing wrong?