From 25d9786edf7dc91b9cebc9ddcc1e3375217228d7 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 13 Aug 2018 03:45:58 +0200 Subject: [PATCH] Add early-init-file support to doom/profile-emacs #788 And fix wrong-type-argument: stringp errors when running esup. Also ensure that doom|run-all-startup-hooks sets after-init-time. --- core/autoload/debug.el | 27 ++++++++++++++++----------- core/core.el | 4 +++- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/core/autoload/debug.el b/core/autoload/debug.el index 27b69f36f..c7d9d32c1 100644 --- a/core/autoload/debug.el +++ b/core/autoload/debug.el @@ -290,17 +290,22 @@ If INIT-FILE is non-nil, profile that instead of USER-INIT-FILE." (setq esup-server-process (esup-server-create (esup-select-port))) (setq esup-server-port (process-contact esup-server-process :service)) (message "esup process started on port %s" esup-server-port) - (let ((process-args `("*esup-child*" - "*esup-child*" - ,esup-emacs-path - "-q" - "-L" ,esup-load-path - "-l" "esup-child" - ,(format "--eval=(esup-child-run \"%s\" \"%s\" %d)" - init-file - esup-server-port - esup-depth) - "--eval=(doom|run-all-startup-hooks)"))) + (let ((process-args + (append `("*esup-child*" + "*esup-child*" + ,esup-emacs-path + "-Q" + "--eval=(setq after-init-time nil)" + "-L" ,esup-load-path) + (when (bound-and-true-p early-init-file) + `("-l" ,early-init-file)) + `("-l" "esup-child" + ,(format "--eval=(let ((load-file-name \"%s\")) (esup-child-run \"%s\" \"%s\" %d))" + init-file + init-file + esup-server-port + esup-depth) + "--eval=(doom|run-all-startup-hooks)")))) (when esup-run-as-batch-p (setq process-args (append process-args '("--batch")))) (setq esup-child-process (apply #'start-process process-args))) diff --git a/core/core.el b/core/core.el index 66b7c0ad2..ba79a2fca 100644 --- a/core/core.el +++ b/core/core.el @@ -300,7 +300,9 @@ If RETURN-P, return the message as a string instead of displaying it." -q or -Q, for example: emacs -Q -l init.el -f doom|run-all-startup-hooks" - (dolist (hook (list 'after-init-hook 'delayed-warnings-hook + (run-hook-wrapped 'after-init-hook #'doom-try-run-hook) + (setq after-init-time (current-time)) + (dolist (hook (list 'delayed-warnings-hook 'emacs-startup-hook 'term-setup-hook 'window-setup-hook)) (run-hook-wrapped hook #'doom-try-run-hook)))