all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Sharon Kimble <boudiccas@skimble.plus.com>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: Out-of-control backups!
Date: Mon, 11 Aug 2014 14:47:31 +0200	[thread overview]
Message-ID: <87ha1j9org.fsf@thinkpad-t440p.tsdh.org> (raw)
In-Reply-To: <87wqafnreh.fsf@skimble.plus.com> (Sharon Kimble's message of "Mon, 11 Aug 2014 13:26:46 +0100")

[-- Attachment #1: Type: text/plain, Size: 3040 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 212 bytes --]

  reply	other threads:[~2014-08-11 12:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-11 12:26 Out-of-control backups! Sharon Kimble
2014-08-11 12:47 ` Tassilo Horn [this message]
     [not found] ` <mailman.6967.1407761447.1147.help-gnu-emacs@gnu.org>
2014-08-19  3:17   ` Hans BKK
2014-08-19  3:33     ` Rusi
2014-08-19 16:53       ` Emanuel Berg
2014-08-20  6:20         ` Tassilo Horn
2014-08-20 13:52           ` Stefan Monnier
2014-08-20 15:11             ` Tassilo Horn
2014-08-20 16:41               ` Stefan Monnier
     [not found]         ` <mailman.7267.1408515668.1147.help-gnu-emacs@gnu.org>
2014-08-20 17:34           ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ha1j9org.fsf@thinkpad-t440p.tsdh.org \
    --to=tsdh@gnu.org \
    --cc=boudiccas@skimble.plus.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.