diff --git a/lisp/doom-packages.el b/lisp/doom-packages.el index b065e53c2..321c441b0 100644 --- a/lisp/doom-packages.el +++ b/lisp/doom-packages.el @@ -97,6 +97,16 @@ uses a straight or package.el command directly).") straight-vc-git-default-clone-depth '(1 single-branch)) (with-eval-after-load 'straight + ;; HACK Doom relies on deferred compilation, which spares the user 20-50min of + ;; compilation at install time, but subjects them to ~50% CPU activity when + ;; starting Emacs for the first time. To complete this, straight.el needs to + ;; be told not to do native-compilation, but it won't obey + ;; `straight-disable-native-compile'. + ;; + ;; It *will* obey `straight--native-comp-available', though. Trouble is: + ;; it's a constant; it resets itself when straight is loaded, so it must be + ;; changed afterwards. + (setq straight--native-comp-available nil) ;; `let-alist' is built into Emacs 26 and onwards (add-to-list 'straight-built-in-pseudo-packages 'let-alist)) diff --git a/lisp/doom.el b/lisp/doom.el index 6dbbefb5e..89b60dfc2 100644 --- a/lisp/doom.el +++ b/lisp/doom.el @@ -59,11 +59,6 @@ (unless (get var 'initial-value) (put var 'initial-value (default-value var)))) -;; Prevent unwanted runtime compilation for gccemacs (native-comp) users; -;; packages are compiled ahead-of-time when they are installed and site files -;; are compiled when gccemacs is installed. -(setq native-comp-deferred-compilation nil) - ;; Since Emacs 27, package initialization occurs before `user-init-file' is ;; loaded, but after `early-init-file'. Doom handles package initialization, so ;; we must prevent Emacs from doing it again. @@ -316,6 +311,18 @@ users).") ;;; Native Compilation support (http://akrl.sdf.org/gccemacs.html) (when (featurep 'native-compile) + ;; Enable deferred compilation and disable ahead-of-time compilation, so we + ;; don't bog down the install process with an excruciatingly long compile + ;; times. It will mean more CPU time at runtime, but given its asynchronosity, + ;; this is acceptable. + (setq native-comp-deferred-compilation t + straight-disable-native-compile t) + + ;; Suppress compiler warnings, to avoid inundating users will popups. They + ;; don't cause breakage, so it's not worth dedicating screen estate to them. + (setq native-comp-async-report-warnings-errors init-file-debug + native-comp-warning-on-missing-source init-file-debug) + ;; Don't store eln files in ~/.emacs.d/eln-cache (where they can easily be ;; deleted by 'doom upgrade'). ;; REVIEW Use `startup-redirect-eln-cache' when 28 support is dropped