From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Florian Lindner Newsgroups: gmane.emacs.help Subject: Re: Change backup system Date: Tue, 29 Jul 2008 11:12:10 -0700 (PDT) Organization: http://groups.google.com Message-ID: <09b77886-65c7-4a27-80eb-61cfe797806a@j22g2000hsf.googlegroups.com> References: <3d30c6e7-d266-4b5b-a397-b9180a0acd88@y21g2000hsf.googlegroups.com> <72c3a15c-8d73-4bb7-a297-2632cffd647c@r15g2000prd.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1217356951 18196 80.91.229.12 (29 Jul 2008 18:42:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Jul 2008 18:42:31 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jul 29 20:43:21 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KNuAA-0007kP-4O for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Jul 2008 20:43:11 +0200 Original-Received: from localhost ([127.0.0.1]:50698 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KNu9D-0006V3-TN for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Jul 2008 14:42:11 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!j22g2000hsf.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 45 Original-NNTP-Posting-Host: 138.246.7.185 Original-X-Trace: posting.google.com 1217355131 29327 127.0.0.1 (29 Jul 2008 18:12:11 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 29 Jul 2008 18:12:11 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j22g2000hsf.googlegroups.com; posting-host=138.246.7.185; posting-account=6QUiowkAAAD0vSyXppJonpT_391Sn3wN User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; de; rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:160683 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:56032 Archived-At: On 29 Jul., 11:29, Xah wrote: > On Jul 28, 12:00 pm, Florian Lindner 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