aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Diekhans2011-01-14 21:32:19 -0500
committerChong Yidong2011-01-14 21:32:19 -0500
commitb024d9f02d2758815069b2a0df3af72fcf0ee220 (patch)
treec804be069540cb3f8562a4d50c07ce6e0e8d7e6d
parent66399c0a66e87c20edad6a7eb2474981d9bc7e4e (diff)
downloademacs-b024d9f02d2758815069b2a0df3af72fcf0ee220.tar.gz
emacs-b024d9f02d2758815069b2a0df3af72fcf0ee220.zip
Make last-resort backup file in .emacs.d (Bug#6953).
* lisp/files.el (backup-buffer): Make last-resort backup file in .emacs.d. * lisp/subr.el (locate-user-emacs-file): If .emacs.d does not exist, make it with permission 700. * doc/emacs/files.texi (Backup Names): Document the new location of the last-resort backup file.
-rw-r--r--doc/emacs/ChangeLog5
-rw-r--r--doc/emacs/files.texi8
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/files.el7
-rw-r--r--lisp/subr.el11
6 files changed, 32 insertions, 11 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 4825f08979f..d1e5beb7384 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,8 @@
12011-01-15 Chong Yidong <cyd@stupidchicken.com>
2
3 * files.texi (Backup Names): Document the new location of the
4 last-resort backup file.
5
12011-01-08 Chong Yidong <cyd@stupidchicken.com> 62011-01-08 Chong Yidong <cyd@stupidchicken.com>
2 7
3 * files.texi (File Aliases): Move directory-abbrev-alist doc from Lisp 8 * files.texi (File Aliases): Move directory-abbrev-alist doc from Lisp
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 530c2bb94f7..b16549450e4 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -566,10 +566,10 @@ another from the newly saved contents if you save again.
566appending @samp{~} to the file name being edited; thus, the backup 566appending @samp{~} to the file name being edited; thus, the backup
567file for @file{eval.c} would be @file{eval.c~}. 567file for @file{eval.c} would be @file{eval.c~}.
568 568
569 If access control stops Emacs from writing backup files under the usual 569 If access control stops Emacs from writing backup files under the
570names, it writes the backup file as @file{%backup%~} in your home 570usual names, it writes the backup file as @file{~/.emacs.d/%backup%~}.
571directory. Only one such file can exist, so only the most recently 571Only one such file can exist, so only the most recently made such
572made such backup is available. 572backup is available.
573 573
574 Emacs can also make @dfn{numbered backup files}. Numbered backup 574 Emacs can also make @dfn{numbered backup files}. Numbered backup
575file names contain @samp{.~}, the number, and another @samp{~} after 575file names contain @samp{.~}, the number, and another @samp{~} after
diff --git a/etc/NEWS b/etc/NEWS
index 8a673d19443..34e3adea481 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -26,6 +26,10 @@ used on x86-64 and s390x GNU/Linux architectures.
26 26
27* Changes in Emacs 23.3 27* Changes in Emacs 23.3
28 28
29+++
30** The last-resort backup file `%backup%~' is now written to
31`user-emacs-directory', instead of the user's home directory.
32
29 33
30* Editing Changes in Emacs 23.3 34* Editing Changes in Emacs 23.3
31 35
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0f6138bf698..0ff810a1230 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12011-01-15 Mark Diekhans <markd@soe.ucsc.edu>
2
3 * files.el (backup-buffer): Make last-resort backup file in
4 .emacs.d (Bug#6953).
5
6 * subr.el (locate-user-emacs-file): If .emacs.d does not exist,
7 make it with permission 700.
8
12011-01-14 Kenichi Handa <handa@m17n.org> 92011-01-14 Kenichi Handa <handa@m17n.org>
2 10
3 * mail/rmailmm.el (rmail-mime-insert-header): Set 11 * mail/rmailmm.el (rmail-mime-insert-header): Set
diff --git a/lisp/files.el b/lisp/files.el
index ab027b507f6..92029b470ff 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3683,10 +3683,9 @@ BACKUPNAME is the backup file name, which is the old file renamed."
3683 (rename-file real-file-name backupname t) 3683 (rename-file real-file-name backupname t)
3684 (setq setmodes (cons modes backupname))) 3684 (setq setmodes (cons modes backupname)))
3685 (file-error 3685 (file-error
3686 ;; If trouble writing the backup, write it in ~. 3686 ;; If trouble writing the backup, write it in
3687 (setq backupname (expand-file-name 3687 ;; .emacs.d/%backup%.
3688 (convert-standard-filename 3688 (setq backupname (locate-user-emacs-file "%backup%~"))
3689 "~/%backup%~")))
3690 (message "Cannot write backup file; backing up in %s" 3689 (message "Cannot write backup file; backing up in %s"
3691 backupname) 3690 backupname)
3692 (sleep-for 1) 3691 (sleep-for 1)
diff --git a/lisp/subr.el b/lisp/subr.el
index 7ddabbc0e90..2a0dee69338 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2340,11 +2340,16 @@ directory if it does not exist."
2340 ;; unless we're in batch mode or dumping Emacs 2340 ;; unless we're in batch mode or dumping Emacs
2341 (or noninteractive 2341 (or noninteractive
2342 purify-flag 2342 purify-flag
2343 (file-accessible-directory-p (directory-file-name user-emacs-directory)) 2343 (file-accessible-directory-p
2344 (make-directory user-emacs-directory)) 2344 (directory-file-name user-emacs-directory))
2345 (let ((umask (default-file-modes)))
2346 (unwind-protect
2347 (progn
2348 (set-default-file-modes ?\700)
2349 (make-directory user-emacs-directory))
2350 (set-default-file-modes umask))))
2345 (abbreviate-file-name 2351 (abbreviate-file-name
2346 (expand-file-name new-name user-emacs-directory)))))) 2352 (expand-file-name new-name user-emacs-directory))))))
2347
2348 2353
2349;;;; Misc. useful functions. 2354;;;; Misc. useful functions.
2350 2355