From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: Re: emacs changed file's own user and file permission Date: Mon, 10 Dec 2007 17:18:46 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <4ad823b9-4941-4883-8771-de43d50913de@e25g2000prg.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1197337244 29442 80.91.229.12 (11 Dec 2007 01:40:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 11 Dec 2007 01:40:44 +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 Dec 11 02:40:51 2007 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 1J1u79-0008KO-9W for geh-help-gnu-emacs@m.gmane.org; Tue, 11 Dec 2007 02:40:51 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J1u6r-0008O4-GJ for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Dec 2007 20:40:33 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!d27g2000prf.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 46 Original-NNTP-Posting-Host: 69.236.67.2 Original-X-Trace: posting.google.com 1197335926 26278 127.0.0.1 (11 Dec 2007 01:18:46 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 11 Dec 2007 01:18:46 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: d27g2000prf.googlegroups.com; posting-host=69.236.67.2; posting-account=qPxGtQkAAADb6PWdLGiWVucht1ZDR6fn User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/523.12 (KHTML, like Gecko) Version/3.0.4 Safari/523.12, gzip(gfe), gzip(gfe) Original-Xref: shelby.stanford.edu gnu.emacs.help:154563 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:49991 Archived-At: On Dec 10, 3:07 pm, Jason Rumney wrote: > On 10 Dec, 18:42,XahLee wrote: > > > * Create options so that emacs backup will be all directed into a user > > specified directory. > > Do you mean backup-directory-alist? Thanks. That's very nice, i didn't know about it. i just tried it and the file is backed up as for example: !Users!xah!web!emacs!xah_emacs_google_earth.el~ i think this is not a robust solution because in principle the file name length would quickly reach its limit. Another problem in principle is that it uses a fixed char, requiring the presumation that the char does not happen file names. (if the char does happen in file names, that means the backup files can no longer be simply mapped to the original names) ---------------------- just to be complete, the code is: (setq backup-directory-alist '(("" . "/Users/xah/emacs_backup"))) and the alternative solution, which create all the dirs instead of the $B!H(B!$B!I(B and i think should be build in into emacs, is: ; make backup to a designated dir, mirroring the full path (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 "/Users/xah/emacs_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) (setq backup-by-copying t) Xah xah@xahlee.org $B-t(B http://xahlee.org/