diff options
Diffstat (limited to 'config.org')
-rw-r--r-- | config.org | 601 |
1 files changed, 258 insertions, 343 deletions
diff --git a/config.org b/config.org index 8446fe9..2b9671d 100644 --- a/config.org +++ b/config.org | |||
@@ -1,435 +1,350 @@ | |||
1 | #+TITLE: Emacs, emacs, emacs | 1 | #+TITLE: Emacs, emacs, emacs |
2 | #+AUTHOR: Case Duckworth | 2 | #+AUTHOR: Case Duckworth |
3 | #+PROPERTY: header-args :tangle config.el :comments both :mkdirp yes | 3 | #+PROPERTY: header-args :tangle config.el :comments both :mkdirp yes |
4 | #+STARTUP: | ||
4 | #+EXPORT_FILE_NAME: README.md | 5 | #+EXPORT_FILE_NAME: README.md |
5 | #+OPTIONS: toc:nil | 6 | #+OPTIONS: toc:nil |
6 | #+BANKRUPTCY_COUNT: 3 | 7 | #+BANKRUPTCY_COUNT: 3.2 |
7 | #+Time-stamp: <2020-12-23 20:27:53 acdw> | 8 | #+Time-stamp: <2020-12-30 23:33:02 acdw> |
8 | 9 | ||
9 | Let’s configure Emacs using Org mode, they said. It’ll be fun, they said. | 10 | Why the hell not, let’s do this again. |
10 | 11 | ||
11 | * Pave the way | 12 | * Basics |
13 | |||
14 | ** About me | ||
15 | |||
16 | #+BEGIN_SRC emacs-lisp | ||
17 | (setq user-full-name "Case Duckworth" | ||
18 | user-mail-address "acdw@acdw.net") | ||
19 | #+END_SRC | ||
12 | 20 | ||
13 | ** Correct =exec-path= | 21 | ** Correct =exec-path= |
14 | 22 | ||
15 | #+begin_src emacs-lisp | 23 | Straight depends on Git, so I need to tell Emacs where different paths are. |
16 | (let ((win-downloads "c:/Users/aduckworth/Downloads")) | 24 | |
17 | (dolist (path (list | 25 | #+BEGIN_SRC emacs-lisp |
18 | ;; Linux | 26 | (let ((win-downloads "c:/Users/aduckworth/Downloads")) |
19 | (expand-file-name "bin" | 27 | (dolist (path (list |
20 | user-emacs-directory) | 28 | ;; Linux |
21 | (expand-file-name "~/bin") | 29 | (expand-file-name "bin" |
22 | (expand-file-name "~/.local/bin") | 30 | user-emacs-directory) |
23 | (expand-file-name "~/Scripts") | 31 | (expand-file-name "~/bin") |
24 | ;; Windows | 32 | (expand-file-name "~/.local/bin") |
25 | (expand-file-name "emacs/bin" | 33 | (expand-file-name "~/Scripts") |
26 | win-downloads) | 34 | ;; Windows |
27 | (expand-file-name "m/usr/bin" | 35 | (expand-file-name "emacs/bin" |
28 | win-downloads) | 36 | win-downloads) |
29 | (expand-file-name "m/mingw64/bin" | 37 | (expand-file-name "m/usr/bin" |
30 | win-downloads) | 38 | win-downloads) |
31 | (expand-file-name "PortableGit/bin" | 39 | (expand-file-name "m/mingw64/bin" |
32 | win-downloads) | 40 | win-downloads) |
33 | (expand-file-name "PortableGit/usr/bin" | 41 | (expand-file-name "PortableGit/bin" |
34 | win-downloads))) | 42 | win-downloads) |
35 | (when (file-exists-p path) | 43 | (expand-file-name "PortableGit/usr/bin" |
36 | (add-to-list 'exec-path path)))) | 44 | win-downloads))) |
37 | #+end_src | 45 | (when (file-exists-p path) |
46 | (add-to-list 'exec-path path)))) | ||
47 | #+END_SRC | ||
38 | 48 | ||
39 | ** Package management | 49 | ** Package management |
40 | 50 | ||
41 | *** Straight.el | 51 | *** Straight.el |
42 | 52 | ||
43 | Since for whatever reason, Straight can't bootstrap itself on Windows | 53 | Straight can't bootstrap itself on Windows, so I've wrapped the |
44 | -- I've wrapped it in a function here and added the direct git command | 54 | bootstrap code from straight's repo in a function. |
45 | when it errors. | ||
46 | |||
47 | #+begin_src emacs-lisp | ||
48 | (defun acdw/bootstrap-straight () | ||
49 | (defvar bootstrap-version) | ||
50 | (let ((bootstrap-file | ||
51 | (expand-file-name | ||
52 | "straight/repos/straight.el/bootstrap.el" | ||
53 | user-emacs-directory)) | ||
54 | (bootstrap-version 5)) | ||
55 | (unless (file-exists-p bootstrap-file) | ||
56 | (with-current-buffer | ||
57 | (url-retrieve-synchronously | ||
58 | (concat "https://raw.githubusercontent.com/" | ||
59 | "raxod502/straight.el/develop/install.el") | ||
60 | 'silent 'inhibit-cookies) | ||
61 | (goto-char (point-max)) | ||
62 | (eval-print-last-sexp))) | ||
63 | (load bootstrap-file nil 'nomessage))) | ||
64 | |||
65 | (unless (ignore-errors (acdw/bootstrap-straight)) | ||
66 | (message "Straight.el didn't bootstrap correctly. Cloning directly...") | ||
67 | (call-process "git" nil (get-buffer-create "*bootstrap-straight-messages*") nil | ||
68 | "clone" | ||
69 | "https://github.com/raxod502/straight.el" | ||
70 | (expand-file-name "straight/repos/straight.el" | ||
71 | user-emacs-directory)) | ||
72 | (acdw/bootstrap-straight)) | ||
73 | #+end_src | ||
74 | |||
75 | ** Customize variables | ||
76 | |||
77 | *** Put customizations in a separate file | ||
78 | |||
79 | #+begin_src emacs-lisp | ||
80 | (setq custom-file | ||
81 | (expand-file-name "custom.el" user-emacs-directory)) | ||
82 | #+end_src | ||
83 | |||
84 | *** A macro for ease of customization | ||
85 | |||
86 | #+begin_src emacs-lisp | ||
87 | (defmacro cuss (var val &optional docstring) | ||
88 | "Basically `:custom' from `use-package', broken out." | ||
89 | (declare (indent 2) | ||
90 | (doc-string 3)) | ||
91 | `(funcall (or (get ',var 'custom-set) #'set-default) | ||
92 | ',var ,val)) | ||
93 | #+end_src | ||
94 | |||
95 | ** Keep a tidy =~/.emacs= | ||
96 | 55 | ||
97 | #+begin_src emacs-lisp | 56 | #+BEGIN_SRC emacs-lisp |
98 | (straight-use-package 'no-littering) | 57 | (defun acdw/bootstrap-straight () |
99 | 58 | "Bootstrap straight.el." | |
100 | (cuss backup-directory-alist | 59 | (defvar bootstrap-version) |
101 | `((".*" . ,(no-littering-expand-var-file-name "backup/"))) | 60 | (let ((bootstrap-file |
102 | "Where to store backup files.") | 61 | (expand-file-name |
103 | 62 | "straight/repos/straight.el/bootstrap.el" | |
104 | (cuss auto-save-file-name-transforms | 63 | user-emacs-directory)) |
105 | `((".*" ,(no-littering-expand-var-file-name "autosaves/") t)) | 64 | (bootstrap-version 5)) |
106 | "Where to store auto-save files.") | 65 | (unless (file-exists-p bootstrap-file) |
107 | 66 | (with-current-buffer | |
108 | (cuss save-place-file | 67 | (url-retrieve-synchronously |
109 | (no-littering-expand-var-file-name "places") | 68 | (concat |
110 | "Where to store place files.") | 69 | "https://raw.githubusercontent.com/" |
111 | 70 | "raxod502/straight.el/" | |
112 | (cuss undo-fu-session-directory | 71 | "develop/install.el") |
113 | (no-littering-expand-var-file-name "undos/") | 72 | 'silent 'inhibit-cookies) |
114 | "Where to store undo information.") | 73 | (goto-char (point-max)) |
115 | 74 | (eval-print-last-sexp))) | |
116 | (cuss elpher-certificate-directory | 75 | (load bootstrap-file nil 'nomessage))) |
117 | (no-littering-expand-var-file-name "elpher-certificates/") | 76 | #+END_SRC |
118 | "Where to store elpher client certificates.") | ||
119 | |||
120 | ;; Make all directories defined above | ||
121 | (dolist (dir '("backup" | ||
122 | "autosaves" | ||
123 | "undos" | ||
124 | "elpher-certificates")) | ||
125 | (make-directory (no-littering-expand-var-file-name dir) 'parents)) | ||
126 | #+end_src | ||
127 | 77 | ||
128 | ** About me | 78 | Now, I'll /try/ running it regular-style, ignoring the errors. If it |
79 | doesn't work, I'll call git directly and clone the repo myself. | ||
129 | 80 | ||
130 | #+begin_src emacs-lisp | 81 | #+BEGIN_SRC emacs-lisp |
131 | (setq user-full-name "Case Duckworth" | 82 | (unless (ignore-errors (acdw/bootstrap-straight)) |
132 | user-mail-address "acdw@acdw.net") | 83 | (message "Straight.el didn't bootstrap correctly. Cloning directly...") |
133 | #+end_src | 84 | (call-process "git" nil |
85 | (get-buffer-create "*bootstrap-straight-messages*") nil | ||
86 | "clone" | ||
87 | "https://github.com/raxod502/straight.el" | ||
88 | (expand-file-name "straight/repos/straight.el" | ||
89 | user-emacs-directory)) | ||
90 | (acdw/bootstrap-straight)) | ||
91 | #+END_SRC | ||
134 | 92 | ||
135 | * Look and Feel | 93 | ** Customize macro |
136 | 94 | ||
137 | ** Simplify the UI | 95 | #+BEGIN_SRC emacs-lisp |
96 | (defmacro cuss (var val &optional docstring) | ||
97 | "Basically, `:custom' from `use-package', but without `use-package'." | ||
98 | (declare (doc-string 3) | ||
99 | (indent 2)) | ||
100 | `(funcall (or (get ',var 'custom-set) #'set-default) | ||
101 | ',var ,val)) | ||
102 | #+END_SRC | ||
138 | 103 | ||
139 | *** Tool bars and menu bars | 104 | ** Clean =.emacs.d= |
140 | 105 | ||
141 | #+begin_src emacs-lisp | 106 | #+BEGIN_SRC emacs-lisp |
142 | (cuss default-frame-alist | 107 | (straight-use-package 'no-littering) |
143 | '((tool-bar-lines . 0) | 108 | (require 'no-littering) |
144 | (menu-bar-lines . 0)) | 109 | #+END_SRC |
145 | "On a default frame, show no tool bars or menu bars.") | ||
146 | 110 | ||
147 | (menu-bar-mode -1) | 111 | ** Look and feel |
148 | (tool-bar-mode -1) | ||
149 | #+end_src | ||
150 | 112 | ||
151 | *** Scroll bars | 113 | *** Cursor |
152 | 114 | ||
153 | #+begin_src emacs-lisp | 115 | #+BEGIN_SRC emacs-lisp |
154 | (add-to-list 'default-frame-alist '(vertical-scroll-bars . nil)) | 116 | (cuss cursor-type 'bar |
155 | (scroll-bar-mode -1) | 117 | "Show a vertical bar for the cursor.") |
156 | 118 | ||
157 | (add-to-list 'default-frame-alist '(horizontal-scroll-bars . nil)) | 119 | (cuss cursor-in-non-selected-windows 'hollow |
158 | (horizontal-scroll-bar-mode -1) | 120 | "Show an empty box in inactive windows.") |
159 | #+end_src | ||
160 | 121 | ||
161 | *** Dialog boxen | 122 | ;; Don't blink the cursor |
123 | (blink-cursor-mode -1) | ||
124 | #+END_SRC | ||
162 | 125 | ||
163 | #+begin_src emacs-lisp | 126 | *** Tool Bars |
164 | (cuss use-dialog-box nil | ||
165 | "Don't show dialog boxes.") | ||
166 | #+end_src | ||
167 | 127 | ||
168 | *** Shorten confirmations | 128 | **** Tool bars and menu bars |
169 | 129 | ||
170 | #+begin_src emacs-lisp | 130 | #+BEGIN_SRC emacs-lisp |
171 | (fset 'yes-or-no-p #'y-or-n-p) | 131 | (cuss default-frame-alist |
172 | #+end_src | 132 | '((tool-bar-lines . 0) |
133 | (menu-bar-lines .0)) | ||
134 | "Setup the default frame alist.") | ||
173 | 135 | ||
174 | *** Remove the bell | 136 | (menu-bar-mode -1) |
137 | (tool-bar-mode -1) | ||
138 | #+END_SRC | ||
175 | 139 | ||
176 | #+begin_src emacs-lisp | 140 | **** Scroll bars |
177 | ;(cuss visible-bell | ||
178 | ; (not (string= (system-name) "larry")) | ||
179 | ; "Only show a visible bell when on 'larry'.") | ||
180 | |||
181 | (defun acdw/ring-bell-function () | ||
182 | "Custom bell-ringing function." | ||
183 | (let ((orig-face (face-foreground 'mode-line))) | ||
184 | (set-face-foreground 'modeline "#F2804F") | ||
185 | (run-with-idle-timer | ||
186 | 0.1 nil | ||
187 | (lambda (fg) | ||
188 | (set-face-foreground 'mode-line fg)) | ||
189 | orig-face))) | ||
190 | |||
191 | (cuss ring-bell-function #'acdw/ring-bell-function) | ||
192 | #+end_src | ||
193 | 141 | ||
194 | *** Tell Ediff to setup windows better | 142 | #+BEGIN_SRC emacs-lisp |
143 | (add-to-list 'default-frame-alist | ||
144 | '(vertical-scroll-bars . nil)) | ||
195 | 145 | ||
196 | #+begin_src emacs-lisp | 146 | (scroll-bar-mode -1) |
197 | (declare-function ediff-setup-windows-plain "ediff-wind.el") | ||
198 | (cuss ediff-window-setup-function #'ediff-setup-windows-plain) | ||
199 | #+end_src | ||
200 | 147 | ||
201 | ** Tweak the remaining UI | 148 | (add-to-list 'default-frame-alist |
149 | '(horizontal-scroll-bars . nil)) | ||
202 | 150 | ||
203 | *** Fringes | 151 | (horizontal-scroll-bar-mode -1) |
152 | #+END_SRC | ||
204 | 153 | ||
205 | #+begin_src emacs-lisp | 154 | *** Dialogs |
206 | (add-to-list 'default-frame-alist '(left-fringe-width . 2)) | ||
207 | (add-to-list 'default-frame-alist '(right-fringe-width . 2)) | ||
208 | #+end_src | ||
209 | 155 | ||
210 | *** Minibuffer | 156 | #+BEGIN_SRC emacs-lisp |
157 | (cuss use-dialog-box nil | ||
158 | "Don't use dialog boxes to ask questions.") | ||
159 | #+END_SRC | ||
211 | 160 | ||
212 | **** Setup the minibuffer frame | 161 | **** Yes or no questions |
213 | 162 | ||
214 | #+begin_src emacs-lisp | 163 | #+BEGIN_SRC emacs-lisp |
215 | (cuss minibuffer-frame-alist | 164 | (fset 'yes-or-no-p #'y-or-n-p) |
216 | '((width . 80) | 165 | #+END_SRC |
217 | (height . 2) | ||
218 | (vertical-scrollbars . nil)) | ||
219 | "Set up the minibuffer frame.") | ||
220 | 166 | ||
221 | (set-window-scroll-bars (minibuffer-window) nil nil) | 167 | **** The Bell |
222 | #+end_src | ||
223 | 168 | ||
224 | **** Keep the cursor from going into the prompt | 169 | #+BEGIN_SRC emacs-lisp |
170 | (defun acdw/ring-bell-function () | ||
171 | "Ring the bell." | ||
172 | (let ((orig-face (face-foreground 'mode-line))) | ||
173 | (set-face-foreground 'mode-line "#F2804F") | ||
174 | (run-with-idle-timer | ||
175 | 0.1 nil | ||
176 | (lambda (fg) | ||
177 | (set-face-foreground 'mode-line fg)) | ||
178 | orig-face))) | ||
179 | |||
180 | (cuss ring-bell-function #'acdw/ring-bell-function) | ||
181 | #+END_SRC | ||
225 | 182 | ||
226 | #+begin_src emacs-lisp | 183 | *** Frames |
227 | (cuss minibuffer-prompt-properties | ||
228 | '(read-only t cursor-intangible t face minibuffer-prompt) | ||
229 | "Disable moving the cursor into the minibuffer prompt.") | ||
230 | #+end_src | ||
231 | 184 | ||
232 | *** Tabs | 185 | **** Fringes |
233 | 186 | ||
234 | **** Show the tabs as current buffer, plus window count | 187 | #+BEGIN_SRC emacs-lisp |
188 | (cuss indicate-empty-lines t | ||
189 | "Show an indicator on the left fringe of empty lines past the | ||
190 | end of the buffer.") | ||
191 | (cuss indicate-buffer-boundaries 'right | ||
192 | "Indicate the beginning and end of the buffer and whether it | ||
193 | scrolls off-window in the right fringe.") | ||
194 | #+END_SRC | ||
235 | 195 | ||
236 | #+begin_src emacs-lisp | 196 | **** Minibuffer |
237 | (cuss tab-bar-tab-name-function | ||
238 | #'tab-bar-tab-name-current-with-count) | ||
239 | #+end_src | ||
240 | 197 | ||
241 | **** Only show the tab bar when there's more than one tab | 198 | #+BEGIN_SRC emacs-lisp |
199 | (cuss minibuffer-prompt-properties | ||
200 | '(read-only t cursor-intangible t face minibuffer-prompt) | ||
201 | "Keep the cursor away from the minibuffer prompt.") | ||
202 | #+END_SRC | ||
242 | 203 | ||
243 | #+begin_src emacs-lisp | 204 | **** Tabs |
244 | (cuss tab-bar-show 1 | ||
245 | "Show the tab bar only when there's more than 1 tab.") | ||
246 | #+end_src | ||
247 | 205 | ||
248 | *** Cursor | 206 | #+BEGIN_SRC emacs-lisp |
207 | (cuss tab-bar-tab-name-function | ||
208 | #'tab-bar-tab-name-current-with-count | ||
209 | "Show the tab name as the name of the current buffer, plus a | ||
210 | count of the windows in the tab.") | ||
249 | 211 | ||
250 | #+begin_src emacs-lisp | 212 | (cuss tab-bar-show 1 |
251 | (cuss cursor-type 'bar | 213 | "Show the tab bar, when there's more than one tab.") |
252 | "Show a vertical bar for the cursor.") | 214 | #+END_SRC |
253 | (cuss cursor-in-non-selected-windows 'hollow | ||
254 | "In inactive windows, make the cursor an empty box.") | ||
255 | 215 | ||
256 | (blink-cursor-mode 0) | 216 | *** Windows |
257 | #+end_src | ||
258 | 217 | ||
259 | *** Buffer names | 218 | **** Winner mode |
260 | 219 | ||
261 | #+begin_src emacs-lisp | 220 | #+BEGIN_SRC emacs-lisp |
262 | (require 'uniquify) | 221 | (when (fboundp 'winner-mode) |
263 | (cuss uniquify-buffer-name-style 'forward) | 222 | (winner-mode +1)) |
264 | #+end_src | 223 | #+END_SRC |
265 | 224 | ||
266 | *** Buffer boundaries | 225 | **** Switch windows |
267 | 226 | ||
268 | #+begin_src emacs-lisp | 227 | #+BEGIN_SRC emacs-lisp |
269 | (cuss indicate-buffer-boundaries | 228 | (global-set-key (kbd "M-o") #'other-window) |
270 | '((up . right) | 229 | #+END_SRC |
271 | (down . right) | ||
272 | (t . nil)) | ||
273 | "Show arrows on the right when there's more to the buffer up or down.") | ||
274 | |||
275 | (cuss indicate-empty-lines t | ||
276 | "Show a bitmap on the left for empty lines after the end of a buffer.") | ||
277 | #+end_src | ||
278 | 230 | ||
279 | ** Windows | 231 | *** Buffers |
280 | 232 | ||
281 | *** Winner mode | 233 | **** Uniquify buffers |
282 | 234 | ||
283 | #+begin_src emacs-lisp | 235 | #+BEGIN_SRC emacs-lisp |
284 | (when (fboundp 'winner-mode) | 236 | (require 'uniquify) |
285 | (winner-mode +1)) | 237 | (cuss uniquify-buffer-name-style 'forward |
286 | #+end_src | 238 | "Uniquify buffers' names by going up the path trees until they |
239 | become unique.") | ||
240 | #+END_SRC | ||
287 | 241 | ||
288 | *** Windmove | 242 | **** Startup buffers |
289 | 243 | ||
290 | #+begin_src emacs-lisp | 244 | #+BEGIN_SRC emacs-lisp |
291 | (cuss windmove-create-window t | 245 | (cuss inhibit-startup-screen t |
292 | "Create windows in a direction if they don't exist.") | 246 | "Don't show Emacs' startup buffer.") |
293 | (cuss windomove-wrap-around t | ||
294 | "Wrap window movements around frame edges.") | ||
295 | 247 | ||
296 | (windmove-default-keybindings) | 248 | (cuss initial-buffer-choice t |
297 | #+end_src | 249 | "Start with *scratch*.") |
298 | 250 | ||
299 | *** Pop some buffers up in the same window | 251 | (cuss initial-scratch-message "" |
252 | "Empty *scratch* buffer.") | ||
253 | #+END_SRC | ||
300 | 254 | ||
301 | from [[https://github.com/link0ff/emacs-init][link0ff]]. | 255 | *** Modeline |
302 | 256 | ||
303 | #+begin_src emacs-lisp | 257 | **** Smart mode line |
304 | (push `(,(rx bos | ||
305 | "*" | ||
306 | (or "Help" "Apropos" "Colors" "Buffer List" "Command History" | ||
307 | "Dictionary" "Locate" "Messages" "Proced" "eww" "snd" | ||
308 | (and "gud-" (+ (any "a-z0-9"))) | ||
309 | "compilation" "grep" "erlang" "haskell" | ||
310 | ;; Handle both "*shell*" and e.g. "*emacs-shell*" | ||
311 | ;; generated by `project-shell': | ||
312 | (and (? (* nonl) "-") "shell") | ||
313 | "Shell Command Output" | ||
314 | (and "SQL: " (+ (any "A-za-z"))) | ||
315 | "Diff" "vc-dir" "vc-log" "vc-search-log") | ||
316 | "*" | ||
317 | ;; Uniquifed buffer name with optional suffix in angle brackets | ||
318 | (? (and "<" (+ (not (any ">"))) ">")) | ||
319 | eos) | ||
320 | display-buffer-same-window | ||
321 | (inhibit-same-window . nil)) | ||
322 | display-buffer-alist) | ||
323 | |||
324 | (defun display-buffer-from-help-p (_buffer-name _action) | ||
325 | (unless current-prefix-arg | ||
326 | (with-current-buffer (window-buffer) | ||
327 | (eq major-mode 'help-mode)))) | ||
328 | |||
329 | (push '(display-buffer-from-help-p display-buffer-same-window) | ||
330 | display-buffer-alist) | ||
331 | #+end_src | ||
332 | 258 | ||
333 | ** Startup | 259 | #+BEGIN_SRC emacs-lisp |
260 | (straight-use-package 'smart-mode-line) | ||
334 | 261 | ||
335 | #+begin_src emacs-lisp | 262 | (cuss sml/no-confirm-load-theme t |
336 | (cuss inhibit-startup-screen t "Don't show Emacs' startup buffer.") | 263 | "Pass the NO-CONFIRM flag to `load-theme'.") |
337 | (cuss initial-buffer-choice t "Start at *scratch*.") | ||
338 | (cuss initial-scratch-message "" "Empty *scratch*.") | ||
339 | #+end_src | ||
340 | 264 | ||
341 | ** Theme | 265 | (sml/setup) |
266 | #+END_SRC | ||
342 | 267 | ||
343 | #+begin_src emacs-lisp | 268 | **** Rich minority |
344 | (straight-use-package '(modus-themes | ||
345 | :host gitlab | ||
346 | :repo "protesilaos/modus-themes" | ||
347 | :branch "main")) | ||
348 | |||
349 | (cuss modus-themes-slanted-constructs t) | ||
350 | (cuss modus-themes-bold-constructs t) | ||
351 | (cuss modus-themes-fringes nil) | ||
352 | (cuss modus-themes-mode-line '3d) | ||
353 | (cuss modus-themes-syntax 'yellow-comments) | ||
354 | (cuss modus-themes-intense-hl-line nil) | ||
355 | (cuss modus-themes-paren-match 'intense-bold) | ||
356 | (cuss modus-themes-links nil) | ||
357 | (cuss modus-themes-no-mixed-fonts nil) | ||
358 | (cuss modus-themes-prompts nil) | ||
359 | (cuss modus-themes-completions nil) | ||
360 | (cuss modus-themes-diffs nil) | ||
361 | (cuss modus-themes-org-blocks 'grayscale) | ||
362 | (cuss modus-themes-headings | ||
363 | '((1 . line) | ||
364 | (t . t))) | ||
365 | (cuss modus-themes-variable-pitch-headings t) | ||
366 | (cuss modus-themes-scale-headings t) | ||
367 | (cuss modus-themes-scale-1 1.1) | ||
368 | (cuss modus-themes-scale-2 1.15) | ||
369 | (cuss modus-themes-scale-3 1.21) | ||
370 | (cuss modus-themes-scale-4 1.27) | ||
371 | (cuss modus-themes-scale-5 1.33) | ||
372 | |||
373 | ;; :custom-face | ||
374 | (custom-set-faces `(font-lock-comment-face | ||
375 | ((t (:inherit (custom-comment italic variable-pitch)))))) | ||
376 | |||
377 | (load-theme 'modus-operandi t) | ||
378 | #+end_src | ||
379 | 269 | ||
380 | *** Change theme based on time of day | 270 | Since this /comes/ with smart mode line, I’m just going to use it, |
271 | instead of =diminish= or another package. I do have to write this | ||
272 | helper function, though, to add things to the whitelist. | ||
381 | 273 | ||
382 | #+begin_src emacs-lisp | 274 | #+BEGIN_SRC emacs-lisp |
383 | (cuss calendar-latitude 30.4515) | 275 | (defun rm/whitelist-add (regexp) |
384 | (cuss calendar-longitude -91.1871) | 276 | "Add a REGEXP to the whitelist for `rich-minority'." |
277 | (if (listp 'rm--whitelist-regexps) | ||
278 | (add-to-list 'rm--whitelist-regexps regexp) | ||
279 | (setq rm--whitelist-regexps `(,regexp))) | ||
280 | (setq rm-whitelist | ||
281 | (mapconcat 'identity rm--whitelist-regexps "\\|"))) | ||
385 | 282 | ||
386 | (straight-use-package 'circadian) | 283 | (straight-use-package 'rich-minority) |
387 | 284 | ||
388 | (cuss circadian-themes '((:sunrise . modus-operandi) | 285 | (rm/whitelist-add "^$") |
389 | (:sunset . modus-vivendi))) | 286 | #+END_SRC |
390 | 287 | ||
391 | (circadian-setup) | 288 | *** Theme |
392 | #+end_src | ||
393 | 289 | ||
394 | *** Modeline | 290 | **** Modus Themes |
395 | 291 | ||
396 | #+begin_src emacs-lisp | 292 | #+BEGIN_SRC emacs-lisp |
397 | (straight-use-package 'smart-mode-line) | 293 | (straight-use-package 'modus-themes) |
398 | (cuss sml/no-confirm-load-theme t) | 294 | |
399 | (sml/setup) | 295 | (cuss modus-themes-slanted-constructs t |
400 | #+end_src | 296 | "Use more slanted constructs.") |
297 | (cuss modus-themes-bold-constructs t | ||
298 | "Use more bold constructs.") | ||
299 | |||
300 | (cuss modus-themes-region 'bg-only | ||
301 | "Only highlight the background of the selected region.") | ||
302 | |||
303 | (cuss modus-themes-org-blocks 'grayscale | ||
304 | "Show org-blocks with a grayscale background.") | ||
305 | (cuss modus-themes-headings | ||
306 | '((1 . line) | ||
307 | (t . t)) | ||
308 | "Highlight top headings with `line' style, and others by default.") | ||
309 | |||
310 | (cuss modus-themes-scale-headings t | ||
311 | "Scale headings by the ratios below.") | ||
312 | (cuss modus-themes-scale-1 1.1) | ||
313 | (cuss modus-themes-scale-2 1.15) | ||
314 | (cuss modus-themes-scale-3 1.21) | ||
315 | (cuss modus-themes-scale-4 1.27) | ||
316 | (cuss modus-themes-scale-5 1.33) | ||
317 | |||
318 | (load-theme 'modus-operandi t) | ||
319 | #+END_SRC | ||
401 | 320 | ||
402 | **** Rich minority | 321 | **** Change themes based on time of day |
403 | 322 | ||
404 | Since this /comes/ with smart mode line, I’m just going to use it, instead of =diminish= or another package. I do have to write this helper function, though, to add things to the whitelist. | 323 | #+BEGIN_SRC emacs-lisp |
324 | (cuss calendar-latitude 30.4515) | ||
325 | (cuss calendar-longitude -91.1871) | ||
405 | 326 | ||
406 | #+begin_src emacs-lisp | 327 | (straight-use-package 'circadian) |
407 | (defun rm/whitelist-add (regexp) | ||
408 | "Add a REGEXP to the whitelist for `rich-minority'." | ||
409 | (if (listp 'rm--whitelist-regexps) | ||
410 | (add-to-list 'rm--whitelist-regexps regexp) | ||
411 | (setq rm--whitelist-regexps `(,regexp))) | ||
412 | (setq rm-whitelist | ||
413 | (mapconcat 'identity rm--whitelist-regexps "\\|"))) | ||
414 | 328 | ||
415 | (straight-use-package 'rich-minority) | 329 | (cuss circadian-themes '((:sunrise . modus-operandi) |
330 | (:sunset . modus-vivendi))) | ||
416 | 331 | ||
417 | (rm/whitelist-add "^$") | 332 | (circadian-setup) |
418 | #+end_src | 333 | #+END_SRC |
419 | 334 | ||
420 | *** Fonts | 335 | *** Fonts |
421 | 336 | ||
422 | **** Define fonts | 337 | **** Define fonts |
423 | 338 | ||
424 | #+begin_src emacs-lisp | 339 | #+BEGIN_SRC emacs-lisp |
425 | (defun set-face-from-alternatives (face fonts) | 340 | (defun set-face-from-alternatives (face fonts) |
426 | (catch :return | 341 | (catch :return |
427 | (dolist (font fonts) | 342 | (dolist (font fonts) |
428 | (when (find-font (font-spec :family (car font))) | 343 | (when (find-font (font-spec :family (car font))) |
429 | (apply #'set-face-attribute `(,face nil | 344 | (apply #'set-face-attribute `(,face nil |
430 | :family ,(car font) | 345 | :family ,(car font) |
431 | ,@(cdr font))) | 346 | ,@(cdr font))) |
432 | (throw :return font))))) | 347 | (throw :return font))))) |
433 | 348 | ||
434 | (defun acdw/setup-fonts () | 349 | (defun acdw/setup-fonts () |
435 | "Setup fonts. This has to happen after the frame is setup for | 350 | "Setup fonts. This has to happen after the frame is setup for |