diff options
Diffstat (limited to 'early-init.el')
-rw-r--r-- | early-init.el | 129 |
1 files changed, 28 insertions, 101 deletions
diff --git a/early-init.el b/early-init.el index 615b417..173625f 100644 --- a/early-init.el +++ b/early-init.el | |||
@@ -1,25 +1,6 @@ | |||
1 | ;;; early-init.el -*- lexical-binding: t; coding: utf-8-unix -*- | 1 | ;;; emacs early init -*- lexical-binding: t; -*- |
2 | 2 | ;; by C. Duckworth <acdw@acdw.net> | |
3 | ;; Author: Case Duckworth <acdw@acdw.net> | 3 | (provide 'early-init) |
4 | ;; Created: Sometime during Covid-19, 2020 | ||
5 | ;; Keywords: configuration | ||
6 | ;; URL: https://tildegit.org/acdw/emacs | ||
7 | |||
8 | ;;; License: | ||
9 | |||
10 | ;; Everyone is permitted to do whatever they like with this software | ||
11 | ;; without limitation. This software comes without any warranty | ||
12 | ;; whatsoever, but with two pieces of advice: | ||
13 | ;; - Be kind to yourself. | ||
14 | ;; - Make good choices. | ||
15 | |||
16 | ;;; Commentary: | ||
17 | |||
18 | ;; Starting with Emacs 27.1, early-init.el is sourced before | ||
19 | ;; package.el and any graphical frames. In this file, I set up frame | ||
20 | ;; parameters and packaging infrastructure. | ||
21 | |||
22 | ;;; Code: | ||
23 | 4 | ||
24 | ;;; Speed up init | 5 | ;;; Speed up init |
25 | 6 | ||
@@ -60,19 +41,6 @@ restore that." | |||
60 | (unless (eq debug-on-error 'startup) | 41 | (unless (eq debug-on-error 'startup) |
61 | (+set-during-startup 'debug-on-error 'init)) | 42 | (+set-during-startup 'debug-on-error 'init)) |
62 | 43 | ||
63 | ;;; Set up extra load paths and functionality | ||
64 | |||
65 | (push (locate-user-emacs-file "lisp") load-path) | ||
66 | (require 'acdw) | ||
67 | (require '+compat) | ||
68 | |||
69 | (+define-dir .etc (locate-user-emacs-file ".etc") | ||
70 | "Directory for all of Emacs's various files. | ||
71 | See `no-littering' for examples.") | ||
72 | |||
73 | (+define-dir sync/ (expand-file-name "~/Sync") | ||
74 | "My Syncthing directory.") | ||
75 | |||
76 | ;;; Default frame settings | 44 | ;;; Default frame settings |
77 | 45 | ||
78 | (setq default-frame-alist '((tool-bar-lines . 0) | 46 | (setq default-frame-alist '((tool-bar-lines . 0) |
@@ -89,76 +57,35 @@ See `no-littering' for examples.") | |||
89 | ;; (bottom . right)) | 57 | ;; (bottom . right)) |
90 | ) | 58 | ) |
91 | 59 | ||
92 | ;;; No littering! | 60 | ;;; Set up extra load paths and functionality |
93 | ;; We install `no-littering' package below, but we can set the variables now. | ||
94 | 61 | ||
95 | (setq no-littering-etc-directory .etc | 62 | (push (locate-user-emacs-file "lisp") load-path) |
96 | no-littering-var-directory .etc | 63 | (require 'acdw) |
97 | straight-base-dir .etc) | ||
98 | 64 | ||
99 | ;; https://github.com/emacscollective/no-littering/wiki/Setting-gccemacs'-eln-cache | 65 | (+define-dir .etc (locate-user-emacs-file ".etc") |
66 | "Directory for all of Emacs's various files. | ||
67 | See `no-littering' for examples.") | ||
100 | 68 | ||
101 | (when (boundp 'comp-eln-load-path) | 69 | (+define-dir sync/ (expand-file-name "~/Sync") |
102 | (setcar comp-eln-load-path (expand-file-name (.etc "eln-cache" t)))) | 70 | "My Syncthing directory.") |
103 | 71 | ||
104 | ;;; Packages | 72 | ;;; Packages |
105 | 73 | ||
106 | (setq package-enable-at-startup nil | 74 | (setq package-enable-at-startup nil |
107 | package-quickstart nil | 75 | package-quickstart nil) |
108 | straight-host-usernames '((github . "duckwork") | 76 | |
109 | (gitlab . "acdw")) | 77 | (require 'yoke) |
110 | straight-check-for-modifications '(check-on-save | 78 | |
111 | find-when-checking)) | 79 | (yoke compat "https://git.sr.ht/~pkal/compat") |
112 | 80 | ||
113 | ;; Bootstrap straight.el | 81 | (yoke no-littering "https://github.com/emacscollective/no-littering" |
114 | ;; https://github.com/raxod502/straight.el | 82 | (require 'no-littering) |
115 | 83 | (setq no-littering-etc-directory .etc | |
116 | (+with-message "Bootstrapping straight" | 84 | no-littering-var-directory .etc |
117 | (defvar bootstrap-version) | 85 | custom-file (.etc "custom.el")) |
118 | (let ((bootstrap-file | 86 | (when (boundp 'comp-eln-load-path) |
119 | (expand-file-name | 87 | (setcar comp-eln-load-path (expand-file-name (.etc "eln-cache" t)))) |
120 | "straight/repos/straight.el/bootstrap.el" | 88 | (when (fboundp 'startup-redirect-eln-cache) |
121 | straight-base-dir)) | 89 | (startup-redirect-eln-cache |
122 | (bootstrap-version 5)) | 90 | (convert-standard-filename |
123 | (unless (file-exists-p bootstrap-file) | 91 | (.etc "eln-cache/"))))) |
124 | (with-current-buffer | ||
125 | (url-retrieve-synchronously | ||
126 | (concat "https://raw.githubusercontent.com/" | ||
127 | "raxod502/straight.el/develop/install.el") | ||
128 | 'silent 'inhibit-cookies) | ||
129 | (goto-char (point-max)) | ||
130 | (eval-print-last-sexp))) | ||
131 | (load bootstrap-file nil 'nomessage))) | ||
132 | |||
133 | ;; Early-loaded packages -- those that, for some reason or another, | ||
134 | ;; need to be ensured to be loaded first. | ||
135 | |||
136 | (require 'straight-x) | ||
137 | |||
138 | (dolist (pkg '(el-patch | ||
139 | no-littering | ||
140 | setup | ||
141 | straight ; already installed, but what the hell | ||
142 | )) | ||
143 | (straight-use-package pkg) | ||
144 | (require pkg) | ||
145 | (require (intern (format "+%s" pkg)) nil :noerror)) | ||
146 | |||
147 | ;; Setup `setup' | ||
148 | |||
149 | (add-to-list 'setup-modifier-list '+setup-wrap-to-demote-errors) | ||
150 | (unless (memq debug-on-error '(nil init)) | ||
151 | (define-advice setup (:around (fn head &rest args) +setup-report) | ||
152 | (+with-progress ((format "[Setup] %S..." head)) | ||
153 | (apply fn head args)))) | ||
154 | |||
155 | ;;; Appendix | ||
156 | |||
157 | ;; Get rid of a dumb alias. straight-ಠ_ಠ-mode really slows down all | ||
158 | ;; minibuffer completion functions. Since it's a (rarely-used, even) | ||
159 | ;; alias anyway, I just define it back to nil. By the way, the alias | ||
160 | ;; is `straight-package-neutering-mode'. | ||
161 | (defalias 'straight-ಠ_ಠ-mode nil) | ||
162 | |||
163 | (provide 'early-init) | ||
164 | ;;; early-init.el ends here | ||