From 108158876c99644953bf96b618d24a90f43fbec2 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 16 Sep 2022 17:00:37 +0200 Subject: [PATCH] fix(cli): inability to find user-emacs-directory user-emacs-directory is nil in batch sessions, which early-init.el wasn't expecting, which caused bin/doom to refuse to run out of a non-standard location. Fix: #6777 --- early-init.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/early-init.el b/early-init.el index d2ec74091..d4b47d829 100644 --- a/early-init.el +++ b/early-init.el @@ -44,6 +44,12 @@ ;; PERF: `file-name-handler-alist' is consulted often. Unsetting it offers a ;; notable saving in startup time. (let (file-name-handler-alist) + ;; FIX: If this file was loaded via -batch or bin/doom, then + ;; `user-emacs-directory' won't be set. As a starting point, let's assume + ;; it's the directory this early-init.el file lives in. + (unless user-emacs-directory + (setq user-emacs-directory (file-name-directory (file-truename load-file-name)))) + ;; FEAT: First, we process --init-directory and --profile to detect what ;; `user-emacs-directory' to load from. I avoid using ;; `command-switch-alist' to process --profile and --init-directory because