bug-gnu-emacs
[Top][All Lists]
Advanced

[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: Sun, 11 Dec 2016 17:38:48 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

address@hidden writes:

> I see the same in Emacs 25, 24.5, and 24.4; 24.3 just prints a "File
> exists" message.  Looks like the problem is that locate-user-emacs-file
> (and thus the check for the warning) is called before any customizations
> (or --eval args) are executed.
> Perhaps the warning could be delayed until after init time?

Following patch delay the warning until al command line arguments have
being processed.
What do you think?

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>From 8d715d63eeda6e7814a86203f59ce6ee239aa65d Mon Sep 17 00:00:00 2001
From: Tino Calancha <address@hidden>
Date: Sun, 11 Dec 2016 17:32:18 +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 | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/lisp/startup.el b/lisp/startup.el
index 4a04f9c..dc59d9c 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)
 
@@ -1365,6 +1366,11 @@ command-line
   ;; 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: 595a4d6bfd5aad79fb3ab681ae06f0739a4a5701





reply via email to

[Prev in Thread] Current Thread [Next in Thread]