From: Tino Calancha <tino.calancha@gmail.com>
To: npostavs@users.sourceforge.net
Cc: "Óscar Fuentes" <ofv@wanadoo.es>,
"Richard Kim" <emacs18@gmail.com>,
25163@debbugs.gnu.org, tino.calancha@gmail.com
Subject: bug#25163: 26.0.50; Unable to access `user-emacs-directory' (~/.emacs.d/)
Date: Mon, 12 Dec 2016 11:41:24 +0900 [thread overview]
Message-ID: <874m29kgx7.fsf@gmail.com> (raw)
In-Reply-To: <87wpf6d0ew.fsf@users.sourceforge.net> (npostavs's message of "Sun, 11 Dec 2016 09:07:35 -0500")
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
next prev parent reply other threads:[~2016-12-12 2:41 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-11 3:34 bug#25163: 26.0.50; Unable to access `user-emacs-directory' (~/.emacs.d/) Richard Kim
2016-12-11 4:24 ` npostavs
2016-12-11 8:38 ` Tino Calancha
2016-12-11 14:07 ` npostavs
2016-12-12 2:41 ` Tino Calancha [this message]
2022-04-21 15:28 ` Lars Ingebrigtsen
2016-12-11 15:28 ` Eli Zaretskii
2016-12-11 15:50 ` Noam Postavsky
2016-12-11 17:32 ` Eli Zaretskii
2016-12-11 22:15 ` Noam Postavsky
2016-12-11 22:26 ` Óscar Fuentes
2016-12-12 3:28 ` Eli Zaretskii
2016-12-12 4:07 ` Óscar Fuentes
2016-12-13 2:19 ` Richard Kim
2016-12-13 15:52 ` Eli Zaretskii
2016-12-13 2:40 ` Glenn Morris
2016-12-13 4:02 ` Óscar Fuentes
2018-06-13 1:24 ` Noam Postavsky
2020-08-24 15:54 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874m29kgx7.fsf@gmail.com \
--to=tino.calancha@gmail.com \
--cc=25163@debbugs.gnu.org \
--cc=emacs18@gmail.com \
--cc=npostavs@users.sourceforge.net \
--cc=ofv@wanadoo.es \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).