summary refs log tree commit diff
path: root/emacs/early-init.el
blob: fc1027d93ad44272fddc27e9afcbe4c79173cbbf (plain)
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
;;; early-init.el -*- lexical-binding: t; -*-

;; Emacs 27+ introduces early-init.el, which is run before init.el,
;; before package and UI initialization happens.

;; In noninteractive sessions, prioritize non-byte-compiled source files to prevent the use of stale byte-code. Otherwise, it saves us a little IO time to skip the mtime checks on every *.elc file.
(setopt load-prefer-newer 'noninteractive
        native-comp-jit-compilation nil)

;; is this a bad idea?
;; (setopt site-run-file nil
;;         inhibit-default-init t)
(setopt inhibit-x-resources t)

;; In Emacs 27+, package initialization occurs before `user-init-file' is loaded, but after `early-init-file', so we can disable this here.
;; (setopt package-enable-at-startup nil)

;; Gui changes are expensive
(setopt frame-inhibit-implied-resize t
        default-frame-alist '((fullscreen . maximized)
                              (font . "Noto Serif-12")))

(push '(menu-bar-lines . 0) default-frame-alist)
(push '(tool-bar-lines . 0) default-frame-alist)
(push '(horizontal-scroll-bars) default-frame-alist)
(when (bound-and-true-p tooltip-mode)
  (tooltip-mode -1))
(setq use-file-dialog nil)
(setq use-dialog-box nil)

;; Override the tool-bar-setup function to prevent it from running during the initial stages of startup
;; h/t https://github.com/jamescherti/minimal-emacs.d/
(when (fboundp 'tool-bar-setup)
  (advice-add #'tool-bar-setup :override #'ignore))

;; (setopt default-frame-alist '(
;;                               (menu-bar-lines . 0)
;;                               (tool-bar-lines . 0)))

;; setup package
(setopt package-archives
        '(("gnu" . "https://elpa.gnu.org/packages/")
          ("nongnu" . "https://elpa.nongnu.org/nongnu/")
          ("melpa" . "https://melpa.org/packages/")))

;; 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)