From ea0f46b181611b6973673df486c5de2f591d17dd Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 3 Aug 2018 16:16:01 +0200 Subject: [PATCH] Add 2nd arg to doom-initialize to load core libs This restores the correct value of noninteractive while core libs are loading, so packages like recentf can avoid initializing when running emacs non interactively (thus polluting output or possibly causing errors). --- core/core-editor.el | 5 +++-- core/core-tests.el | 9 ++++----- core/core.el | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/core-editor.el b/core/core-editor.el index faa66ea9f..b39230c5b 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -134,8 +134,9 @@ savehist file." "^/var/folders/.+$" ;; ignore private DOOM temp files (but not all of them) (lambda (file) (file-in-directory-p file doom-local-dir)))) - (add-hook 'kill-emacs-hook #'recentf-cleanup) - (quiet! (recentf-mode +1))) + (unless noninteractive + (add-hook 'kill-emacs-hook #'recentf-cleanup) + (quiet! (recentf-mode +1)))) (def-package! server :when (display-graphic-p) diff --git a/core/core-tests.el b/core/core-tests.el index 10db96efe..daf9b0f42 100644 --- a/core/core-tests.el +++ b/core/core-tests.el @@ -6,11 +6,10 @@ command line args following a double dash (each arg should be in the 'module/submodule' format). If neither is available, run all tests in all enabled modules." - (let (noninteractive) - ;; Core libraries aren't fully loaded in a noninteractive session, so we - ;; reload it with `noninteractive' set to nil to force them to. - (quiet! (doom-reload-autoloads)) - (doom-initialize t)) + ;; Core libraries aren't fully loaded in a noninteractive session, so we + ;; reload it with `noninteractive' set to nil to force them to. + (quiet! (doom-reload-autoloads)) + (doom-initialize t t) (let ((target-paths ;; Convert targets into a list of string paths, pointing to the root ;; directory of modules diff --git a/core/core.el b/core/core.el index 9f296cdac..7585e11b2 100644 --- a/core/core.el +++ b/core/core.el @@ -314,7 +314,7 @@ If RETURN-P, return the message as a string instead of displaying it." ;; Bootstrap functions ;; -(defun doom-initialize (&optional force-p) +(defun doom-initialize (&optional force-p force-load-core-p) "Bootstrap Doom, if it hasn't already (or if FORCE-P is non-nil). The bootstrap process involves making sure 1) the essential directories exist, @@ -368,7 +368,7 @@ to least)." (user-error "Your package autoloads are missing! Run `bin/doom refresh' to regenerate them"))) (require 'core-os) - (unless noninteractive + (when (or force-load-core-p (not noninteractive)) (add-hook! 'emacs-startup-hook #'(doom|post-init doom|display-benchmark)) (require 'core-ui)