[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#25163: 26.0.50; Unable to access `user-emacs-directory' (~/.emacs.d/
From: |
Tino Calancha |
Subject: |
bug#25163: 26.0.50; Unable to access `user-emacs-directory' (~/.emacs.d/) |
Date: |
Mon, 12 Dec 2016 11:41:24 +0900 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
npostavs@users.sourceforge.net writes:
> Tino Calancha <tino.calancha@gmail.com> writes:
>
>> Following patch delay the warning until al command line arguments have
>> being processed.
>> What do you think?
>
> I think that would still be too early for the user setting the variable
> in their init file. I would suggest using after-init-hook, something
> like:
>
> (defun locate-user-emacs-file ...
> ...
> (when errtype
> (add-hook 'after-init-hook #'maybe-warn-about-user-dir)))
I haven't tried your hook solution yet, which probably is better than
mine. Just for offering an alternative way i have updated my previous
patch to handle the case when the user have customized
`user-emacs-directory-warning':
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>From a96f5a406ec965d6010e840fb938da239df706ef Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha@gmail.com>
Date: Mon, 12 Dec 2016 11:35:06 +0900
Subject: [PATCH] Fix Bug#25162
* lisp/startup.el (command-line): If user-emacs-directory is not
accessible, delay to show a warning until all command line args
are processed.
---
lisp/startup.el | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/lisp/startup.el b/lisp/startup.el
index 4a04f9c..f562c88 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1094,11 +1094,12 @@ command-line
;; Re-evaluate predefined variables whose initial value depends on
;; the runtime context.
- (mapc 'custom-reevaluate-setting
- ;; Initialize them in the same order they were loaded, in case there
- ;; are dependencies between them.
- (prog1 (nreverse custom-delayed-init-variables)
- (setq custom-delayed-init-variables nil)))
+ (let (user-emacs-directory-warning) ; Delay showing this warning (Bug#25162).
+ (mapc 'custom-reevaluate-setting
+ ;; Initialize them in the same order they were loaded, in case there
+ ;; are dependencies between them.
+ (prog1 (nreverse custom-delayed-init-variables)
+ (setq custom-delayed-init-variables nil))))
(normal-erase-is-backspace-setup-frame)
@@ -1362,9 +1363,18 @@ command-line
(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.
--
2.10.2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
In GNU Emacs 26.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.4)
of 2016-12-11
Repository revision: 2783e0e3899cf92910e97dc8bfda3e47b3df1478
- bug#25163: 26.0.50; Unable to access `user-emacs-directory' (~/.emacs.d/), Richard Kim, 2016/12/10
- bug#25163: 26.0.50; Unable to access `user-emacs-directory' (~/.emacs.d/), npostavs, 2016/12/10
- bug#25163: 26.0.50; Unable to access `user-emacs-directory' (~/.emacs.d/), Eli Zaretskii, 2016/12/11
- bug#25163: 26.0.50; Unable to access `user-emacs-directory' (~/.emacs.d/), Noam Postavsky, 2016/12/11
- bug#25163: 26.0.50; Unable to access `user-emacs-directory' (~/.emacs.d/), Eli Zaretskii, 2016/12/11
- bug#25163: 26.0.50; Unable to access `user-emacs-directory' (~/.emacs.d/), Noam Postavsky, 2016/12/11
- bug#25163: 26.0.50; Unable to access `user-emacs-directory' (~/.emacs.d/), Óscar Fuentes, 2016/12/11
- bug#25163: 26.0.50; Unable to access `user-emacs-directory' (~/.emacs.d/), Eli Zaretskii, 2016/12/11
- bug#25163: 26.0.50; Unable to access `user-emacs-directory' (~/.emacs.d/), Óscar Fuentes, 2016/12/11
- bug#25163: 26.0.50; Unable to access `user-emacs-directory' (~/.emacs.d/), Richard Kim, 2016/12/12
- bug#25163: 26.0.50; Unable to access `user-emacs-directory' (~/.emacs.d/), Eli Zaretskii, 2016/12/13
- bug#25163: 26.0.50; Unable to access `user-emacs-directory' (~/.emacs.d/), Glenn Morris, 2016/12/12