Subject: bug#25163: 26.0.50; Unable to access `user-emacs-directory' (~/.emacs.d/)

From: [email-masked]
Date: Sun, 11 Dec 2016 09:07:35 -0500

Tino Calancha <[email-masked]> writes:

> [email-masked] 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?

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