summaryrefslogtreecommitdiff
path: root/lisp/startup.el
diff options
context:
space:
mode:
authorTino Calancha <tino.calancha@gmail.com>2022-04-21 17:27:50 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-04-21 17:27:50 +0200
commit783dd6da31e3f0387e110972c0b9fe1f5acc4bba (patch)
treeffdc8f383d2c2c9478ebbdb40f5a4ecbdd4b6b83 /lisp/startup.el
parentf3a02858dccbac36bbf0fb19a29fab59013a56a0 (diff)
downloademacs-783dd6da31e3f0387e110972c0b9fe1f5acc4bba.tar.gz
emacs-783dd6da31e3f0387e110972c0b9fe1f5acc4bba.tar.bz2
emacs-783dd6da31e3f0387e110972c0b9fe1f5acc4bba.zip
Respect user-emacs-directory-warning in startup
* lisp/startup.el (command-line): If user-emacs-directory is not accessible, delay to show a warning until all command line args are processed (bug#25163).
Diffstat (limited to 'lisp/startup.el')
-rw-r--r--lisp/startup.el21
1 files changed, 16 insertions, 5 deletions
diff --git a/lisp/startup.el b/lisp/startup.el
index 353b5c78f17..4391fdd9961 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1292,11 +1292,13 @@ please check its value")
;; Re-evaluate predefined variables whose initial value depends on
;; the runtime context.
- (when (listp custom-delayed-init-variables)
- (mapc #'custom-reevaluate-setting
- ;; Initialize them in the same order they were loaded, in
- ;; case there are dependencies between them.
- (reverse custom-delayed-init-variables)))
+ (let ((user-emacs-directory-warning nil)) ; Delay showing this
+ ; warning (Bug#25162).
+ (when (listp custom-delayed-init-variables)
+ (mapc #'custom-reevaluate-setting
+ ;; Initialize them in the same order they were loaded, in
+ ;; case there are dependencies between them.
+ (reverse custom-delayed-init-variables))))
(setq custom-delayed-init-variables t)
;; Warn for invalid user name.
@@ -1557,9 +1559,18 @@ please check its value")
(list 'error
(substitute-command-keys "Memory exhausted--use \\[save-some-buffers] then exit and restart Emacs")))
+ ;; Reevaluate `user-emacs-directory-warning' before process '--eval'
+ ;; args, so that the user can override that default (Bug#25162).
+ (custom-reevaluate-setting 'user-emacs-directory-warning)
+
;; Process the remaining args.
(command-line-1 (cdr command-line-args))
+ ;; Check if `user-emacs-directory' is accessible (Bug#25162).
+ (when (and user-emacs-directory-warning
+ (not (file-accessible-directory-p user-emacs-directory)))
+ (locate-user-emacs-file ""))
+
;; This is a problem because, e.g. if emacs.d/gnus.el exists,
;; trying to load gnus could load the wrong file.
;; OK, it would not matter if .emacs.d were at the end of load-path.