2018-03-21 15:21:18 -04:00
|
|
|
;;; early-init.el -*- lexical-binding: t; -*-
|
|
|
|
|
2021-01-03 22:56:36 -05:00
|
|
|
;; Emacs 27.1 introduced early-init.el, which is run before init.el, before
|
|
|
|
;; package and UI initialization happens, and before site files are loaded.
|
2018-03-28 00:41:57 -04:00
|
|
|
|
2021-01-03 22:56:36 -05:00
|
|
|
;; 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.
|
2019-07-21 03:01:15 +02:00
|
|
|
(setq gc-cons-threshold most-positive-fixnum)
|
2018-09-19 00:25:17 +01:00
|
|
|
|
2021-01-03 22:56:36 -05:00
|
|
|
;; 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)
|
|
|
|
|
2019-07-21 03:01:15 +02:00
|
|
|
;; In 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 early!
|
2018-08-31 23:40:54 +02:00
|
|
|
(setq package-enable-at-startup nil)
|
2020-11-16 19:27:39 -05:00
|
|
|
(fset #'package--ensure-init-file #'ignore) ; DEPRECATED Removed in 28
|
2018-06-16 11:38:19 +02:00
|
|
|
|
2021-01-03 22:56:36 -05:00
|
|
|
;; `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))
|
2019-03-02 03:54:04 -05:00
|
|
|
|
2021-01-03 22:56:36 -05:00
|
|
|
;; Ensure Doom is running out of this file's directory
|
|
|
|
(setq user-emacs-directory (file-name-directory load-file-name))
|
2019-09-06 15:40:38 -04:00
|
|
|
|
2021-01-03 22:56:36 -05:00
|
|
|
;; Load the heart of Doom Emacs
|
|
|
|
(load (concat user-emacs-directory "core/core") nil 'nomessage)
|