[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: backup files and version control
From: |
Kevin Rodgers |
Subject: |
Re: backup files and version control |
Date: |
Thu, 17 Feb 2005 12:44:28 -0700 |
User-agent: |
Mozilla Thunderbird 0.9 (X11/20041105) |
Heiko Gerdau wrote:
> I need some advice concerning backup files and version control.
>
> I have written my own elisp function "make-backup-file-name" to
> collect backup files in subdirectories named ".backup~". (function is
> attached at the end of this mail)
It would be better to write a new function (i.e. with a new name) and
set the make-backup-file-name-function variable to it (than to redefine
the make-backup-file-name function). I also suggest using
expand-file-name instead of concat to create directory and file names in
your function.
Using the make-backup-file-name-function variable has the added
advantage that reading its doc string tells you what else you have to
do:
| If you define it, you may need to change `backup-file-name-p'
| and `file-name-sans-versions' too.
So:
(defun backup-file-name-p (file)
"Return non-nil if FILE is a backup file name (numeric or not)."
(setq file (expand-file-name file))
(let ((directory (directory-file-name (file-name-directory file))))
(and (equal (file-name-nondirectory directory) ".backup~")
(equal (aref file (1- (length file))) ?~))))
> It works fine for all regular files except if they are under version
> control. Than the backup files are scattering with the version
> numbers attached in the same directory as the original file which is
> realy unconfortable if I want to use tools like grep etc.
>
> I also tried (setq version-control (quote never)) with no effect.
>
> So my question:
> What can I do to put also those files into my backup subdirectory
that are
> under version control?
Does the above help?
--
Kevin Rodgers