-
Notifications
You must be signed in to change notification settings - Fork 0
/
early-init.el
64 lines (50 loc) · 2.55 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
;;; -*- lexical-binding: t; -*-
;; Increase GC's thresholds in order to reduce start-up time. They must be reset
;; to their original values (or even lower) in the `emacs-startup-hook'.
(setq gc-cons-threshold most-positive-fixnum)
;; Prevent package.el from modifying this file. You wish to set this variable,
;; you must do so in the early init file.
(setq package-enable-at-startup nil)
;; `file-name-handler-alist' is consulted on every `require', `load' and various
;; path/io functions. You get a minor speed up by nooping this.
(put 'file-name-handler-alist 'initial-value file-name-handler-alist)
(unless noninteractive
(setq file-name-handler-alist nil))
;; Temporarily inhibit messages.
(setq inhibit-message t)
(defun my/reset-inhibit-message ()
(run-with-timer 0.25 nil (lambda ()
(setq inhibit-message nil))))
(add-hook 'emacs-startup-hook #'my/reset-inhibit-message)
(load (file-name-concat user-emacs-directory "core" "my-globals.el") nil 'no-message)
;;; Frame settings
(defun theme/read ()
(ignore-errors
(mapcar (lambda (line)
(pcase-let ((`(,key ,value) (split-string line "=")))
`(,(intern (string-trim key)) . ,(string-trim value))))
(split-string (with-temp-buffer
(insert-file-contents-literally "~/.theme")
(buffer-string))
"\n" 'omit-nulls))))
(let* ((theme (theme/read))
(name (and theme (intern (alist-get 'SYSTEM_THEME theme))))
(bg-color (if theme (alist-get 'THEME_BG_COLOR theme) my/default-dark-bg)))
(setq my/theme (or name 'doom-one))
(setq default-frame-alist `((fullscreen . fullheight)
(menu-bar-lines . 0)
(tool-bar-lines . 0)
(left-fringe . 10)
(horizontal-scroll-bars . nil)
(vertical-scroll-bars . nil)
(font . ,my/face-fixed-pitch-family)
(background-color . ,bg-color))))
;; Resizing the Emacs frame can be a terribly expensive part of changing the
;; font. By inhibiting this, we easily halve startup times with fonts that are
;; larger than the system default.
(setq frame-inhibit-implied-resize t)
;; Change font size of header lines too.
(setq-default text-scale-remap-header-line t)
;; Set initial frame settings to avoid rendering artifacts (e.g. seeing the menu
;; bar before it's effectively disabled).
(setq initial-frame-alist '((fullscreen . maximized)))