Commit 0114073a authored by Glenn Morris's avatar Glenn Morris

* subr.el (user-emacs-directory-warning): New option.

(locate-user-emacs-file): Handle non-accessible .emacs.d. 

Not in NEWS, because you only need to know about this if you encounter
it in the wild.

Fixes: debbugs:13930
parent eda9c7d7
2013-05-14 Glenn Morris <rgm@gnu.org>
* subr.el (user-emacs-directory-warning): New option.
(locate-user-emacs-file): Handle non-accessible .emacs.d. (Bug#13930)
2013-05-14 Leo Liu <sdl.web@gmail.com> 2013-05-14 Leo Liu <sdl.web@gmail.com>
* progmodes/octave.el (octave-font-lock-keywords): Fix error * progmodes/octave.el (octave-font-lock-keywords): Fix error
......
...@@ -2643,6 +2643,13 @@ Various programs in Emacs store information in this directory. ...@@ -2643,6 +2643,13 @@ Various programs in Emacs store information in this directory.
Note that this should end with a directory separator. Note that this should end with a directory separator.
See also `locate-user-emacs-file'.") See also `locate-user-emacs-file'.")
(custom-declare-variable-early 'user-emacs-directory-warning t
"Non-nil means warn if cannot access `user-emacs-directory'.
Set this to nil at your own risk..."
:type 'boolean
:group 'initialization
:version "24.4")
(defun locate-user-emacs-file (new-name &optional old-name) (defun locate-user-emacs-file (new-name &optional old-name)
"Return an absolute per-user Emacs-specific file name. "Return an absolute per-user Emacs-specific file name.
If NEW-NAME exists in `user-emacs-directory', return it. If NEW-NAME exists in `user-emacs-directory', return it.
...@@ -2658,17 +2665,33 @@ directory if it does not exist." ...@@ -2658,17 +2665,33 @@ directory if it does not exist."
(file-readable-p at-home)) (file-readable-p at-home))
at-home at-home
;; Make sure `user-emacs-directory' exists, ;; Make sure `user-emacs-directory' exists,
;; unless we're in batch mode or dumping Emacs ;; unless we're in batch mode or dumping Emacs.
(or noninteractive (or noninteractive
purify-flag purify-flag
(file-accessible-directory-p (let (errtype)
(directory-file-name user-emacs-directory)) (if (file-directory-p user-emacs-directory)
(let ((umask (default-file-modes))) (or (file-accessible-directory-p user-emacs-directory)
(unwind-protect (setq errtype "access"))
(progn (let ((umask (default-file-modes)))
(set-default-file-modes ?\700) (unwind-protect
(make-directory user-emacs-directory)) (progn
(set-default-file-modes umask)))) (set-default-file-modes ?\700)
(condition-case nil
(make-directory user-emacs-directory)
(error (setq errtype "create"))))
(set-default-file-modes umask))))
(when (and errtype
user-emacs-directory-warning
(not (get 'user-emacs-directory-warning 'this-session)))
;; Only warn once per Emacs session.
(put 'user-emacs-directory-warning 'this-session t)
(display-warning 'initialization
(format "\
Unable to %s `user-emacs-directory' (%s).
Any data that would normally be written there may be lost!
If you never want to see this message again,
customize the variable `user-emacs-directory-warning'."
errtype user-emacs-directory)))))
bestname)))) bestname))))
;;;; Misc. useful functions. ;;;; Misc. useful functions.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment