Move init.el to early-init.el
Our first step toward dropping 26.x support. Allows our optimizations to reach a little further into the startup.
This commit is contained in:
parent
39deb6aedb
commit
5da3641aad
3 changed files with 44 additions and 62 deletions
42
init.el
42
init.el
|
@ -27,43 +27,11 @@
|
|||
;;
|
||||
;;; License: MIT
|
||||
|
||||
(when (< emacs-major-version 26)
|
||||
(error "Detected Emacs v%s. Doom only supports Emacs 26 and newer"
|
||||
emacs-version))
|
||||
|
||||
;; A big contributor to startup times is garbage collection. We up the gc
|
||||
;; threshold to temporarily prevent it from running, then reset it later by
|
||||
;; enabling `gcmh-mode'. Not resetting it will cause stuttering/freezes.
|
||||
(setq gc-cons-threshold most-positive-fixnum)
|
||||
|
||||
;; In noninteractive sessions, prioritize non-byte-compiled source files to
|
||||
;; prevent the use of stale byte-code. Otherwise, it saves us a little IO time
|
||||
;; to skip the mtime checks on every *.elc file.
|
||||
(setq load-prefer-newer noninteractive)
|
||||
|
||||
;; `file-name-handler-alist' is consulted on every `require', `load' and various
|
||||
;; path/io functions. You get a minor speed up by nooping this. However, this
|
||||
;; may cause problems on builds of Emacs where its site lisp files aren't
|
||||
;; byte-compiled and we're forced to load the *.el.gz files (e.g. on Alpine)
|
||||
(unless (daemonp)
|
||||
(defvar doom--initial-file-name-handler-alist file-name-handler-alist)
|
||||
(setq file-name-handler-alist nil)
|
||||
;; Restore `file-name-handler-alist' later, because it is needed for handling
|
||||
;; encrypted or compressed files, among other things.
|
||||
(defun doom-reset-file-handler-alist-h ()
|
||||
;; Re-add rather than `setq', because changes to `file-name-handler-alist'
|
||||
;; since startup ought to be preserved.
|
||||
(dolist (handler file-name-handler-alist)
|
||||
(add-to-list 'doom--initial-file-name-handler-alist handler))
|
||||
(setq file-name-handler-alist doom--initial-file-name-handler-alist))
|
||||
(add-hook 'emacs-startup-hook #'doom-reset-file-handler-alist-h))
|
||||
|
||||
;; Ensure Doom is running out of this file's directory
|
||||
(setq user-emacs-directory (file-name-directory load-file-name))
|
||||
|
||||
;; Load the heart of Doom Emacs
|
||||
(load (concat user-emacs-directory "core/core")
|
||||
nil 'nomessage)
|
||||
;; In the strange case that early-init.el wasn't loaded (e.g. you're using
|
||||
;; Chemacs 1? Or you're loading this file directly?), we do it explicitly:
|
||||
(unless (boundp 'doom-version)
|
||||
(load (concat (file-name-directory load-file-name) "early-init")
|
||||
nil t))
|
||||
|
||||
;; And let 'er rip!
|
||||
(doom-initialize)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue