-
Notifications
You must be signed in to change notification settings - Fork 1
/
early-init.el
95 lines (72 loc) · 2.92 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
;;; early-init.el --- Early init -*- lexical-binding: t; -*-
;;; Commentary:
;; Emacs HEAD (27+) introduces early-init.el, which is run before init.el,
;; before package and UI initialization happens.
;;; Code:
;; Defer garbage collection until post startup.
(setq gc-cons-threshold most-positive-fixnum
gc-cons-percentage 0.6)
;; Switch to a smaller threshold once startup complete.
(add-hook 'emacs-startup-hook
(lambda ()
(setq gc-cons-threshold 16777216 ; 16MB
gc-cons-percentage 0.1)))
;; In Emacs 27+, package initialization occurs before `user-init-file' is
;; loaded, but after `early-init-file'. We handle our own initialization
;; with straight/use-package so we can disable these.
(setq package-enable-at-startup nil)
(advice-add #'package--ensure-init-file :override #'ignore)
;; Disabling these UI elements early.
(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 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)
;; Ignore X resources; its settings would be redundant with the other
;; settings in this file and can conflict with later config (particularly
;; where the cursor color is concerned).
(advice-add #'x-apply-session-resources :override #'ignore)
;; Hide menu bar.
(menu-bar-mode -1)
;; Hide scroll and tool bar when not in terminal mode.
(when (display-graphic-p)
(scroll-bar-mode -1)
(tool-bar-mode -1))
;; Disables splash screen.
(setq inhibit-startup-screen t)
(setq inhibit-startup-message t)
;; Title bar matches theme.
(add-to-list 'default-frame-alist
'(ns-transparent-titlebar . t))
(add-to-list 'default-frame-alist
'(ns-appearance . dark))
;; Remove title bar icon and file name.
(setq ns-use-proxy-icon nil)
(setq frame-title-format nil)
;; Sets the initial frame to be flush with the top left corner of the screen.
(add-to-list 'initial-frame-alist '(left . 0))
(add-to-list 'initial-frame-alist '(top . 0))
;; Cursor only appears in current buffer.
(setq-default cursor-in-non-selected-windows nil)
;; Fringe
(fringe-mode 16)
;; Theme
(load "~/.emacs.d/elisp/my-theme.el")
(enable-theme 'my)
(defun display-startup-echo-area-message ()
"Redefine startup echo area message."
(message "Emacs initialized in: %s" (emacs-init-time))
(message "Theme hue is: %s" my/hue))
;; Sets font.
(set-face-attribute 'default nil :height 150 :family "Fira Code")
;; Enable emoji.
(set-fontset-font "fontset-default" 'unicode "Apple Color Emoji" nil 'prepend)
;; Temporarily disable mode line
(setq-default mode-line-format nil)
;;; DISABLE SOME LINT WARNINGS IN THIS FILE
;; Local Variables:
;; byte-compile-warnings: (not free-vars unresolved)
;; End:
;;; early-init.el ends here