about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--early-init.el22
-rw-r--r--init.org1142
2 files changed, 555 insertions, 609 deletions
diff --git a/early-init.el b/early-init.el deleted file mode 100644 index 5e62175..0000000 --- a/early-init.el +++ /dev/null
@@ -1,22 +0,0 @@
1;;; early-init.el -*- lexical-binding: t; no-byte-compile: t -*-
2
3(setq load-prefer-newer t)
4
5;;; Bootstrap `straight.el'
6(defvar bootstrap-version)
7(let ((bootstrap-file
8 (expand-file-name "straight/repos/straight.el/bootstrap.el"
9 user-emacs-directory))
10 (bootstrap-version 5))
11 (unless (file-exists-p bootstrap-file)
12 (with-current-buffer
13 (url-retrieve-synchronously
14 "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
15 'silent 'inhibit-cookies)
16 (goto-char (point-max))
17 (eval-print-last-sexp)))
18 (load bootstrap-file nil 'nomessage))
19
20;;; Bootstrap `use-package'
21(setq straight-use-package-by-default t)
22(straight-use-package 'use-package)
diff --git a/init.org b/init.org index 98e081d..52f0d9e 100644 --- a/init.org +++ b/init.org
@@ -1,587 +1,555 @@
1#+TITLE: Emacs config 1#+TITLE: Emacs config
2#+AUTHOR: Case Duckworth 2#+AUTHOR: Case Duckworth
3#+BABEL: :cache yes 3#+BABEL: :cache yes
4#+PROPERTY: header-args :tangle init.el 4#+PROPERTY: header-args :tangle init.el
5#+BANKRUPTCY_COUNT: 1 5#+BANKRUPTCY_COUNT: 1
6 6
7* Preamble 7* Preamble
8 8
9I wanted to write my Emacs configuration in [[https://orgmode.org][Org mode]] for a while, but never could quite figure out how. Finally, I found [[https://github.com/larstvei/dot-emacs][Lars Tveito]]'s config, which does exactly what I want: =init.el= is small and simple, and replaced after the first run, and =init.org= is automatically tangled. So I'm very excited. 9I wanted to write my Emacs configuration in [[https://orgmode.org][Org mode]] for a while, but never could quite figure out how. Finally, I found [[https://github.com/larstvei/dot-emacs][Lars Tveito]]'s config, which does exactly what I want: =init.el= is small and simple, and replaced after the first run, and =init.org= is automatically tangled. So I'm very excited.
10 10
11* Bootstrap 11* Bootstrap
12 12
13/Check out Lars's config for the reasoning behind this./ 13/Check out Lars's config for the reasoning behind this./
14 14
15When this configuration is loaded for the first time, this ~init.el~ is loaded: 15When this configuration is loaded for the first time, this ~init.el~ is loaded:
16 16
17#+BEGIN_SRC emacs-lisp :tangle no 17#+BEGIN_SRC emacs-lisp :tangle no
18 ;; This file replaces itself with the actual configuration when first run. To keep only this version in git, run this command: 18 ;; This file replaces itself with the actual configuration when first run. To keep only this version in git, run this command:
19 ;; git update-index --assume-unchanged init.el 19 ;; git update-index --assume-unchanged init.el
20 ;; 20 ;;
21 ;; If it needs to be changed, start tracking it again thusly: 21 ;; If it needs to be changed, start tracking it again thusly:
22 ;; git update-index --no-assume-unchanged init.el 22 ;; git update-index --no-assume-unchanged init.el
23 23
24 (require 'org) 24 (require 'org)
25 (find-file (concat user-emacs-directory "init.org")) 25 (find-file (concat user-emacs-directory "init.org"))
26 (org-babel-tangle) 26 (org-babel-tangle)
27 (load-file (concat user-emacs-directory "init.el")) 27 (load-file (concat user-emacs-directory "init.el"))
28 (byte-compile-file (concat user-emacs-directory "init.el")) 28 (byte-compile-file (concat user-emacs-directory "init.el"))
29#+END_SRC 29#+END_SRC
30 30
31** Tangling 31** Tangling
32After the first run, the above ~init.el~ will be replaced by the tangled stuff here. However, when /this/ file is edited, we'll need to re-tangle everything. However, nobody has time to do that manually with =C-c C-v t=, /every time/! Luckily, Emacs is highly programmable. 32After the first run, the above ~init.el~ will be replaced by the tangled stuff here. However, when /this/ file is edited, we'll need to re-tangle everything. However, nobody has time to do that manually with =C-c C-v t=, /every time/! Luckily, Emacs is highly programmable.
33 33
34#+NAME: tangle-on-save 34#+NAME: tangle-on-save
35#+BEGIN_SRC emacs-lisp 35#+BEGIN_SRC emacs-lisp :tangle no
36 (defun acdw/tangle-init () 36 (defun acdw/tangle-init ()
37 "If the current buffer is `init.org', the code blocks are tangled, 37 "If the current buffer is `init.org', the code blocks are tangled,
38 and the tangled file is compiled." 38 and the tangled file is compiled."
39 (when (equal (buffer-file-name) 39 (when (equal (buffer-file-name)
40 (expand-file-name (concat user-emacs-directory "init.org"))) 40 (expand-file-name (concat user-emacs-directory "init.org")))
41 ;; Avoid running hooks when tangling. 41 ;; Avoid running hooks when tangling.
42 (let ((prog-mode-hook nil)) 42 (let ((prog-mode-hook nil))
43 (org-babel-tangle) 43 (org-babel-tangle)
44 (byte-compile-file (concat user-emacs-directory "init.el"))))) 44 (byte-compile-file (concat user-emacs-directory "init.el")))))
45 45
46(add-hook 'after-save-hook #'acdw/tangle-init) 46(add-hook 'after-save-hook #'acdw/tangle-init)
47#+END_SRC 47#+END_SRC
48 48
49* Early initiation 49* Early initiation
50Emacs 27.1+ uses ~early-init.el~, which is evaluated before things like ~package.el~ and other stuff. So I have a few settings in there. 50Emacs 27.1+ uses ~early-init.el~, which is evaluated before things like ~package.el~ and other stuff. So I have a few settings in there.
51 51
52** Preamble 52** Preamble
53Of course, first thing is the modeline. After that, I set ~load-prefer-newer~ because, well, it /should/. 53Of course, first thing is the modeline. After that, I set ~load-prefer-newer~ because, well, it /should/.
54#+BEGIN_SRC emacs-lisp :tangle early-init.el 54#+BEGIN_SRC emacs-lisp :tangle early-init.el
55 ;;; early-init.el -*- lexical-binding: t; no-byte-compile: t -*- 55 ;;; early-init.el -*- lexical-binding: t; no-byte-compile: t -*-
56 56
57(setq load-prefer-newer t) 57(setq load-prefer-newer t)
58#+END_SRC 58#+END_SRC
59 59
60** Computers 60** Computers
61I have to set these constants before bootstrapping the package manager, since ~straight.el~ depends on Git, and at work, those are in a weird place. 61I have to set these constants before bootstrapping the package manager, since ~straight.el~ depends on Git, and at work, those are in a weird place.
62 62
63#+BEGIN_SRC emacs-lisp :tangle early-init.el 63#+BEGIN_SRC emacs-lisp :tangle early-init.el
64 (defconst *acdw/at-work* (eq system-type 'windows-nt)) 64 (defconst *acdw/at-work* (eq system-type 'windows-nt))
65 (defconst *acdw/at-larry* (string= (system-name) "larry")) 65 (defconst *acdw/at-larry* (string= (system-name) "larry"))
66 (defconst *acdw/at-bax* (string= (system-name) "bax")) 66 (defconst *acdw/at-bax* (string= (system-name) "bax"))
67 (defconst *acdw/at-home* (or *acdw/at-larry* *acdw/at-bax*)) 67 (defconst *acdw/at-home* (or *acdw/at-larry* *acdw/at-bax*))
68#+END_SRC 68#+END_SRC
69 69
70** Package management 70** Package management
71 I've started using straight.el, which is great. It grabs packages from git, and apparently will let me fork and edit them, which I'll probably get around to ... eventually. 71 I've started using straight.el, which is great. It grabs packages from git, and apparently will let me fork and edit them, which I'll probably get around to ... eventually.
72 72
73*** At work, Git's in a weird place 73*** At work, Git's in a weird place
74#+BEGIN_SRC emacs-lisp :tangle early-init.el 74#+BEGIN_SRC emacs-lisp :tangle early-init.el
75 (when *acdw/at-work* 75 (when *acdw/at-work*
76 (add-to-list 'exec-path "~/bin") 76 (add-to-list 'exec-path "~/bin")
77 (add-to-list 'exec-path "C:/Users/aduckworth/Downloads/PortableGit/bin")) 77 (add-to-list 'exec-path "C:/Users/aduckworth/Downloads/PortableGit/bin"))
78#+END_SRC 78#+END_SRC
79 79
80*** [[https://github.com/raxod502/straight.el][straight.el]] 80*** [[https://github.com/raxod502/straight.el][straight.el]]
81I don't know why, but for some reason the bootstrapping doesn't work on Windows. I have to download the repo directly from github and put it in the right place (=~/.emacs.d/straight/repos/straight.el/=). 81I don't know why, but for some reason the bootstrapping doesn't work on Windows. I have to download the repo directly from github and put it in the right place (=~/.emacs.d/straight/repos/straight.el/=).
82 82
83#+BEGIN_SRC emacs-lisp :tangle early-init.el 83#+BEGIN_SRC emacs-lisp :tangle early-init.el
84 (defvar bootstrap-version) 84 (defvar bootstrap-version)
85 (let ((bootstrap-file 85 (let ((bootstrap-file
86 (expand-file-name "straight/repos/straight.el/bootstrap.el" 86 (expand-file-name "straight/repos/straight.el/bootstrap.el"
87 user-emacs-directory)) 87 user-emacs-directory))
88 (bootstrap-version 5)) 88 (bootstrap-version 5))
89 (unless (file-exists-p bootstrap-file) 89 (unless (file-exists-p bootstrap-file)
90 (with-current-buffer 90 (with-current-buffer
91 (url-retrieve-synchronously 91 (url-retrieve-synchronously
92 "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" 92 "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
93 'silent 'inhibit-cookies) 93 'silent 'inhibit-cookies)
94 (goto-char (point-max)) 94 (goto-char (point-max))
95 (eval-print-last-sexp))) 95 (eval-print-last-sexp)))
96 (load bootstrap-file nil 'nomessage)) 96 (load bootstrap-file nil 'nomessage))
97#+END_SRC 97#+END_SRC
98 98
99*** [[https://github.com/jwiegley/use-package][use-package]] 99*** [[https://github.com/jwiegley/use-package][use-package]]
100Yeah, you know it, I know it, we all love it. It's use-package. 100Yeah, you know it, I know it, we all love it. It's use-package.
101#+BEGIN_SRC emacs-lisp :tangle early-init.el 101#+BEGIN_SRC emacs-lisp :tangle early-init.el
102 (setq straight-use-package-by-default t) 102 (setq straight-use-package-by-default t)
103 (straight-use-package 'use-package) 103 (straight-use-package 'use-package)
104#+END_SRC 104#+END_SRC
105* Begin init.el 105* Begin init.el
106#+BEGIN_SRC emacs-lisp 106#+BEGIN_SRC emacs-lisp :noweb tangle
107 ;;; init.el -*- lexical-binding: t; coding: utf-8 -*- 107 ;;; init.el -*- lexical-binding: t; coding: utf-8 -*-
108#+END_SRC 108 <<tangle-on-save>>
109* Macros 109#+END_SRC
110** cuss 110* Macros
111I like ~use-package~, but I don't like doing the weird "pseudo-package" stuff a lot of people do in their emacs configs. Partially because I have to set ~:straight nil~ on a lot of built-in packages, but also because I think being /that/ obsessive over one interface through the whole config is ... I don't know, short-sighted? 111** cuss
112 112I like ~use-package~, but I don't like doing the weird "pseudo-package" stuff a lot of people do in their emacs configs. Partially because I have to set ~:straight nil~ on a lot of built-in packages, but also because I think being /that/ obsessive over one interface through the whole config is ... I don't know, short-sighted?
113Either way, I /do/ like the ~:custom~ interface that ~use-package~ has, so I've re-implemented it in my own macro. This way I don't have to worry about whether to ~setq~ or ~custom-set-variable~ or whatever. Just ~cuss~! 113
114#+BEGIN_SRC emacs-lisp 114Either way, I /do/ like the ~:custom~ interface that ~use-package~ has, so I've re-implemented it in my own macro. This way I don't have to worry about whether to ~setq~ or ~custom-set-variable~ or whatever. Just ~cuss~!
115 (defmacro cuss (var val) 115#+BEGIN_SRC emacs-lisp
116 "Basically `use-package''s `:custom', but without either." 116 (defmacro cuss (var val)
117 `(progn 117 "Basically `use-package''s `:custom', but without either."
118 (funcall (or (get ',var 'custom-set) #'set-default) 118 `(progn
119 ',var ,val))) 119 (funcall (or (get ',var 'custom-set) #'set-default)
120#+END_SRC 120 ',var ,val)))
121* Files 121#+END_SRC
122** [[https://github.com/emacscollective/no-littering][Keep .emacs.d tidy]] 122* Files
123#+BEGIN_SRC emacs-lisp 123** [[https://github.com/emacscollective/no-littering][Keep .emacs.d tidy]]
124 (use-package no-littering) 124#+BEGIN_SRC emacs-lisp
125#+END_SRC 125 (use-package no-littering)
126** Customize 126#+END_SRC
127I don't like the customize interface, but I still sometimes use it when I'm not sure what the name of a variable is. So I save the stuff to a file, I just don't load it or keep track of it. 127** Customize
128#+BEGIN_SRC emacs-lisp 128I don't like the customize interface, but I still sometimes use it when I'm not sure what the name of a variable is. So I save the stuff to a file, I just don't load it or keep track of it.
129 (cuss custom-file (no-littering-expand-etc-file-name "custom.el")) 129#+BEGIN_SRC emacs-lisp
130#+END_SRC 130 (cuss custom-file (no-littering-expand-etc-file-name "custom.el"))
131** Encoding 131#+END_SRC
132#+BEGIN_SRC emacs-lisp 132** Encoding
133 (set-charset-priority 'unicode) 133#+BEGIN_SRC emacs-lisp
134 (set-language-environment "UTF-8") 134 (set-charset-priority 'unicode)
135 (set-default-coding-systems 'utf-8) 135 (set-language-environment "UTF-8")
136 (set-terminal-coding-system 'utf-8) 136 (set-default-coding-systems 'utf-8)
137 (set-keyboard-coding-system 'utf-8) 137 (set-terminal-coding-system 'utf-8)
138 (set-selection-coding-system 'utf-8) 138 (set-keyboard-coding-system 'utf-8)
139 (prefer-coding-system 'utf-8) 139 (set-selection-coding-system 'utf-8)
140#+END_SRC 140 (prefer-coding-system 'utf-8)
141** Recent files 141#+END_SRC
142#+BEGIN_SRC emacs-lisp 142** Recent files
143 (use-package recentf 143#+BEGIN_SRC emacs-lisp
144 :config 144 (use-package recentf
145 (add-to-list 'recentf-exclude no-littering-var-directory) 145 :config
146 (add-to-list 'recentf-exclude no-littering-etc-directory) 146 (add-to-list 'recentf-exclude no-littering-var-directory)
147 :custom 147 (add-to-list 'recentf-exclude no-littering-etc-directory)
148 (recentf-max-menu-items 100) 148 :custom
149 (recentf-max-saved-items 100) 149 (recentf-max-menu-items 100)
150 :config 150 (recentf-max-saved-items 100)
151 (recentf-mode 1)) 151 :config
152#+END_SRC 152 (recentf-mode 1))
153** Backups 153#+END_SRC
154#+BEGIN_SRC emacs-lisp 154** Backups
155 (cuss backup-directory-alist 155#+BEGIN_SRC emacs-lisp
156 `((".*" . ,(no-littering-expand-var-file-name "backup/")))) 156 (cuss backup-directory-alist
157#+END_SRC 157 `((".*" . ,(no-littering-expand-var-file-name "backup/"))))
158** [[https://github.com/bbatsov/super-save][Autosave]] 158#+END_SRC
159#+BEGIN_SRC emacs-lisp 159** [[https://github.com/bbatsov/super-save][Autosave]]
160 (use-package super-save 160#+BEGIN_SRC emacs-lisp
161 :custom 161 (use-package super-save
162 (auto-save-default nil) 162 :custom
163 (super-save-auto-save-when-idle t) 163 (auto-save-default nil)
164 (super-save-exclude '(".gpg")) 164 (super-save-auto-save-when-idle t)
165 :config 165 (super-save-exclude '(".gpg"))
166 (super-save-mode 1)) 166 :config
167#+END_SRC 167 (super-save-mode 1))
168** Save places 168#+END_SRC
169#+BEGIN_SRC emacs-lisp 169** Save places
170 (use-package saveplace 170#+BEGIN_SRC emacs-lisp
171 :custom 171 (use-package saveplace
172 (save-place-file (no-littering-expand-var-file-name "places")) 172 :custom
173 :config 173 (save-place-file (no-littering-expand-var-file-name "places"))
174 (save-place-mode 1)) 174 :config
175#+END_SRC 175 (save-place-mode 1))
176** Save history 176#+END_SRC
177#+BEGIN_SRC emacs-lisp 177** Save history
178 (use-package savehist 178#+BEGIN_SRC emacs-lisp
179 :custom 179 (use-package savehist
180 (savehist-addtional-variables 180 :custom
181 '(kill-ring 181 (savehist-addtional-variables
182 search-ring 182 '(kill-ring
183 regexp-search-ring)) 183 search-ring
184 (savehist-save-minibuffer-history t) 184 regexp-search-ring))
185 :config 185 (savehist-save-minibuffer-history t)
186 (savehist-mode 1)) 186 :config
187#+END_SRC 187 (savehist-mode 1))
188* User interface 188#+END_SRC
189** Look 189* User interface
190*** Frames and windows 190** Look
191**** Frame defaults 191*** Frames and windows
192#+BEGIN_SRC emacs-lisp 192**** Frame defaults
193 (cuss default-frame-alist '((tool-bar-lines . 0) 193#+BEGIN_SRC emacs-lisp
194 (menu-bar-lines . 0) 194 (cuss default-frame-alist '((tool-bar-lines . 0)
195 (vertical-scroll-bars . nil) 195 (menu-bar-lines . 0)
196 (horizontal-scroll-bars . nil) 196 (vertical-scroll-bars . nil)
197 (right-divider-width . 2) 197 (horizontal-scroll-bars . nil)
198 (bottom-divider-width . 2) 198 (right-divider-width . 2)
199 (left-fringe-width . 2) 199 (bottom-divider-width . 2)
200 (right-fringe-width . 2))) 200 (left-fringe-width . 2)
201 201 (right-fringe-width . 2)))
202 ;; also disable these with modes, so I can re-enable them more easily 202
203 (menu-bar-mode -1) 203 ;; also disable these with modes, so I can re-enable them more easily
204 (tool-bar-mode -1) 204 (menu-bar-mode -1)
205 (scroll-bar-mode -1) 205 (tool-bar-mode -1)
206#+END_SRC 206 (scroll-bar-mode -1)
207**** Resizing 207#+END_SRC
208#+BEGIN_SRC emacs-lisp 208**** Resizing
209 (cuss frame-resize-pixelwise t) 209#+BEGIN_SRC emacs-lisp
210 (cuss window-combination-resize t) 210 (cuss frame-resize-pixelwise t)
211#+END_SRC 211 (cuss window-combination-resize t)
212*** Buffers 212#+END_SRC
213#+BEGIN_SRC emacs-lisp 213*** Buffers
214 (cuss uniquify-buffer-name-style 'forward) 214#+BEGIN_SRC emacs-lisp
215 215 (cuss uniquify-buffer-name-style 'forward)
216 (cuss indicate-buffer-boundaries 216
217 '((top . right) 217 (cuss indicate-buffer-boundaries
218 (bottom . right) 218 '((top . right)
219 (t . nil))) 219 (bottom . right)
220#+END_SRC 220 (t . nil)))
221**** Startup buffer 221#+END_SRC
222#+BEGIN_SRC emacs-lisp 222**** Startup buffer
223 (cuss inhibit-startup-buffer-menu t) 223#+BEGIN_SRC emacs-lisp
224 (cuss inhibit-startup-screen t) 224 (cuss inhibit-startup-buffer-menu t)
225 (cuss initial-buffer-choice t) ; start in *scratch* 225 (cuss inhibit-startup-screen t)
226 (cuss initial-scratch-message nil) 226 (cuss initial-buffer-choice t) ; start in *scratch*
227#+END_SRC 227 (cuss initial-scratch-message nil)
228*** Cursor 228#+END_SRC
229#+BEGIN_SRC emacs-lisp 229*** Cursor
230 (cuss cursor-type 'bar) 230#+BEGIN_SRC emacs-lisp
231 (cuss cursor-in-non-selected-windows 'hollow) 231 (cuss cursor-type 'bar)
232 (blink-cursor-mode 0) 232 (cuss cursor-in-non-selected-windows 'hollow)
233#+END_SRC 233 (blink-cursor-mode 0)
234*** Interactivity 234#+END_SRC
235**** Mouse 235*** Interactivity
236#+BEGIN_SRC emacs-lisp 236**** Mouse
237 (cuss mouse-yank-at-point t) 237#+BEGIN_SRC emacs-lisp
238#+END_SRC 238 (cuss mouse-yank-at-point t)
239**** Dialogs 239#+END_SRC
240#+BEGIN_SRC emacs-lisp 240**** Dialogs
241 (cuss use-dialog-box nil) 241#+BEGIN_SRC emacs-lisp
242#+END_SRC 242 (cuss use-dialog-box nil)
243**** Disabled functions 243#+END_SRC
244#+BEGIN_SRC emacs-lisp 244**** Disabled functions
245 (cuss disabled-command-function nil) 245#+BEGIN_SRC emacs-lisp
246#+END_SRC 246 (cuss disabled-command-function nil)
247** Themes: [[https://github.com/protesilaos/modus-themes][Modus]] 247#+END_SRC
248#+BEGIN_SRC emacs-lisp 248** Themes: [[https://github.com/protesilaos/modus-themes][Modus]]
249 (use-package modus-operandi-theme) 249#+BEGIN_SRC emacs-lisp
250 (use-package modus-vivendi-theme) 250 (use-package modus-operandi-theme)
251#+END_SRC 251 (use-package modus-vivendi-theme)
252*** [[https://github.com/hadronzoo/theme-changer][Change themes]] based on time of day 252#+END_SRC
253#+BEGIN_SRC emacs-lisp 253*** [[https://github.com/hadronzoo/theme-changer][Change themes]] based on time of day
254 (use-package theme-changer 254#+BEGIN_SRC emacs-lisp
255 :init 255 (use-package theme-changer
256 (setq calendar-location-name "Baton Rouge, LA" 256 :init
257 calendar-latitude 30.39 257 (setq calendar-location-name "Baton Rouge, LA"
258 calendar-longitude -91.83) 258 calendar-latitude 30.39
259 :config 259 calendar-longitude -91.83)
260 (change-theme 'modus-operandi 'modus-vivendi)) 260 :config
261#+END_SRC 261 (change-theme 'modus-operandi 'modus-vivendi))
262** Modeline: [[https://github.com/Malabarba/smart-mode-line][smart-mode-line]] 262#+END_SRC
263#+BEGIN_SRC emacs-lisp 263** Modeline: [[https://github.com/Malabarba/smart-mode-line][smart-mode-line]]
264 (use-package smart-mode-line 264#+BEGIN_SRC emacs-lisp
265 :config 265 (use-package smart-mode-line
266 (sml/setup)) 266 :config
267#+END_SRC 267 (sml/setup))
268 268#+END_SRC
269I hide all minor-modes by default for a clean modeline. However, I can add them back by adding them to the whitelist with ~(add-to-list 'rm-whitelist " REGEX")~. 269
270#+BEGIN_SRC emacs-lisp 270I hide all minor-modes by default for a clean modeline. However, I can add them back by adding them to the whitelist with ~(add-to-list 'rm-whitelist " REGEX")~.
271 (use-package rich-minority 271#+BEGIN_SRC emacs-lisp
272 :custom 272 (use-package rich-minority
273 (rm-whitelist '("^$")) ; show no minor modes 273 :custom
274 :config 274 (rm-whitelist '("^$")) ; show no minor modes
275 (rich-minority-mode 1)) 275 :config
276#+END_SRC 276 (rich-minority-mode 1))
277** Fonts 277#+END_SRC
278I'm sure there's a better way to do this, but for now, this is the best I've got. I append to the ~face-font-family-alternatives~ because I don't know what kind of weird magic they're doing in there. 278** Fonts
279#+BEGIN_SRC emacs-lisp 279I'm sure there's a better way to do this, but for now, this is the best I've got. I append to the ~face-font-family-alternatives~ because I don't know what kind of weird magic they're doing in there.
280 (cuss face-font-family-alternatives 280#+BEGIN_SRC emacs-lisp
281 '(("Monospace" "courier" "fixed") 281 (cuss face-font-family-alternatives
282 ("Monospace Serif" "Courier 10 Pitch" "Consolas" "Courier Std" "FreeMono" "Nimbus Mono L" "courier" "fixed") 282 '(("Monospace" "courier" "fixed")
283 ("courier" "CMU Typewriter Text" "fixed") 283 ("Monospace Serif" "Courier 10 Pitch" "Consolas" "Courier Std" "FreeMono" "Nimbus Mono L" "courier" "fixed")
284 ("Sans Serif" "helv" "helvetica" "arial" "fixed") 284 ("courier" "CMU Typewriter Text" "fixed")
285 ("helv" "helvetica" "arial" "fixed") 285 ("Sans Serif" "helv" "helvetica" "arial" "fixed")
286 ;; now mine 286 ("helv" "helvetica" "arial" "fixed")
287 ("FixedPitch" "DejaVu Sans Mono" "Consolas" "fixed") 287 ;; now mine
288 ("VariablePitch" "DejaVu Serif" "Georgia" "fixed"))) 288 ("FixedPitch" "DejaVu Sans Mono" "Consolas" "fixed")
289 289 ("VariablePitch" "DejaVu Serif" "Georgia" "fixed")))
290 (set-face-attribute 'default nil 290
291 :family "FixedPitch" 291 (set-face-attribute 'default nil
292 :height 110) 292 :family "FixedPitch"
293 293 :height 110)
294 (set-face-attribute 'fixed-pitch nil 294
295 :family "FixedPitch" 295 (set-face-attribute 'fixed-pitch nil
296 :height 110) 296 :family "FixedPitch"
297 297 :height 110)
298 (set-face-attribute 'variable-pitch nil 298
299 :family "VariablePitch" 299 (set-face-attribute 'variable-pitch nil
300 :height 110) 300 :family "VariablePitch"
301#+END_SRC 301 :height 110)
302 302#+END_SRC
303*** [[https://github.com/rolandwalker/unicode-fonts][Unicode fonts]] 303
304#+BEGIN_SRC emacs-lisp 304*** [[https://github.com/rolandwalker/unicode-fonts][Unicode fonts]]
305 (use-package unicode-fonts 305#+BEGIN_SRC emacs-lisp
306 :config 306 (use-package unicode-fonts
307 (unicode-fonts-setup)) 307 :config
308#+END_SRC 308 (unicode-fonts-setup))
309* Editing 309#+END_SRC
310** Completion 310* Editing
311I was using company, but I think it might've been causing issues with ~awk-mode~, so I'm trying ~hippie-mode~ right now. So far, I'm also enjoying not having a popup all the time. 311** Completion
312#+BEGIN_SRC emacs-lisp 312I was using company, but I think it might've been causing issues with ~awk-mode~, so I'm trying ~hippie-mode~ right now. So far, I'm also enjoying not having a popup all the time.
313 (bind-key "M-/" #'hippie-expand) 313#+BEGIN_SRC emacs-lisp
314#+END_SRC 314 (bind-key "M-/" #'hippie-expand)
315** Ignore case 315#+END_SRC
316#+BEGIN_SRC emacs-lisp 316** Ignore case
317 (cuss completion-ignore-case t) 317#+BEGIN_SRC emacs-lisp
318 (cuss read-buffer-completion-ignore-case t) 318 (cuss completion-ignore-case t)
319 (cuss read-file-name-completion-ignore-case t) 319 (cuss read-buffer-completion-ignore-case t)
320#+END_SRC 320 (cuss read-file-name-completion-ignore-case t)
321** Selection & Minibuffer 321#+END_SRC
322*** Selectrum and Prescient for narrowing selection 322** Selection & Minibuffer
323#+BEGIN_SRC emacs-lisp 323*** Selectrum and Prescient for narrowing selection
324 (use-package selectrum 324#+BEGIN_SRC emacs-lisp
325 :config 325 (use-package selectrum
326 (selectrum-mode +1)) 326 :config
327 327 (selectrum-mode +1))
328 (use-package prescient 328
329 :config 329 (use-package prescient
330 (prescient-persist-mode +1)) 330 :config
331 331 (prescient-persist-mode +1))
332 (use-package selectrum-prescient 332
333 :after (selectrum prescient) 333 (use-package selectrum-prescient
334 :config 334 :after (selectrum prescient)
335 (selectrum-prescient-mode +1)) 335 :config
336#+END_SRC 336 (selectrum-prescient-mode +1))
337*** CtrlF for searching 337#+END_SRC
338#+BEGIN_SRC emacs-lisp 338*** CtrlF for searching
339 (use-package ctrlf 339#+BEGIN_SRC emacs-lisp
340 :custom 340 (use-package ctrlf
341 (ctrlf-show-match-count-at-eol nil) 341 :custom
342 :config 342 (ctrlf-show-match-count-at-eol nil)
343 (ctrlf-mode +1)) 343 :config
344#+END_SRC 344 (ctrlf-mode +1))
345** Undo 345#+END_SRC
346#+BEGIN_SRC emacs-lisp 346** Undo
347 (use-package undo-fu 347#+BEGIN_SRC emacs-lisp
348 :bind 348 (use-package undo-fu
349 ("C-/" . undo-fu-only-undo) 349 :bind
350 ("C-?" . undo-fu-only-redo)) 350 ("C-/" . undo-fu-only-undo)
351 351 ("C-?" . undo-fu-only-redo))
352 (use-package undo-fu-session 352
353 :after no-littering 353 (use-package undo-fu-session
354 :custom 354 :after no-littering
355 (undo-fu-session-incompatible-files 355 :custom
356 '("/COMMIT_EDITMSG\\'" 356 (undo-fu-session-incompatible-files
357 "/git-rebase-todo\\'")) 357 '("/COMMIT_EDITMSG\\'"
358 (undo-fu-session-directory 358 "/git-rebase-todo\\'"))
359 (no-littering-expand-var-file-name "undos/")) 359 (undo-fu-session-directory
360 :config 360 (no-littering-expand-var-file-name "undos/"))
361 (global-undo-fu-session-mode +1)) 361 :config
362#+END_SRC 362 (global-undo-fu-session-mode +1))
363** Visual editing 363#+END_SRC
364*** ~zap-to-char~ replacement 364** Visual editing
365#+BEGIN_SRC emacs-lisp 365*** ~zap-to-char~ replacement
366 (use-package zop-to-char 366#+BEGIN_SRC emacs-lisp
367 :bind 367 (use-package zop-to-char
368 ([remap zap-to-char] . zop-to-char) 368 :bind
369 ([remap zap-up-to-char] . zop-up-to-char)) 369 ([remap zap-to-char] . zop-to-char)
370#+END_SRC 370 ([remap zap-up-to-char] . zop-up-to-char))
371*** Operate on a line if there's no current region 371#+END_SRC
372#+BEGIN_SRC emacs-lisp 372*** Operate on a line if there's no current region
373 (use-package whole-line-or-region 373#+BEGIN_SRC emacs-lisp
374 :config 374 (use-package whole-line-or-region
375 (whole-line-or-region-global-mode +1)) 375 :config
376#+END_SRC 376 (whole-line-or-region-global-mode +1))
377*** Expand-region 377#+END_SRC
378#+BEGIN_SRC emacs-lisp 378*** Expand-region
379 (use-package expand-region 379#+BEGIN_SRC emacs-lisp
380 :bind 380 (use-package expand-region
381 ("C-=" . er/expand-region) 381 :bind
382 ("C-+" . er/contract-region)) 382 ("C-=" . er/expand-region)
383#+END_SRC 383 ("C-+" . er/contract-region))
384*** Volatile highlights 384#+END_SRC
385#+BEGIN_SRC emacs-lisp 385*** Volatile highlights
386 (use-package volatile-highlights 386#+BEGIN_SRC emacs-lisp
387 :config 387 (use-package volatile-highlights
388 (volatile-highlights-mode 1)) 388 :config
389#+END_SRC 389 (volatile-highlights-mode 1))
390*** Visual line mode 390#+END_SRC
391#+BEGIN_SRC emacs-lisp 391*** Visual line mode
392 (global-visual-line-mode 1) 392#+BEGIN_SRC emacs-lisp
393#+END_SRC 393 (global-visual-line-mode 1)
394*** A better ~move-beginning-of-line~ 394#+END_SRC
395#+BEGIN_SRC emacs-lisp 395*** A better ~move-beginning-of-line~
396 (defun my/smarter-move-beginning-of-line (arg) 396#+BEGIN_SRC emacs-lisp
397 "Move point back to indentation of beginning of line. 397 (defun my/smarter-move-beginning-of-line (arg)
398 398 "Move point back to indentation of beginning of line.
399 Move point to the first non-whitespace character on this line. 399
400 If point is already there, move to the beginning of the line. 400 Move point to the first non-whitespace character on this line.
401 Effectively toggle between the first non-whitespace character and 401 If point is already there, move to the beginning of the line.
402 the beginning of the line. 402 Effectively toggle between the first non-whitespace character and
403 403 the beginning of the line.
404 If ARG is not nil or 1, move forward ARG - 1 lines first. If 404
405 point reaches the beginning or end of the buffer, stop there." 405 If ARG is not nil or 1, move forward ARG - 1 lines first. If
406 (interactive "^p") 406 point reaches the beginning or end of the buffer, stop there."
407 (setq arg (or arg 1)) 407 (interactive "^p")
408 408 (setq arg (or arg 1))
409 ;; Move lines first 409
410 (when (/= arg 1) 410 ;; Move lines first
411 (let ((line-move-visual nil)) 411 (when (/= arg 1)
412 (forward-line (1- arg)))) 412 (let ((line-move-visual nil))
413 413 (forward-line (1- arg))))
414 (let ((orig-point (point))) 414
415 (back-to-indentation) 415 (let ((orig-point (point)))
416 (when (= orig-point (point)) 416 (back-to-indentation)
417 (move-beginning-of-line 1)))) 417 (when (= orig-point (point))
418 418 (move-beginning-of-line 1))))
419 (bind-key "C-a" ; can't do [remap], don't know why 419
420 #'my/smarter-move-beginning-of-line) 420 (bind-key "C-a" ; can't do [remap], don't know why
421#+END_SRC 421 #'my/smarter-move-beginning-of-line)
422** Delete the selection when typing 422#+END_SRC
423#+BEGIN_SRC emacs-lisp 423** Delete the selection when typing
424 (delete-selection-mode 1) 424#+BEGIN_SRC emacs-lisp
425#+END_SRC 425 (delete-selection-mode 1)
426** Clipboard 426#+END_SRC
427#+BEGIN_SRC emacs-lisp 427** Clipboard
428 (cuss save-interprogram-paste-before-kill t) 428#+BEGIN_SRC emacs-lisp
429#+END_SRC 429 (cuss save-interprogram-paste-before-kill t)
430** Tabs & Spaces 430#+END_SRC
431#+BEGIN_SRC emacs-lisp 431** Tabs & Spaces
432 (cuss indent-tabs-mode nil) 432#+BEGIN_SRC emacs-lisp
433 (cuss sentence-end-double-space t) 433 (cuss indent-tabs-mode nil)
434#+END_SRC 434 (cuss sentence-end-double-space t)
435* Programming 435#+END_SRC
436** Git 436* Programming
437#+BEGIN_SRC emacs-lisp 437** Git
438 (use-package magit 438#+BEGIN_SRC emacs-lisp
439 :bind 439 (use-package magit
440 ("C-x g" . magit-status) 440 :bind
441 :config 441 ("C-x g" . magit-status)
442 (add-to-list 'magit-no-confirm 'stage-all-changes)) 442 :config
443 443 (add-to-list 'magit-no-confirm 'stage-all-changes))
444 ;; hook into `prescient' 444
445 (define-advice magit-list-refs 445 ;; hook into `prescient'
446 (:around (orig &optional namespaces format sortby) 446 (define-advice magit-list-refs
447 prescient-sort) 447 (:around (orig &optional namespaces format sortby)
448 "Apply prescient sorting when listing refs." 448 prescient-sort)
449 (let ((res (funcall orig namespaces format sortby))) 449 "Apply prescient sorting when listing refs."
450 (if (or sortby 450 (let ((res (funcall orig namespaces format sortby)))
451 magit-list-refs-sortby 451 (if (or sortby
452 (not selectrum-should-sort-p)) 452 magit-list-refs-sortby
453 res 453 (not selectrum-should-sort-p))
454 (prescient-sort res)))) 454 res
455 455 (prescient-sort res))))
456 (when (executable-find "cmake") 456
457 (use-package libgit) 457 (when (executable-find "cmake")
458 (use-package magit-libgit)) 458 (use-package libgit)
459 459 (use-package magit-libgit))
460 (use-package forge 460
461 :after magit 461 (use-package forge
462 :custom 462 :after magit
463 (forge-owned-accounts '(("duckwork")))) 463 :custom
464#+END_SRC 464 (forge-owned-accounts '(("duckwork"))))
465** Code formatting and display 465#+END_SRC
466#+BEGIN_SRC emacs-lisp 466** Code formatting and display
467 (use-package format-all 467#+BEGIN_SRC emacs-lisp
468 :hook 468 (use-package format-all
469 (prog-mode . format-all-mode)) 469 :hook
470 470 (prog-mode . format-all-mode))
471 (add-hook 'prog-mode-hook #'prettify-symbols-mode) 471
472 472 (add-hook 'prog-mode-hook #'prettify-symbols-mode)
473#+END_SRC 473
474*** Parentheses 474#+END_SRC
475#+BEGIN_SRC emacs-lisp 475*** Parentheses
476 (cuss show-paren-style 'mixed) 476#+BEGIN_SRC emacs-lisp
477 (show-paren-mode +1) 477 (cuss show-paren-style 'mixed)
478 478 (show-paren-mode +1)
479 (use-package smartparens 479
480 :init 480 (use-package smartparens
481 (defun acdw/setup-smartparens () 481 :init
482 (require 'smartparens-config) 482 (defun acdw/setup-smartparens ()
483 (smartparens-mode +1)) 483 (require 'smartparens-config)
484 :hook 484 (smartparens-mode +1))
485 (prog-mode . acdw/setup-smartparens)) 485 :hook
486 486 (prog-mode . acdw/setup-smartparens))
487 (use-package rainbow-delimiters 487
488 :hook 488 (use-package rainbow-delimiters
489 (prog-mode . rainbow-delimiters-mode)) 489 :hook
490#+END_SRC 490 (prog-mode . rainbow-delimiters-mode))
491** Line numbers 491#+END_SRC
492#+BEGIN_SRC emacs-lisp 492** Line numbers
493 (add-hook 'prog-mode-hook 493#+BEGIN_SRC emacs-lisp
494 (if (and (fboundp 'display-line-numbers-mode) 494 (add-hook 'prog-mode-hook
495 (display-graphic-p)) 495 (if (and (fboundp 'display-line-numbers-mode)
496 #'display-line-numbers-mode 496 (display-graphic-p))
497 #'linum-mode)) 497 #'display-line-numbers-mode
498#+END_SRC 498 #'linum-mode))
499** Languages 499#+END_SRC
500*** Lua 500** Languages
501#+BEGIN_SRC emacs-lisp 501*** Lua
502 (use-package lua-mode 502#+BEGIN_SRC emacs-lisp
503 :mode "\\.lua\\'" 503 (use-package lua-mode
504 :interpreter "lua") 504 :mode "\\.lua\\'"
505#+END_SRC 505 :interpreter "lua")
506*** Fennel 506#+END_SRC
507#+BEGIN_SRC emacs-lisp 507*** Fennel
508 (use-package fennel-mode 508#+BEGIN_SRC emacs-lisp
509 :mode "\\.fnl\\'") 509 (use-package fennel-mode
510#+END_SRC 510 :mode "\\.fnl\\'")
511*** Web 511#+END_SRC
512#+BEGIN_SRC emacs-lisp 512*** Web
513 (use-package web-mode 513#+BEGIN_SRC emacs-lisp
514 :custom 514 (use-package web-mode
515 (web-mode-markup-indent-offset 2) 515 :custom
516 (web-mode-code-indent-offset 2) 516 (web-mode-markup-indent-offset 2)
517 (web-mode-css-indent-offset 2) 517 (web-mode-code-indent-offset 2)
518 :mode (("\\.ts\\'" . web-mode) 518 (web-mode-css-indent-offset 2)
519 ("\\.html?\\'" . web-mode) 519 :mode (("\\.ts\\'" . web-mode)
520 ("\\.css?\\'" . web-mode) 520 ("\\.html?\\'" . web-mode)
521 ("\\.js\\'" . web-mode))) 521 ("\\.css?\\'" . web-mode)
522#+END_SRC 522 ("\\.js\\'" . web-mode)))
523* Writing 523#+END_SRC
524* Applications 524* Writing
525** Gemini & Gopher 525* Applications
526#+BEGIN_SRC emacs-lisp 526** Gemini & Gopher
527 (use-package elpher 527#+BEGIN_SRC emacs-lisp
528 :straight (elpher 528 (use-package elpher
529 :repo "git://thelambdalab.xyz/elpher.git") 529 :straight (elpher
530 :bind (:map elpher-mode-map 530 :repo "git://thelambdalab.xyz/elpher.git")
531 ("n" . elpher-next-link) 531 :bind (:map elpher-mode-map
532 ("p" . elpher-prev-link) 532 ("n" . elpher-next-link)
533 ("o" . elpher-follow-current-link) 533 ("p" . elpher-prev-link)
534 ("G" . elpher-go-current))) 534 ("o" . elpher-follow-current-link)
535 535 ("G" . elpher-go-current)))
536 (use-package gemini-mode 536
537 :straight (gemini-mode 537 (use-package gemini-mode
538 :repo "https://git.carcosa.net/jmcbray/gemini.el.git") 538 :straight (gemini-mode
539 :mode "\\.\\(gemini|gmi\\)\\'") 539 :repo "https://git.carcosa.net/jmcbray/gemini.el.git")
540 540 :mode "\\.\\(gemini|gmi\\)\\'")
541 (use-package gemini-write 541
542 :straight (gemini-write 542 (use-package gemini-write
543 :repo "https://alexschroeder.ch/cgit/gemini-write")) 543 :straight (gemini-write
544 544 :repo "https://alexschroeder.ch/cgit/gemini-write"))
545 545
546 (defun post-to-gemlog-blue (post-title user pass) 546 (use-package post-to-gemlog-blue
547 "Post current buffer to gemlog.blue." 547 :straight (post-to-gemlog-blue
548 (interactive 548 :repo "https://git.sr.ht/~acdw/post-to-gemlog-blue.el"))
549 (let* ((title-maybe (progn ;; TODO this is ... clunky 549#+END_SRC
550 (goto-char (point-min)) 550** Pastebin
551 (if (re-search-forward "^# \\(.*\\)" nil t) 551#+BEGIN_SRC emacs-lisp
552 (buffer-substring-no-properties 552 (use-package 0x0
553 (match-beginning 1) 553 :custom
554 (match-end 1)) 554 (0x0-default-service 'ttm))
555 ""))) 555#+END_SRC
556 (title (read-string
557 (format "Title%s: "
558 (if (string= "" title-maybe)
559 ""
560 (concat " (" title-maybe ")")))
561 nil nil title-maybe))
562 (user (read-string "User: " nil))
563 (pass (read-passwd "Pass: " nil)))
564 (list title user pass)))
565
566 (require 'mm-url)
567 (let ((url-request-method "POST")
568 (url-request-extra-headers
569 '(("Content-Type" . "application/x-www-form-urlencoded")))
570 (url-request-data
571 (mm-url-encode-www-form-urlencoded
572 `(("title" . ,post-title)
573 ("gemloguser" . ,user)
574 ("pw" . ,pass)
575 ("post" . ,(buffer-string))))))
576 (with-current-buffer
577 (url-retrieve-synchronously "https://gemlog.blue/post.php")
578 (goto-char (point-min))
579 (re-search-forward "\\(gemini://.*\\.gmi\\)")
580 (elpher-go (match-string 1)))))
581#+END_SRC
582** Pastebin
583#+BEGIN_SRC emacs-lisp
584 (use-package 0x0
585 :custom
586 (0x0-default-service 'ttm))
587#+END_SRC