* backup files and version control
@ 2005-02-17 10:14 Heiko Gerdau
0 siblings, 0 replies; 6+ messages in thread
From: Heiko Gerdau @ 2005-02-17 10:14 UTC (permalink / raw)
Hi,
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 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?
Any help is appriciated
Thanks
Heiko
Here is my version of "make-backup-file-name"
;; Create backup files in a separate subdirectory
(defun make-backup-file-name (file)
(let ((dir (concat (file-name-directory file) ".backup~")))
(if (not (file-exists-p dir))
(make-directory dir))
(concat dir "/" (file-name-nondirectory file) "~")))
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: backup files and version control
[not found] <mailman.286.1108636126.32256.help-gnu-emacs@gnu.org>
@ 2005-02-17 15:27 ` timseal
2005-02-17 19:44 ` Kevin Rodgers
1 sibling, 0 replies; 6+ messages in thread
From: timseal @ 2005-02-17 15:27 UTC (permalink / raw)
Does backup-directory-alist help you?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: backup files and version control
[not found] <mailman.286.1108636126.32256.help-gnu-emacs@gnu.org>
2005-02-17 15:27 ` backup files and version control timseal
@ 2005-02-17 19:44 ` Kevin Rodgers
2005-02-18 10:39 ` Heiko Gerdau
[not found] ` <mailman.452.1108724397.32256.help-gnu-emacs@gnu.org>
1 sibling, 2 replies; 6+ messages in thread
From: Kevin Rodgers @ 2005-02-17 19:44 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: backup files and version control
2005-02-17 19:44 ` Kevin Rodgers
@ 2005-02-18 10:39 ` Heiko Gerdau
[not found] ` <mailman.452.1108724397.32256.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 6+ messages in thread
From: Heiko Gerdau @ 2005-02-18 10:39 UTC (permalink / raw)
Hi,
thanks a lot for your hints. I did as you suggested (changed the name of
make-backup-file-name) and used your "backup-file-name-p" version. I also
added my relative backup directories ( "/.backup~" ) to
backup-directory-alist. Unfortunately all this has no effect.
But while testing I realized the following:
Let's say I have the file "foo.cpp" under version control and it is uptodate.
If I change that file using Emacs than on saving a new file "foo.bar.~1.4~"
is written to the same directory, if 1.4 is the current revision in CVS. This
file has the date of the revision in CVS and is never changed again. I can
delete it and change foo.cpp again and it's not created again.
So it happens only on the first change of an uptodate file under cvs control.
Maybe the problem has nothing to with the emacs backup handling.
Any further idea?
Best
Heiko
On Thursday 17 February 2005 20:44, Kevin Rodgers wrote:
> 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))) ?~))))
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: backup files and version control
[not found] ` <mailman.452.1108724397.32256.help-gnu-emacs@gnu.org>
@ 2005-02-18 12:44 ` Thien-Thi Nguyen
2005-02-18 14:23 ` Heiko Gerdau
0 siblings, 1 reply; 6+ messages in thread
From: Thien-Thi Nguyen @ 2005-02-18 12:44 UTC (permalink / raw)
Heiko Gerdau <hg@technosis.de> writes:
> Any further idea?
look at var `vc-stay-local' (and for cvs, `vc-cvs-stay-local').
thi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: backup files and version control
2005-02-18 12:44 ` Thien-Thi Nguyen
@ 2005-02-18 14:23 ` Heiko Gerdau
0 siblings, 0 replies; 6+ messages in thread
From: Heiko Gerdau @ 2005-02-18 14:23 UTC (permalink / raw)
On Friday 18 February 2005 13:44, Thien-Thi Nguyen wrote:
> Heiko Gerdau <hg@technosis.de> writes:
> > Any further idea?
>
> look at var `vc-stay-local' (and for cvs, `vc-cvs-stay-local').
yes, that did it.
thanks a lot!
Best
Heiko
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-02-18 14:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.286.1108636126.32256.help-gnu-emacs@gnu.org>
2005-02-17 15:27 ` backup files and version control timseal
2005-02-17 19:44 ` Kevin Rodgers
2005-02-18 10:39 ` Heiko Gerdau
[not found] ` <mailman.452.1108724397.32256.help-gnu-emacs@gnu.org>
2005-02-18 12:44 ` Thien-Thi Nguyen
2005-02-18 14:23 ` Heiko Gerdau
2005-02-17 10:14 Heiko Gerdau
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.