help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Out-of-control backups!


From: Tassilo Horn
Subject: Re: Out-of-control backups!
Date: Mon, 11 Aug 2014 14:47:31 +0200
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4.50 (gnu/linux)

Sharon Kimble <boudiccas@skimble.plus.com> writes:

Hi Sharon,

> I need help with regard to my backups please. This is my relevant
> section of my 'init.el'
>
> --8<---------------cut here---------------start------------->8---
> ;; Save backup files in a dedicated directory
> (setq backup-directory-alist '(("." . "~/.emacs.d/backup")))
> --8<---------------cut here---------------end--------------->8---
>
> Currently I have 38 backups of my 'custom.el', and 60 backups of my
> 'init.el', and a total of 9,941 files, which just shows the extent of
> the problem!

There's no too safe! ;-)

> How can I get it to just save 7 backups for each file and then delete
> the rest please?

Have a look at the following variables:

,----[ C-h v version-control RET ]
| version-control is a variable defined in `files.el'.
| Its value is t
| Original value was nil
| 
|   This variable is safe as a file local variable if its value
|   satisfies the predicate which is a byte-compiled expression.
| 
| Documentation:
| Control use of version numbers for backup files.
| When t, make numeric backup versions unconditionally.
| When nil, make them for files that have some already.
| The value `never' means do not make them.
`----

,----[ C-h v delete-old-versions RET ]
| delete-old-versions is a variable defined in `files.el'.
| Its value is t
| Original value was nil
| 
| Documentation:
| If t, delete excess backup versions silently.
| If nil, ask confirmation.  Any other value prevents any trimming.
`----

,----[ C-h v kept-old-versions RET ]
| kept-old-versions is a variable defined in `files.el'.
| Its value is 0
| Original value was 2
| 
|   This variable is safe as a file local variable if its value
|   satisfies the predicate `integerp'.
| 
| Documentation:
| Number of oldest versions to keep when a new numbered backup is made.
`----

,----[ C-h v kept-new-versions RET ]
| kept-new-versions is a variable defined in `files.el'.
| Its value is 15
| Original value was 2
| 
|   This variable is safe as a file local variable if its value
|   satisfies the predicate `integerp'.
| 
| Documentation:
| Number of newest versions to keep when a new numbered backup is made.
| Includes the new backup.  Must be > 0
`----

If you have numbered backups, then you've set `version-control' to t
already.

As you can see from the `delete-old-versions' default value, Emacs
doesn't delete backups if not configured to do so.  And if you set it to
t, it'll keep the first two and the last two versions of each file.
With my settings, it just keeps the 15 most recent versions.

So all in all,

--8<---------------cut here---------------start------------->8---
(setq version-control t
      delete-old-versions t
      kept-new-versions 7
      kept-old-versions 0
      backup-directory-alist '(("." . "~/.emacs.d/backups/")))
--8<---------------cut here---------------end--------------->8---

is probably what you are looking for.

HTH,
Tassilo

Attachment: signature.asc
Description: PGP signature


reply via email to

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