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: Noam Postavsky
Subject: bug#25163: 26.0.50; Unable to access `user-emacs-directory' (~/.emacs.d/)
Date: Tue, 12 Jun 2018 21:24:33 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

I wrote:

> 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?

So, taking another look at this, the warning *is* currently delayed
until after init time (as are all warnings occuring before init time).
The problem is, delayed warnings are displayed just after init time,
which is just before --eval args are executed.  Maybe we should have
--early-eval to go along with ~/.emacs.d/early-init.el?  Or maybe just
require suppressing this warning via site-start.el.  The patch below
makes that possible (maybe the first hunk isn't really needed, and we
should just remove the user-emacs-directory-warning option in favour of
setting warning-suppress-log-types instead):

--- i/lisp/files.el
+++ w/lisp/files.el
@@ -990,6 +990,13 @@ user-emacs-directory-warning
   :group 'initialization
   :version "24.4")
 
+(defvar warning-suppress-log-types) ; `warnings.el'.
+(defun maybe-suppress-user-emacs-directory-warning ()
+  "Apply `user-emacs-directory-warning' suppression."
+  (unless user-emacs-directory-warning
+    (add-to-list 'warning-suppress-log-types '(initialization 
user-emacs-directory))))
+(add-hook 'after-init-hook #'maybe-suppress-user-emacs-directory-warning)
+
 (defun locate-user-emacs-file (new-name &optional old-name)
   "Return an absolute per-user Emacs-specific file name.
 If NEW-NAME exists in `user-emacs-directory', return it.
@@ -1021,7 +1028,7 @@ locate-user-emacs-file
                        (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
+              (display-warning `(initialization user-emacs-directory ,(intern 
errtype))
                                (format "\
 Unable to %s `user-emacs-directory' (%s).
 Any data that would normally be written there may be lost!





reply via email to

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