summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-02-06 22:15:41 -0600
committerCase Duckworth2022-02-06 22:15:41 -0600
commit9cf098bfb78ad4e3d696dbed1457886188f65e67 (patch)
treeafef3ae7cc6b4423259424f9c05bbed46a25b7b4
parentChange fonts (diff)
downloademacs-9cf098bfb78ad4e3d696dbed1457886188f65e67.tar.gz
emacs-9cf098bfb78ad4e3d696dbed1457886188f65e67.zip
Update early-init
-rw-r--r--early-init.el70
1 files changed, 36 insertions, 34 deletions
diff --git a/early-init.el b/early-init.el index e2080a1..aca65d2 100644 --- a/early-init.el +++ b/early-init.el
@@ -23,22 +23,35 @@
23 23
24;;; Speed up init 24;;; Speed up init
25 25
26;; Garbage collection 26;; Restore things after init
27(setq gc-cons-threshold most-positive-fixnum) 27(defvar +emacs--startup-restore-alist nil
28 "Variables and values to restore after init.")
29
28(add-hook 'emacs-startup-hook 30(add-hook 'emacs-startup-hook
29 (defun emacs-startup@restore-values () 31 (defun emacs-startup@restore-values ()
30 "Restore values set during early-init for speed." 32 "Restore values set during init.
31 (setq gc-cons-threshold 134217728 ; 128mb 33This applies values in `+emacs--startup-restore-alist'."
32 ))) 34 (dolist (a +emacs--startup-restore-alist)
35 (set (car a) (cdr a)))))
36
37(defun +set-during-startup (variable value &optional restore)
38 "Set VARIABLE to VALUE during startup, but restore to RESTORE.
39If RESTORE is nil or not passed, save the original value and
40restore that."
41 (unless nil ;after-init-time
42 (setf (alist-get variable +emacs--startup-restore-alist)
43 (or restore (symbol-value variable)))
44 (set-default variable value)))
45
46;; Garbage collection
47(+set-during-startup 'gc-cons-threshold most-positive-fixnum (* 128 1024 1024))
33 48
34;; Don't prematurely re-display 49;; Don't prematurely re-display
35(setq-default inhibit-redisplay t 50(+set-during-startup 'inhibit-redisplay t)
36 inhibit-message t) 51(+set-during-startup 'inhibit-message t)
37(add-hook 'window-setup-hook 52
38 (defun window-setup@restore-values () 53;; Debug during init
39 "Restore values set during early-init for visuals." 54(+set-during-startup 'debug-on-error t)
40 (setq-default inhibit-redisplay nil
41 inhibit-message nil)))
42 55
43;;; Set up extra load paths and functionality 56;;; Set up extra load paths and functionality
44 57
@@ -67,22 +80,17 @@ See `no-littering' for examples.")
67 indicate-buffer-boundaries '((top . right) 80 indicate-buffer-boundaries '((top . right)
68 (bottom . right))) 81 (bottom . right)))
69 82
70;;; Fonts 83;;; No littering!
71(+with-ensure-after-init 84;; We install `no-littering' package below, but we can set the variables now.
72 ;; Emoji fonts 85
73 (let ((ffl (font-family-list))) 86(setq no-littering-etc-directory .etc
74 (dolist (font '("Noto Color Emoji" 87 no-littering-var-directory .etc
75 "Noto Emoji" 88 straight-base-dir .etc)
76 "Segoe UI Emoji" 89
77 "Apple Color Emoji" 90;; https://github.com/emacscollective/no-littering/wiki/Setting-gccemacs'-eln-cache
78 "FreeSans" 91
79 "FreeMono" 92(when (boundp 'comp-eln-load-path)
80 "FreeSerif" 93 (setcar comp-eln-load-path (expand-file-name (.etc "eln-cache" t))))
81 "Unifont"
82 "Symbola"))
83 (when (member font ffl)
84 (set-fontset-font t 'symbol
85 (font-spec :family font) nil :append)))))
86 94
87;;; Packages 95;;; Packages
88 96
@@ -93,10 +101,6 @@ See `no-littering' for examples.")
93 straight-check-for-modifications '(check-on-save 101 straight-check-for-modifications '(check-on-save
94 find-when-checking)) 102 find-when-checking))
95 103
96(setq no-littering-etc-directory .etc
97 no-littering-var-directory .etc
98 straight-base-dir .etc)
99
100;; Bootstrap straight.el 104;; Bootstrap straight.el
101;; https://github.com/raxod502/straight.el 105;; https://github.com/raxod502/straight.el
102 106
@@ -147,7 +151,5 @@ See `no-littering' for examples.")
147;; is `straight-package-neutering-mode'. 151;; is `straight-package-neutering-mode'.
148(defalias 'straight-ಠ_ಠ-mode nil) 152(defalias 'straight-ಠ_ಠ-mode nil)
149 153
150(message "Loading early-init.el...Done.")
151
152(provide 'early-init) 154(provide 'early-init)
153;;; early-init.el ends here 155;;; early-init.el ends here