forked from technomancy/emacs-starter-kit
/
init.el
79 lines (64 loc) · 2.67 KB
/
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
;; Make startup faster by reducing the frequency of garbage
;; collection.
(setq gc-cons-threshold (* 50 1000 1000))
;; "Emergency mode" -- accommodate less-painful startup routine when
;; troubleshooting config problems featuring many restarts.
(defun byte-compile-init-dir ()
"Byte-compile all your dotfiles."
(interactive)
(byte-recompile-directory user-emacs-directory 0))
(global-whitespace-mode -1)
(setq load-prefer-newer t)
(package-initialize)
(require 'package)
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
("melpa-stable" . "https://stable.melpa.org/packages/")))
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(use-package benchmark-init :ensure t
:config
;; To disable collection of benchmark data after init is done.
(add-hook 'after-init-hook 'benchmark-init/deactivate))
(use-package gcmh :ensure t
:init
(gcmh-mode 1)
:config
(setq gcmh-idle-delay 5
gcmh-high-cons-threshold (* 16 1024 1024) ; 16mb
))
;; Unset file-name-handler-alist temporarily -- speeds up loading packages.
(defvar orig--file-name-handler-alist file-name-handler-alist)
(setq file-name-handler-alist nil)
;; Reset it after startup.
(add-hook 'emacs-startup-hook
(lambda ()
(setq file-name-handler-alist orig--file-name-handler-alist)))
(defvar dotfiles-dir (file-name-directory
(or (buffer-file-name) load-file-name)))
(setq user-config (concat dotfiles-dir user-login-name ".el"))
(when (file-exists-p user-config)
(load user-config))
;; 24-bit "truecolor" in emacs...
;; - tmux settings relevant
;; - Follow https://web.archive.org/web/20200710161453/https://github.com/syl20bnr/spacemacs/wiki/Terminal
;; to set `TERM=xterm-24bit`.
;; Test this works in emacs via `(display-color-cells):
;; 8-bit color mode will respond with 256
;; 24-bit color mode will respond with 16777216
;; Load theme here after loading custom stuff. Something in Emacs 28
;; causes startup issues where loading themes prior to code in main
;; use-package file causes a "Attempt to set a constant symbol: nil"
;; error that halts code loading.
(if (util/is-in-terminal)
(load-theme 'daemian t)
(progn (load-theme 'daemian-gui t)
;; Maximize borderless. Assumes `emacs-plus` compiled with
;; --with-no-titlebar option.
(setq ns-auto-hide-menu-bar t)
(set-frame-position nil 0 0)
(set-frame-size nil (display-pixel-width) (display-pixel-height) t)))
(setq debug-ignored-errors nil)
;; Make gc pauses faster by decreasing the threshold.
(setq gc-cons-threshold (* 2 1000 1000))
(message "Done initializing.")