summary refs log tree commit diff stats
path: root/early-init.el
diff options
context:
space:
mode:
Diffstat (limited to 'early-init.el')
-rw-r--r--early-init.el96
1 files changed, 55 insertions, 41 deletions
diff --git a/early-init.el b/early-init.el index 27c8450..4037fde 100644 --- a/early-init.el +++ b/early-init.el
@@ -24,23 +24,24 @@
24 load-path) 24 load-path)
25(require 'acdw) 25(require 'acdw)
26 26
27
28;;; Speed up init 27;;; Speed up init
29;; see doom-emacs, et al. 28;; see doom-emacs, et al.
30 29
31(setq load-prefer-newer noninteractive 30(setq acdw/orig-file-name-handler-alist file-name-handler-alist
32 orig-file-name-handler-alist file-name-handler-alist
33 file-name-handler-alist nil 31 file-name-handler-alist nil
34 inhibit-x-resources t) 32 gc-cons-percentage 0.8
35(acdw/gc-disable) 33 gc-cons-threshold most-positive-fixnum
34 load-prefer-newer noninteractive)
36 35
37(add-hook 'after-init-hook 36(add-hook 'after-init-hook
38 (defun after-init@reset () 37 (defun after-init@reset ()
39 (acdw/gc-enable) 38 "Reset `file-name-handler-alist' and garbage collection."
39 (setq gc-cons-percentage 0.1
40 gc-cons-threshold (* 800 1024 1024))
40 (dolist (handler file-name-handler-alist) 41 (dolist (handler file-name-handler-alist)
41 (add-to-list 'orig-file-name-handler-alist handler)) 42 (add-to-list 'acdw/orig-file-name-handler-alist handler))
42 (setq file-name-handler-alist orig-file-name-handler-alist))) 43 (setq file-name-handler-alist acdw/orig-file-name-handler-alist)))
43 44
44;;; Frame settings 45;;; Frame settings
45(setq default-frame-alist ; Remove most UI 46(setq default-frame-alist ; Remove most UI
46 `((tool-bar-lines . 0) ; No tool bar 47 `((tool-bar-lines . 0) ; No tool bar
@@ -63,53 +64,65 @@
63 64
64(add-hook 'after-init-hook 65(add-hook 'after-init-hook
65 (defun after-init@disable-ui-modes () 66 (defun after-init@disable-ui-modes ()
67 "Disable UI modes after init.
68I already disable them from the `default-frame-alist' for speed
69and anti-flickering reasons, but this function allows running,
70say, `tool-bar-mode' once to toggle the tool bar back on."
66 (dolist (mode ;; each mode is of the form (MODE . FRAME-ALIST-VAR) 71 (dolist (mode ;; each mode is of the form (MODE . FRAME-ALIST-VAR)
67 '((tool-bar-mode . tool-bar-lines) 72 '((tool-bar-mode . tool-bar-lines)
68 (menu-bar-mode . menu-bar-lines) 73 (menu-bar-mode . menu-bar-lines)
69 (scroll-bar-mode . vertical-scroll-bars) 74 (scroll-bar-mode . vertical-scroll-bars)
70 (horizontal-scroll-bar-mode . horizontal-scroll-bars) 75 (horizontal-scroll-bar-mode . horizontal-scroll-bars)))
71 ))
72 (let ((setting (alist-get (cdr mode) default-frame-alist))) 76 (let ((setting (alist-get (cdr mode) default-frame-alist)))
73 (when (or (not setting) 77 (when (or (not setting)
74 (= 0 setting)) 78 (zerop setting))
75 (funcall (car mode) -1)))))) 79 (funcall (car mode) -1))))))
76 80
77(add-hook 'after-make-frame-functions 81(add-hook 'after-make-frame-functions
78 (defun acdw/frame-setup (&rest args) 82 (defun after-make-frame@setup (&rest args)
79 (ignore args) 83 (ignore args)
80 ;; fonts 84 (let ((monospace-faces '((:font "DejaVu Sans Mono" :height 100)
81 (require 'acdw-fonts) 85 (:font "Consolas" :height 100)
82 (setq acdw-fonts/monospace (acdw/system 86 (:font "monospace" :height 100))))
83 (:home "DejaVu Sans Mono") 87 (acdw/set-first-face-attribute 'default monospace-faces)
84 (:work "Consolas") 88 (acdw/set-first-face-attribute 'fixed-pitch monospace-faces)
85 (_ "monospace")) 89 (acdw/set-first-face-attribute 'variable-pitch
86 acdw-fonts/monospace-size (acdw/system 90 '((:font "Inter" :height 12)
87 (:work 12) 91 (:font "sans-serif"
88 (_ 10)) 92 :height 10))))
89 acdw-fonts/variable (acdw/system 93 (acdw/set-emoji-fonts "Segoe UI Emoji"
90 (:home "Inter") 94 "Noto Color Emoji"
91 (:work "Inter") 95 "Apple Color Emoji"
92 (_ "sans-serif")) 96 "Symbola")
93 acdw-fonts/variable-size (acdw/system 97 (acdw/set-fringes '((left-curly-arrow [#b01100000
94 (:work 14) 98 #b00110000
95 (_ 12))) 99 #b00011000
96 (acdw-fonts/set) 100 #b00001100]
97 (acdw-fonts/setup-emoji-fonts "Segoe UI Emoji" 101 4 8 center)
98 "Noto Color Emoji" 102 (right-curly-arrow [#b00000011
99 "Apple Color Emoji" 103 #b00000110
100 "Symbola") 104 #b00001100
101 ;; fringes 105 #b00011000]
102 (acdw/setup-fringes))) 106 4 8 center)
107 (left-arrow [#b01100000
108 #b01010000]
109 2 8 (top t))
110 (right-arrow [#b00000011
111 #b00000101]
112 2 8 (top t))))
113 (setq indicate-empty-lines nil
114 indicate-buffer-boundaries '((top . right)
115 (bottom . right)))
116 (custom-set-faces '(fringe ((t (:foreground "dim gray")))))))
103 117
104;; I have this here because ... the first frame doesn't ? run ? the hook ??? 118;; I have this here because ... the first frame doesn't ? run ? the hook ???
105(add-function :after after-focus-change-function 119(add-function :after after-focus-change-function
106 (defun acdw/first-frame-setup (&rest args) 120 (defun after-focus-change@first-frame-setup (&rest args)
107 (ignore args) 121 (ignore args)
108 (acdw/frame-setup) 122 (after-make-frame@setup)
109 (remove-function after-focus-change-function 123 (remove-function after-focus-change-function
110 #'acdw/first-frame-setup))) 124 #'after-focus-change@first-frame-setup)))
111 125
112
113;;; Bootstrap package manager (`straight.el') 126;;; Bootstrap package manager (`straight.el')
114 127
115;; 1. Update `exec-path'. 128;; 1. Update `exec-path'.
@@ -161,7 +174,6 @@
161;; By the way, the alias is `straight-package-neutering-mode'. 174;; By the way, the alias is `straight-package-neutering-mode'.
162(defalias 'straight-ಠ_ಠ-mode nil) 175(defalias 'straight-ಠ_ಠ-mode nil)
163 176
164
165;;; Message startup time for profiling 177;;; Message startup time for profiling
166;; This just redefines the Emacs function 178;; This just redefines the Emacs function
167;; `display-startup-echo-area-message', so no hooks needed. 179;; `display-startup-echo-area-message', so no hooks needed.
@@ -172,3 +184,5 @@
172 (float-time (time-subtract after-init-time 184 (float-time (time-subtract after-init-time
173 before-init-time))) 185 before-init-time)))
174 gcs-done)) 186 gcs-done))
187
188;;; early-init.el ends here