summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorMark Diekhans <markd@soe.ucsc.edu>2011-01-14 21:32:19 -0500
committerChong Yidong <cyd@stupidchicken.com>2011-01-14 21:32:19 -0500
commitfa2868101a36cd6318306933a1572c19d60d39cc (patch)
treed05e5d31ccdcdb8e9d40b424498dfc2385a71a82 /lisp
parent466c400642013b504d5f70e8cae7d7572e2469f7 (diff)
downloademacs-fa2868101a36cd6318306933a1572c19d60d39cc.tar.gz
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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/files.el7
-rw-r--r--lisp/subr.el11
3 files changed, 19 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 15acc094fee..4ec65115cff 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2011-01-15 Mark Diekhans <markd@soe.ucsc.edu>
+
+ * files.el (backup-buffer): Make last-resort backup file in
+ .emacs.d (Bug#6953).
+
+ * subr.el (locate-user-emacs-file): If .emacs.d does not exist,
+ make it with permission 700.
+
2011-01-14 Kenichi Handa <handa@m17n.org>
* 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."
(rename-file real-file-name backupname t)
(setq setmodes (cons modes backupname)))
(file-error
- ;; If trouble writing the backup, write it in ~.
- (setq backupname (expand-file-name
- (convert-standard-filename
- "~/%backup%~")))
+ ;; If trouble writing the backup, write it in
+ ;; .emacs.d/%backup%.
+ (setq backupname (locate-user-emacs-file "%backup%~"))
(message "Cannot write backup file; backing up in %s"
backupname)
(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."
;; unless we're in batch mode or dumping Emacs
(or noninteractive
purify-flag
- (file-accessible-directory-p (directory-file-name user-emacs-directory))
- (make-directory user-emacs-directory))
+ (file-accessible-directory-p
+ (directory-file-name user-emacs-directory))
+ (let ((umask (default-file-modes)))
+ (unwind-protect
+ (progn
+ (set-default-file-modes ?\700)
+ (make-directory user-emacs-directory))
+ (set-default-file-modes umask))))
(abbreviate-file-name
(expand-file-name new-name user-emacs-directory))))))
-
;;;; Misc. useful functions.