-
Notifications
You must be signed in to change notification settings - Fork 0
/
early-init.el
60 lines (44 loc) · 1.83 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
;; -*- lexical-binding: t; -*-
;; Since Emacs 27, an early configuration file early-init.el can be provided to
;; handle initialization to be done before init.el is loaded.
;;; Code:
(setq-default load-prefer-newer t
package-enable-at-startup nil
package-native-compile t)
(setopt gc-cons-threshold most-positive-fixnum
gc-cons-percentage 1.0)
(defun bore/gc-after-focus-change ()
"Run GC when frame loses focus."
(run-with-idle-timer
5 nil
(lambda () (unless (frame-focus-state) (garbage-collect)))))
(defun bore/reset-init-values ()
"Restore default values after init."
(run-with-idle-timer
1 nil
(lambda ()
(setopt gc-cons-threshold (* 20 1024 1024)
gc-cons-percentage 0.1)
(when (boundp 'after-focus-change-function)
(add-function :after after-focus-change-function #'bore/gc-after-focus-change)))))
(add-hook 'emacs-startup-hook 'bore/reset-init-values)
(when (fboundp 'startup-redirect-eln-cache)
(startup-redirect-eln-cache
(convert-standard-filename
(expand-file-name "var/eln-cache/" user-emacs-directory))))
;; Set the right directory to store the native comp cache
;; (add-to-list 'native-comp-eln-load-path (expand-file-name "eln-cache/" user-emacs-directory))
(setq-default load-prefer-newer noninteractive)
(setopt package-enable-at-startup nil
native-comp-async-report-warnings-errors nil
server-client-instructions nil
frame-inhibit-implied-resize t
fancy-startup-text nil
fancy-about-text nil)
(push '(menu-bar-lines . 0) default-frame-alist)
(push '(tool-bar-lines . 0) default-frame-alist)
(push '(vertical-scroll-bars) default-frame-alist)
;; (add-to-list 'default-frame-alist '(undecorated . t))
(custom-set-variables
'(initial-frame-alist (quote ((fullscreen . maximized)))))
;;; early-init.el ends here