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

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

Re: Change backup system


From: Florian Lindner
Subject: Re: Change backup system
Date: Tue, 29 Jul 2008 11:12:10 -0700 (PDT)
User-agent: G2/1.0

On 29 Jul., 11:29, Xah <xah...@gmail.com> wrote:
> On Jul 28, 12:00 pm, Florian Lindner <Florian.Lind...@xgm.de> wrote:
>
> > Hello,
>
> > can I (I suppose I can, it's Emacs) and how can I change the way Emacs
> > backup files. The default is to create a filename~ in the same folder.
>
> > My idea is to copy the file to another folder. When I edit and save ~/
> > text/file.txt the backup is saved in ~/.emacs.d/backup/home/florian/
> > text/file.txt.n with n being a number incremted form 1 to x each save.
>
> > Can I configure Emacs like that?
>
> Yes. I have the code that does exactly what you want.

[...]

I have now:

(defun my-backup-file-name (fpath)
  "Return a new file path of a given file path. If the new path's
directories does not exist, create them."
  (let (backup-root bpath)
    (setq backup-root "~/.emacs.d/backup")
    (setq bpath (concat backup-root fpath "~"))
    (make-directory (file-name-directory bpath) bpath)
    bpath
    )
  )
(setq make-backup-file-name-function 'my-backup-file-name
      version-control t
      delete-old-versions t
      kept-new-versions 6
      kept-old-versions 2)

The my-backup-file-name works as you have described but it seems not
to cooperate with the numbered backups (version-control t). There is
always the first backup saved and never modified.
BTW: What is difference between kept-new-versions and kept-old-
versions?

Thanks,

Florian


reply via email to

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