-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathearly-init.el
46 lines (32 loc) · 1.51 KB
/
early-init.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
;;; early-init.el --- Emacs early init -*- lexical-binding: t; -*-
;;; Commentary:
;; Emacs 27 introduced early-init.el, which is run before init.el, before
;; package and UI initialization happens.
;;; Code:
(defconst emacs-start-time (float-time))
(defun print-time-since-init (loc)
(let* ((now (float-time))
(elapsed (- now emacs-start-time)))
(message "Init file %s: time=%.4f sec" loc elapsed)))
(message "Starting emacs... early-init.el")
;; Defer garbage collection further back in the startup process
(setq gc-cons-threshold most-positive-fixnum)
;; Disable `package' in favor of `straight' or `elpaca'.
(setq package-enable-at-startup nil)
(startup-redirect-eln-cache (expand-file-name "var/eln-cache" user-emacs-directory))
;; If an `.el' file is newer than its corresponding `.elc', load the `.el'.
(setq load-prefer-newer t)
;; Faster to disable these here (before they've been initialized)
(push '(menu-bar-lines . 0) default-frame-alist)
(push '(tool-bar-lines . 0) default-frame-alist)
(push '(vertical-scroll-bars) default-frame-alist)
;; Resizing the Emacs frame can be an expensive part of changing the
;; font. Inhibit this to reduce startup times with fonts that are
;; larger than the system default.
(setq frame-inhibit-implied-resize t
frame-resize-pixelwise t)
;; These are good notes on optimizing startup performance:
;; https://github.com/hlissner/doom-emacs/wiki/FAQ#how-is-dooms-startup-so-fast
(print-time-since-init "early-init.el")
(provide 'early-init)
;;; early-init.el ends here