diff options
-rw-r--r-- | config.org | 504 |
1 files changed, 379 insertions, 125 deletions
diff --git a/config.org b/config.org index b4e038c..19a5faa 100644 --- a/config.org +++ b/config.org | |||
@@ -49,16 +49,21 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
49 | 49 | ||
50 | ** Original init.el | 50 | ** Original init.el |
51 | 51 | ||
52 | #+begin_src emacs-lisp :tangle no | 52 | This file replaces itself with the actual configuration when it's first run. For easy installation, /this/ is the =init.el= file in git -- and you probably want to keep it that way. To keep git from trying to update =init.el= when it's re-tangled, type this in the repo: |
53 | ;; This file replaces itself with the actual configuration when | 53 | |
54 | ;; first run. To keep only this version in git, run this command: | 54 | #+begin_src sh :tangle no |
55 | ;; | 55 | git update-index --assume-unchanged init.el |
56 | ;; git update-index --assume-unchanged init.el | 56 | #+end_src |
57 | ;; | 57 | |
58 | ;; If it needs to be changed, start tracking it again thusly: | 58 | If, for some reason, you want to change this original file to be re-tracked, run this command: |
59 | ;; | 59 | |
60 | ;; git update-index --no-assume-unchanged init.el | 60 | #+begin_src sh :tangle no |
61 | git update-index --no-assume-unchanged init.el | ||
62 | #+end_src | ||
63 | |||
64 | Otherwise, here's the actual, original =init.el= that tangles this Org file and gets us going. | ||
61 | 65 | ||
66 | #+begin_src emacs-lisp :tangle no | ||
62 | (require 'org) | 67 | (require 'org) |
63 | (find-file (concat user-emacs-directory "config.org")) | 68 | (find-file (concat user-emacs-directory "config.org")) |
64 | (org-babel-tangle) | 69 | (org-babel-tangle) |
@@ -67,8 +72,14 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
67 | (byte-compile-file (concat user-emacs-directory "init.el")) | 72 | (byte-compile-file (concat user-emacs-directory "init.el")) |
68 | #+end_src | 73 | #+end_src |
69 | 74 | ||
75 | *** TODO What I should do instead | ||
76 | |||
77 | Honestly, I should just change this "Original init.el" thing to a Makefile I can tangle in =config.org=, and track -- since it won't be overwritten or need any special =git= invocations to stop tracking it, I can edit it as I think about what would work best. I could also maybe give it more of a "cross-platform" vibe by installing, say, =straight.el= in the Makefile on Windows. One day ... | ||
78 | |||
70 | ** Tangling | 79 | ** Tangling |
71 | 80 | ||
81 | After our first tangle, each time we edit =config.org= we want to go ahead and re-tangle our config. To that end, I've written ~acdw/tangle-init~, which automatically tangles =config.org=. | ||
82 | |||
72 | #+begin_src emacs-lisp | 83 | #+begin_src emacs-lisp |
73 | (defun acdw/tangle-init () | 84 | (defun acdw/tangle-init () |
74 | "If the current buffer is `config.org', tangle it, then compile | 85 | "If the current buffer is `config.org', tangle it, then compile |
@@ -88,9 +99,17 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
88 | (lambda (response) | 99 | (lambda (response) |
89 | (acdw/load-init) | 100 | (acdw/load-init) |
90 | (message "Tangled and loaded: %s" response))))) | 101 | (message "Tangled and loaded: %s" response))))) |
102 | #+end_src | ||
103 | |||
104 | Since I want to tangle every time I save =config.org=, I've added ~acdw/tangle-init~ to a hook. | ||
91 | 105 | ||
106 | #+begin_src emacs-lisp | ||
92 | (add-hook 'after-save-hook #'acdw/tangle-init) | 107 | (add-hook 'after-save-hook #'acdw/tangle-init) |
108 | #+end_src | ||
93 | 109 | ||
110 | Finally, I want an easier way to load the generated init files than the old =M-x load-file RET ~/.config/emacs/init.el RET=. So I've written ~acdw/load-init~ -- which also gets called at the end of the async part of ~acdw/tangle-init~. | ||
111 | |||
112 | #+begin_src emacs-lisp | ||
94 | (defun acdw/load-init () | 113 | (defun acdw/load-init () |
95 | (interactive) | 114 | (interactive) |
96 | (load-file (expand-file-name | 115 | (load-file (expand-file-name |
@@ -103,6 +122,8 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
103 | 122 | ||
104 | *** Add directories to =load-path= | 123 | *** Add directories to =load-path= |
105 | 124 | ||
125 | I also put lispy stuff in the =lisp/= subdirectory of my Emacs config, and under my SyncThing directory (for easy syncing ;P). | ||
126 | |||
106 | #+begin_src emacs-lisp | 127 | #+begin_src emacs-lisp |
107 | (dolist (dir `(,(concat user-emacs-directory | 128 | (dolist (dir `(,(concat user-emacs-directory |
108 | (convert-standard-filename "lisp/")) | 129 | (convert-standard-filename "lisp/")) |
@@ -111,7 +132,9 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
111 | 132 | ||
112 | #+end_src | 133 | #+end_src |
113 | 134 | ||
114 | *** Require my secrets | 135 | *** TODO Require my secrets |
136 | |||
137 | While this is like, the /dumbest/ way to do this, it's what I'm doing right now. I'm going to slap a TODO on here because I really should make it better -- like, =auth-sources= hooked into KeePassXC somehow... ? Maybe follow [[https://www.billdietrich.me/Authentication.html?expandall=1#KeePassXCandSecretService][Bill Dietrich's setup]]. | ||
115 | 138 | ||
116 | #+begin_src emacs-lisp | 139 | #+begin_src emacs-lisp |
117 | (require 'acdw-secrets) | 140 | (require 'acdw-secrets) |
@@ -119,6 +142,10 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
119 | 142 | ||
120 | * Early initiation | 143 | * Early initiation |
121 | 144 | ||
145 | Starting with version 27.1, Emacs loads =early-init.el= /before/ =init.el=, setting up early stuff like package management, etc. Since I use an alternative package manager, I have to bootstrap it here. | ||
146 | |||
147 | Of course, I also want to set some really early-on settings here too, like =load-prefer-newer= -- why not? | ||
148 | |||
122 | #+begin_src emacs-lisp :tangle early-init.el :comments no | 149 | #+begin_src emacs-lisp :tangle early-init.el :comments no |
123 | ;; early-init.el -*- lexical-binding: t; no-byte-compile: t -*- | 150 | ;; early-init.el -*- lexical-binding: t; no-byte-compile: t -*- |
124 | (setq load-prefer-newer t) | 151 | (setq load-prefer-newer t) |
@@ -126,6 +153,8 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
126 | 153 | ||
127 | ** Increase the garbage collector | 154 | ** Increase the garbage collector |
128 | 155 | ||
156 | Let's try to speed startup times by increasing the garbage collector's threshold while running init. Note the hook afterwards that restores it to a reasonable default. | ||
157 | |||
129 | #+begin_src emacs-lisp :tangle early-init.el | 158 | #+begin_src emacs-lisp :tangle early-init.el |
130 | (setq gc-cons-threshold (* 100 100 1000)) | 159 | (setq gc-cons-threshold (* 100 100 1000)) |
131 | 160 | ||
@@ -136,17 +165,31 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
136 | gc-cons-threshold))) | 165 | gc-cons-threshold))) |
137 | #+end_src | 166 | #+end_src |
138 | 167 | ||
139 | ** Add more paths to the =exec-path= when using Windows | 168 | ** Add more paths to the =exec-path= |
169 | |||
170 | When using Windows (at work), I need to use the PortableGit installation I've downloaded, since I don't have Admin privileges. | ||
140 | 171 | ||
141 | #+begin_src emacs-lisp :tangle early-init.el | 172 | #+begin_src emacs-lisp :tangle early-init.el |
142 | (when (eq system-type 'windows-nt) | 173 | (when (eq system-type 'windows-nt) |
143 | (dolist (path '("~/bin" | 174 | (dolist (path '("C:/Users/aduckworth/Downloads/PortableGit/bin" |
144 | "C:/Users/aduckworth/Downloads/PortableGit/bin" | ||
145 | "C:/Users/aduckworth/Downloads/PortableGit/usr/bin")) | 175 | "C:/Users/aduckworth/Downloads/PortableGit/usr/bin")) |
146 | (add-to-list 'exec-path path))) | 176 | (add-to-list 'exec-path path))) |
147 | #+end_src | 177 | #+end_src |
148 | 178 | ||
149 | ** Bootstrap =straight.el= | 179 | Elsewhere, I want to add a few more paths to the =exec-path= as well, since I store scripts in a couple of places at ~. |
180 | |||
181 | #+begin_src emacs-lisp :tangle early-init.el | ||
182 | (dolist (path '("~/bin" | ||
183 | "~/.local/bin" | ||
184 | "~/Scripts")) | ||
185 | (add-to-list 'exec-path path)) | ||
186 | #+end_src | ||
187 | |||
188 | ** Bootstrap [[https://github.com/raxod502/straight.el][straight.el]] | ||
189 | |||
190 | So far, this is the best package manager I've used. It allows for /truly/ declarative package management (if I don't specify a package here, it doesn't get loaded), easy installation from pretty much any source (as long as it's got a git repo), /and/ it hooks into =use-package=! | ||
191 | |||
192 | The one annoying thing is that this bootstrap code doesn't work on Windows for some reason. I'm too lazy to really try and figure out why, so when I need to bootstrap on Windows (pretty rare, TBH), I just [[https://github.com/raxod502/straight.el/archive/master.zip][download the master-branch zip file]] and extract it to =~/.emacs.d/straight/repos/=. | ||
150 | 193 | ||
151 | #+begin_src emacs-lisp :tangle early-init.el | 194 | #+begin_src emacs-lisp :tangle early-init.el |
152 | (defvar bootstrap-version) | 195 | (defvar bootstrap-version) |
@@ -164,14 +207,18 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
164 | (load bootstrap-file nil 'nomessage)) | 207 | (load bootstrap-file nil 'nomessage)) |
165 | #+end_src | 208 | #+end_src |
166 | 209 | ||
167 | ** Use =use-package= | 210 | ** Use [[https://jwiegley.github.io/use-package/][use-package]] |
211 | |||
212 | Like I said, =straight.el= hooks into =use-package= easily. These two lines get the latter to use the former by default. | ||
168 | 213 | ||
169 | #+begin_src emacs-lisp :tangle early-init.el | 214 | #+begin_src emacs-lisp :tangle early-init.el |
170 | (setq straight-use-package-by-default t) | 215 | (setq straight-use-package-by-default t) |
171 | (straight-use-package 'use-package) | 216 | (straight-use-package 'use-package) |
172 | #+end_src | 217 | #+end_src |
173 | 218 | ||
174 | ** Keep =~/.emacs.d= tidy | 219 | ** Keep =~/.emacs.d= tidy with [[https://github.com/emacscollective/no-littering][no-littering]] |
220 | |||
221 | I'll be honest -- I don't really notice this package. But I think that's the point. It keeps Emacs (and packages) from throwing files all over the place, so I have a clean =ls -l=. Since I want to run this code as early as possible, I use the =straight-use-package= form instead of =use-package=. | ||
175 | 222 | ||
176 | #+begin_src emacs-lisp | 223 | #+begin_src emacs-lisp |
177 | (straight-use-package 'no-littering) | 224 | (straight-use-package 'no-littering) |
@@ -180,7 +227,25 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
180 | 227 | ||
181 | ** Additional =use-package= keywords | 228 | ** Additional =use-package= keywords |
182 | 229 | ||
183 | *** =:custom-update= | 230 | *** [[https://github.com/a13/use-package-custom-update][:custom-update]] |
231 | |||
232 | The =:custom-update= keyword lets me do this: | ||
233 | |||
234 | #+begin_src emacs-lisp :tangle no | ||
235 | (use-package package | ||
236 | :custom-update | ||
237 | (package-list '(1 2 3))) | ||
238 | #+end_src | ||
239 | |||
240 | instead of this: | ||
241 | |||
242 | #+begin_src emacs-lisp :tangle no | ||
243 | (use-package package | ||
244 | :config | ||
245 | (add-to-list 'package-list '(1 2 3))) | ||
246 | #+end_src | ||
247 | |||
248 | It's not ... perfect, but it's kind of nice. | ||
184 | 249 | ||
185 | #+begin_src emacs-lisp | 250 | #+begin_src emacs-lisp |
186 | (use-package use-package-custom-update | 251 | (use-package use-package-custom-update |
@@ -189,7 +254,9 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
189 | :repo "a13/use-package-custom-update")) | 254 | :repo "a13/use-package-custom-update")) |
190 | #+end_src | 255 | #+end_src |
191 | 256 | ||
192 | ** Setup async | 257 | ** Setup [[https://github.com/jwiegley/emacs-async][async]] |
258 | |||
259 | I thought this was included in Emacs at first, but it's not -- so we need to install and require it. | ||
193 | 260 | ||
194 | #+begin_src emacs-lisp :tangle early-init.el | 261 | #+begin_src emacs-lisp :tangle early-init.el |
195 | (straight-use-package 'async) | 262 | (straight-use-package 'async) |
@@ -200,6 +267,10 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
200 | 267 | ||
201 | ** Customizing variables | 268 | ** Customizing variables |
202 | 269 | ||
270 | I like =use-package= a lot, but I don't like using those shims you see in a lot of other Emacs configs where they use ~(use-package emacs)~ forms and stuff like that -- it just feels dirty. Plus, =straight= gets confused about those packages sometimes. So, since I'm actually /configuring/ Emacs in this Org file, which is nicely organized anyway, I can just set settings the old-school way. | ||
271 | |||
272 | Except. Using =setq= is actually /not/ recommended any more, because =customize-set-variable= is more expressive and can include side-effects. However, not all settings are customizable, /and/ =customize-set-variable= is like, way longer to type. So I've decided to write a little macro (my first!) to copy =use-package='s =:custom= keyword, except ... /outside/ =use-package=. I've called it =cuss=, because I have a terrible sense of humor. | ||
273 | |||
203 | #+begin_src emacs-lisp | 274 | #+begin_src emacs-lisp |
204 | (defmacro cuss (var val) | 275 | (defmacro cuss (var val) |
205 | "Basically `use-package''s `:custom', but without using either." | 276 | "Basically `use-package''s `:custom', but without using either." |
@@ -208,9 +279,11 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
208 | ',var ,val))) | 279 | ',var ,val))) |
209 | #+end_src | 280 | #+end_src |
210 | 281 | ||
211 | * Theme | 282 | * Theme: [[https://protesilaos.com/modus-themes/][Modus]] |
212 | 283 | ||
213 | I'm using the [[https://protesilaos.com/modus-themes/][Modus]] themes. | 284 | Protesilaos Stavrou's /excellent/ theme pair. At some point I'll probably write my own that's really minimal and does some funky stuff with faces, but until then, these really are the best I've used. |
285 | |||
286 | The big ~dolist~ form is from [[https://protesilaos.com/modus-themes/#h:a897b302-8e10-4a26-beab-3caaee1e1193][his documentation]]; it basically allows me to configure both themes before loading them. I've tweaked his code a little to use =use-package=. | ||
214 | 287 | ||
215 | #+begin_src emacs-lisp | 288 | #+begin_src emacs-lisp |
216 | (defmacro modus-themes-format-sexp (sexp &rest objects) | 289 | (defmacro modus-themes-format-sexp (sexp &rest objects) |
@@ -219,37 +292,39 @@ I'm using the [[https://protesilaos.com/modus-themes/][Modus]] themes. | |||
219 | (dolist (theme '("operandi" "vivendi")) | 292 | (dolist (theme '("operandi" "vivendi")) |
220 | (modus-themes-format-sexp | 293 | (modus-themes-format-sexp |
221 | (use-package modus-%1$s-theme | 294 | (use-package modus-%1$s-theme |
222 | :init | 295 | :custom |
223 | (setq modus-%1$s-theme-slanted-constructs t | 296 | (modus-%1$s-theme-slanted-constructs t) |
224 | modus-%1$s-theme-bold-constructs t | 297 | (modus-%1$s-theme-bold-constructs t) |
225 | modus-%1$s-theme-fringes 'subtle | 298 | (modus-%1$s-theme-fringes 'subtle) |
226 | modus-%1$s-theme-mode-line '3d | 299 | (modus-%1$s-theme-mode-line '3d) |
227 | modus-%1$s-theme-syntax 'yellow-comments | 300 | (modus-%1$s-theme-syntax 'yellow-comments) |
228 | modus-%1$s-theme-intense-hl-line nil | 301 | (modus-%1$s-theme-intense-hl-line nil) |
229 | modus-%1$s-theme-intense-paren-match t | 302 | (modus-%1$s-theme-intense-paren-match t) |
230 | modus-%1$s-theme-links nil | 303 | (modus-%1$s-theme-links nil) |
231 | modus-%1$s-theme-no-mixed-fonts nil | 304 | (modus-%1$s-theme-no-mixed-fonts nil) |
232 | modus-%1$s-theme-prompts nil | 305 | (modus-%1$s-theme-prompts nil) |
233 | modus-%1$s-theme-completions nil | 306 | (modus-%1$s-theme-completions nil) |
234 | modus-%1$s-theme-diffs nil | 307 | (modus-%1$s-theme-diffs nil) |
235 | modus-%1$s-theme-org-blocks 'grayscale | 308 | (modus-%1$s-theme-org-blocks 'grayscale) |
236 | modus-%1$s-theme-headings | 309 | (modus-%1$s-theme-headings |
237 | '((1 . section) | 310 | '((1 . section) |
238 | (2 . line) | 311 | (2 . line) |
239 | (t . rainbow-line-no-bold)) | 312 | (t . rainbow-line-no-bold))) |
240 | modus-%1$s-theme-variable-pitch-headings nil | 313 | (modus-%1$s-theme-variable-pitch-headings nil) |
241 | modus-%1$s-theme-scale-headings t | 314 | (modus-%1$s-theme-scale-headings t) |
242 | modus-%1$s-theme-scale-1 1.1 | 315 | (modus-%1$s-theme-scale-1 1.1) |
243 | modus-%1$s-theme-scale-2 1.15 | 316 | (modus-%1$s-theme-scale-2 1.15) |
244 | modus-%1$s-theme-scale-3 1.21 | 317 | (modus-%1$s-theme-scale-3 1.21) |
245 | modus-%1$s-theme-scale-4 1.27 | 318 | (modus-%1$s-theme-scale-4 1.27) |
246 | modus-%1$s-theme-scale-5 1.33)) | 319 | (modus-%1$s-theme-scale-5 1.33) |
247 | :custom-face | 320 | :custom-face |
248 | (font-lock-comment-face | 321 | (font-lock-comment-face |
249 | ((t (:inherit (custom-comment italic variable-pitch)))))) | 322 | ((t (:inherit (custom-comment italic variable-pitch)))))) |
250 | theme)) | 323 | theme)) |
251 | #+end_src | 324 | #+end_src |
252 | 325 | ||
326 | ** Theme changer | ||
327 | |||
253 | I also want to switch themes between night and day. | 328 | I also want to switch themes between night and day. |
254 | 329 | ||
255 | #+begin_src emacs-lisp | 330 | #+begin_src emacs-lisp |
@@ -265,6 +340,8 @@ I also want to switch themes between night and day. | |||
265 | 340 | ||
266 | ** Frame defaults | 341 | ** Frame defaults |
267 | 342 | ||
343 | I want no toolbar, menubar, or scrollbars (ideally I'd have a vertical scrollbar if necessary, but apparently that's too much to ask the Emacs devs); and fringes and window dividers 2 pixels wide. | ||
344 | |||
268 | #+begin_src emacs-lisp | 345 | #+begin_src emacs-lisp |
269 | (cuss default-frame-alist | 346 | (cuss default-frame-alist |
270 | '((tool-bar-lines . 0) | 347 | '((tool-bar-lines . 0) |
@@ -279,6 +356,8 @@ I also want to switch themes between night and day. | |||
279 | 356 | ||
280 | ** Minibuffer window/frame defaults | 357 | ** Minibuffer window/frame defaults |
281 | 358 | ||
359 | Of course, on the minibuffer, I want to make sure there's no scrollbar -- even if I change my mind on =vertical-scroll-bars=, above. | ||
360 | |||
282 | #+begin_src emacs-lisp | 361 | #+begin_src emacs-lisp |
283 | (cuss minibuffer-frame-alist | 362 | (cuss minibuffer-frame-alist |
284 | '((width . 80) | 363 | '((width . 80) |
@@ -290,6 +369,8 @@ I also want to switch themes between night and day. | |||
290 | 369 | ||
291 | ** Remove unneeded GUI elements | 370 | ** Remove unneeded GUI elements |
292 | 371 | ||
372 | The [[*Frame defaults][Frame Defaults]] section sets up the frame to be free of visual clutter, but /this/ section allows us to toggle that clutter's visibility easily, with one call to each of these functions. | ||
373 | |||
293 | #+begin_src emacs-lisp | 374 | #+begin_src emacs-lisp |
294 | (menu-bar-mode -1) | 375 | (menu-bar-mode -1) |
295 | (tool-bar-mode -1) | 376 | (tool-bar-mode -1) |
@@ -299,19 +380,31 @@ I also want to switch themes between night and day. | |||
299 | 380 | ||
300 | ** Word wrap and operate visually | 381 | ** Word wrap and operate visually |
301 | 382 | ||
383 | =global-visual-line-mode= is one of those which, in my opinion, should be a default. There's only one place I don't want to wrap words, and that's in =dired=, which I can set individually in its config. | ||
384 | |||
302 | #+begin_src emacs-lisp | 385 | #+begin_src emacs-lisp |
303 | (global-visual-line-mode 1) | 386 | (global-visual-line-mode 1) |
304 | #+end_src | 387 | #+end_src |
305 | 388 | ||
306 | ** Modeline | 389 | ** Modeline |
307 | 390 | ||
391 | *** [[https://github.com/Malabarba/smart-mode-line][smart-mode-line]] | ||
392 | |||
308 | #+begin_src emacs-lisp | 393 | #+begin_src emacs-lisp |
309 | (use-package smart-mode-line | 394 | (use-package smart-mode-line |
310 | :custom | 395 | :custom |
311 | (sml/no-confirm-load-theme t) | 396 | (sml/no-confirm-load-theme t) |
312 | :config | 397 | :config |
313 | (sml/setup)) | 398 | (sml/setup)) |
399 | #+end_src | ||
400 | |||
401 | *** [[https://github.com/Malabarba/rich-minority][rich-minority]] | ||
402 | |||
403 | =smart-mode-line= comes with =rich-minority= for taking care of minor modes in the modeline, so I'm not going to /also/ use =diminish= or anything. However, =rich-minority= has kind of a hinky way of adding modes to the whitelist, so I had to write my own function to do so. | ||
314 | 404 | ||
405 | This confuration means that, by default, no minor modes are shown; if you want a minor mode to be shown (like =word-count-mode= for me), call ~(rm/whitelist-add "REGEXP")~. | ||
406 | |||
407 | #+begin_src emacs-lisp | ||
315 | (defun rm/whitelist-add (regexp) | 408 | (defun rm/whitelist-add (regexp) |
316 | "Add a REGEXP to the whitelist for `rich-minority'." | 409 | "Add a REGEXP to the whitelist for `rich-minority'." |
317 | (if (listp 'rm--whitelist-regexps) | 410 | (if (listp 'rm--whitelist-regexps) |
@@ -338,6 +431,8 @@ from [[http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html][Ergo Emac | |||
338 | 431 | ||
339 | ** Show =^L= as a line | 432 | ** Show =^L= as a line |
340 | 433 | ||
434 | I like using the form-feed character to separate pages, it turns out. 'Tis nice. This package turns that character into a nice long line. | ||
435 | |||
341 | #+begin_src emacs-lisp | 436 | #+begin_src emacs-lisp |
342 | (use-package form-feed | 437 | (use-package form-feed |
343 | :hook | 438 | :hook |
@@ -346,6 +441,8 @@ from [[http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html][Ergo Emac | |||
346 | 441 | ||
347 | ** Cursor | 442 | ** Cursor |
348 | 443 | ||
444 | I want my cursor to be a bar in focused windows, but a hollow box in non-focused windows. | ||
445 | |||
349 | #+begin_src emacs-lisp | 446 | #+begin_src emacs-lisp |
350 | (cuss cursor-type 'bar) | 447 | (cuss cursor-type 'bar) |
351 | (cuss cursor-in-non-selected-windows 'hollow) | 448 | (cuss cursor-in-non-selected-windows 'hollow) |
@@ -353,6 +450,8 @@ from [[http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html][Ergo Emac | |||
353 | 450 | ||
354 | * Fonts | 451 | * Fonts |
355 | 452 | ||
453 | This is the best way I've come up with to specify a number of different fonts that apply depending on what's applied. To be honest, I didn't really come up with the =font-candidate= function, though -- I got it from the [[https://www.emacswiki.org/emacs/SetFonts#toc11]["Testing if fonts are available?"]] section of the SetFonts page on EmacsWiki. | ||
454 | |||
356 | See [[https://emacs.stackexchange.com/questions/12351/when-to-call-find-font-if-launching-emacs-in-daemon-mode][this StackExchange question and answer]] for more information on why I have these font settings applied in a hook. | 455 | See [[https://emacs.stackexchange.com/questions/12351/when-to-call-find-font-if-launching-emacs-in-daemon-mode][this StackExchange question and answer]] for more information on why I have these font settings applied in a hook. |
357 | 456 | ||
358 | #+begin_src emacs-lisp | 457 | #+begin_src emacs-lisp |
@@ -395,7 +494,9 @@ See [[https://emacs.stackexchange.com/questions/12351/when-to-call-find-font-if- | |||
395 | (add-hook 'focus-in-hook #'acdw/setup-fonts) | 494 | (add-hook 'focus-in-hook #'acdw/setup-fonts) |
396 | #+end_src | 495 | #+end_src |
397 | 496 | ||
398 | ** Unicode | 497 | ** [[https://github.com/rolandwalker/unicode-fonts][unicode-fonts]] |
498 | |||
499 | This does something similar to the above code, but for the entirety of the Unicode field (I think). | ||
399 | 500 | ||
400 | #+begin_src emacs-lisp | 501 | #+begin_src emacs-lisp |
401 | (use-package unicode-fonts | 502 | (use-package unicode-fonts |
@@ -405,19 +506,44 @@ See [[https://emacs.stackexchange.com/questions/12351/when-to-call-find-font-if- | |||
405 | 506 | ||
406 | ** Variable pitch faces | 507 | ** Variable pitch faces |
407 | 508 | ||
509 | One reason I like the Modus themes so much is that they have /excellent/ support for variable-pitch faces, and mixing them with fixed-pitch faces in, say, Org Mode. That means I can enable =variable-pitch-mode= in all my =text-mode=-derived buffers. | ||
510 | |||
408 | #+begin_src emacs-lisp | 511 | #+begin_src emacs-lisp |
409 | (add-hook 'text-mode-hook #'variable-pitch-mode) | 512 | (add-hook 'text-mode-hook #'variable-pitch-mode) |
410 | #+end_src | 513 | #+end_src |
411 | 514 | ||
412 | * Ease of use | 515 | * Ease of use |
413 | 516 | ||
414 | ** Selectrum & Prescient | 517 | ** Startup |
518 | |||
519 | I want a minimal screen when I start Emacs. Based on the beauty of configs like [[https://github.com/rougier/elegant-emacs][Nicolas Rougier's]] [[https://github.com/rougier/emacs-splash][splash screen]] [[https://github.com/rougier/nano-emacs][experiments]], I might try my hand at some kind of splash screen or dashboard -- but until then, a simple "Hi there!" will suffice 😎 | ||
520 | |||
521 | #+begin_src emacs-lisp | ||
522 | (cuss inhibit-startup-buffer-menu t) | ||
523 | (cuss inhibit-startup-screen t) | ||
524 | (cuss initial-buffer-choice t) | ||
525 | (cuss initial-scratch-message ";; Hi there!\n") | ||
526 | #+end_src | ||
527 | |||
528 | ** Completing-read niceties | ||
529 | |||
530 | =completing-read= is Emacs's selection-narrowing-slash-completion framework thing. There's a bunch of packages for it, including =ido=, =icomplete=, =ivy=, and =helm=. I use raxod52's =selectrum= and others, which /extend/ without /clobbering/ existing Emacs functionality. Plus they seem to run faster, at least on Windows. | ||
531 | |||
532 | *** [[https://github.com/raxod502/selectrum][selectrum]] | ||
533 | |||
534 | =selectrum= is the basic /sorting and selecting items from a list/ functionality. It's a drop-in replacement for =ido= or the really basic tab-completion Emacs has for, say, =find-file=. | ||
415 | 535 | ||
416 | #+begin_src emacs-lisp | 536 | #+begin_src emacs-lisp |
417 | (use-package selectrum | 537 | (use-package selectrum |
418 | :config | 538 | :config |
419 | (selectrum-mode 1)) | 539 | (selectrum-mode 1)) |
540 | #+end_src | ||
420 | 541 | ||
542 | *** [[https://github.com/raxod502/prescient.el][prescient]] | ||
543 | |||
544 | =prescient= helps =selectrum= be more intelligent about sorting the candidates in a list -- it's in charge of the /filtering and sorting/ bit of =completing-read= and friends. It has an algorithm that works well enough for me, though I keep hearing about [[https://github.com/oantolin/orderless][orderless]], enough to maybe try it as well sometime. | ||
545 | |||
546 | #+begin_src emacs-lisp | ||
421 | (use-package prescient | 547 | (use-package prescient |
422 | :config | 548 | :config |
423 | (prescient-persist-mode 1)) | 549 | (prescient-persist-mode 1)) |
@@ -428,7 +554,6 @@ See [[https://emacs.stackexchange.com/questions/12351/when-to-call-find-font-if- | |||
428 | (selectrum-prescient-mode 1)) | 554 | (selectrum-prescient-mode 1)) |
429 | #+end_src | 555 | #+end_src |
430 | 556 | ||
431 | ** CtrlF | ||
432 | *** [[https://github.com/minad/cconsult][consult]] | 557 | *** [[https://github.com/minad/cconsult][consult]] |
433 | 558 | ||
434 | =consult= is the newest package I have with this setup, and it kind of brings the =selectrum= experience up to par with =ivy='s -- it provides functions that list, say, recently used files /alongside/ buffers, allow you to search lines and go to them, etc. It seems pretty nice so far. | 559 | =consult= is the newest package I have with this setup, and it kind of brings the =selectrum= experience up to par with =ivy='s -- it provides functions that list, say, recently used files /alongside/ buffers, allow you to search lines and go to them, etc. It seems pretty nice so far. |
@@ -456,6 +581,19 @@ By the way, the [[https://www.reddit.com/r/emacs/comments/k3c0u7][Reddit announc | |||
456 | #'consult-annotate-command-full)) | 581 | #'consult-annotate-command-full)) |
457 | #+end_src | 582 | #+end_src |
458 | 583 | ||
584 | *** Ignore case | ||
585 | |||
586 | I don't like holding the Shift key if I can help it. | ||
587 | |||
588 | #+BEGIN_SRC emacs-lisp | ||
589 | (cuss completion-ignore-case t) | ||
590 | (cuss read-buffer-completion-ignore-case t) | ||
591 | (cuss read-file-name-completion-ignore-case t) | ||
592 | #+END_SRC | ||
593 | |||
594 | ** [[https://github.com/raxod502/ctrlf][ctrlf]] | ||
595 | |||
596 | The biggest reason I use this over the default functionality of =C-s= is that =ctrlf-forward-*= wraps the search around by default. | ||
459 | 597 | ||
460 | #+begin_src emacs-lisp | 598 | #+begin_src emacs-lisp |
461 | (use-package ctrlf | 599 | (use-package ctrlf |
@@ -470,24 +608,9 @@ By the way, the [[https://www.reddit.com/r/emacs/comments/k3c0u7][Reddit announc | |||
470 | (ctrlf-mode 1)) | 608 | (ctrlf-mode 1)) |
471 | #+end_src | 609 | #+end_src |
472 | 610 | ||
473 | ** Startup | 611 | ** [[https://github.com/justbur/emacs-which-key][which-key]] |
474 | 612 | ||
475 | #+begin_src emacs-lisp | 613 | This package is really helpful for discovering functionality. When I get more adept in my Emacs-fu, I might remove this. |
476 | (cuss inhibit-startup-buffer-menu t) | ||
477 | (cuss inhibit-startup-screen t) | ||
478 | (cuss initial-buffer-choice t) | ||
479 | (cuss initial-scratch-message ";; Hi there!\n") | ||
480 | #+end_src | ||
481 | |||
482 | ** Ignore case | ||
483 | |||
484 | #+BEGIN_SRC emacs-lisp | ||
485 | (cuss completion-ignore-case t) | ||
486 | (cuss read-buffer-completion-ignore-case t) | ||
487 | (cuss read-file-name-completion-ignore-case t) | ||
488 | #+END_SRC | ||
489 | |||
490 | ** Which key | ||
491 | 614 | ||
492 | #+begin_src emacs-lisp | 615 | #+begin_src emacs-lisp |
493 | (use-package which-key | 616 | (use-package which-key |
@@ -499,7 +622,11 @@ By the way, the [[https://www.reddit.com/r/emacs/comments/k3c0u7][Reddit announc | |||
499 | 622 | ||
500 | ** Miscellaneous settings | 623 | ** Miscellaneous settings |
501 | 624 | ||
502 | *** Set view mode when in a read-only file | 625 | Maybe a better title for this section is *Other settings* -- or maybe I should put them somewhere else entirely. |
626 | |||
627 | *** Set =view-mode= when in a read-only file | ||
628 | |||
629 | =view-mode= gives easy-to-use keybindings, like Space for page-down, etc., which are nice to have when you can't edit the file anyway. | ||
503 | 630 | ||
504 | #+begin_src emacs-lisp | 631 | #+begin_src emacs-lisp |
505 | (cuss view-read-only t) | 632 | (cuss view-read-only t) |
@@ -513,18 +640,24 @@ By the way, the [[https://www.reddit.com/r/emacs/comments/k3c0u7][Reddit announc | |||
513 | 640 | ||
514 | *** Enable all functions | 641 | *** Enable all functions |
515 | 642 | ||
643 | By default, Emacs disables some commands, because NeWbIeS wOuLd GeT cOnFuSeD or some ish. I just want to use the dang editor! | ||
644 | |||
516 | #+begin_src emacs-lisp | 645 | #+begin_src emacs-lisp |
517 | (cuss disabled-command-function nil) | 646 | (cuss disabled-command-function nil) |
518 | #+end_src | 647 | #+end_src |
519 | 648 | ||
520 | *** Shorter confirmations | 649 | *** Shorter confirmations |
521 | 650 | ||
651 | Instead of making me type /yes/ or /no/, just let me hit the /y/ or /n/ key. | ||
652 | |||
522 | #+begin_src emacs-lisp | 653 | #+begin_src emacs-lisp |
523 | (fset 'yes-or-no-p #'y-or-n-p) | 654 | (fset 'yes-or-no-p #'y-or-n-p) |
524 | #+end_src | 655 | #+end_src |
525 | 656 | ||
526 | *** Uniquify buffer names | 657 | *** Uniquify buffer names |
527 | 658 | ||
659 | This names buffers with the same basename (e.g., =~/.config/emacs/config.org= and =~/.emacs.d/config.org=) in a better way than the default (=config.org<1>=, etc). | ||
660 | |||
528 | #+begin_src emacs-lisp | 661 | #+begin_src emacs-lisp |
529 | (require 'uniquify) | 662 | (require 'uniquify) |
530 | (cuss uniquify-buffer-name-style 'forward) | 663 | (cuss uniquify-buffer-name-style 'forward) |
@@ -532,6 +665,8 @@ By the way, the [[https://www.reddit.com/r/emacs/comments/k3c0u7][Reddit announc | |||
532 | 665 | ||
533 | *** Show buffer boundaries | 666 | *** Show buffer boundaries |
534 | 667 | ||
668 | These little L-shaped graphics at the top and bottom of buffers don't do anything, but I like 'em. | ||
669 | |||
535 | #+begin_src emacs-lisp | 670 | #+begin_src emacs-lisp |
536 | (cuss indicate-buffer-boundaries | 671 | (cuss indicate-buffer-boundaries |
537 | '((top . right) | 672 | '((top . right) |
@@ -541,17 +676,28 @@ By the way, the [[https://www.reddit.com/r/emacs/comments/k3c0u7][Reddit announc | |||
541 | 676 | ||
542 | *** Hippie expand | 677 | *** Hippie expand |
543 | 678 | ||
679 | At some point, will probably replace with [[https://company-mode.github.io/][company]]. | ||
680 | |||
544 | #+begin_src emacs-lisp | 681 | #+begin_src emacs-lisp |
545 | (global-set-key (kbd "M-/") 'hippie-expand) | 682 | (global-set-key (kbd "M-/") 'hippie-expand) |
546 | #+end_src | 683 | #+end_src |
547 | 684 | ||
548 | *** iBuffer | 685 | *** "[[https://git.sr.ht/~technomancy/better-defaults/tree/master/better-defaults.el][better defaults]]" |
686 | |||
687 | Most of these come from technomancy's repo, linked above, just copy-pasted into here. | ||
549 | 688 | ||
550 | #+begin_src emacs-lisp | 689 | #+begin_src emacs-lisp |
551 | (global-set-key (kbd "C-x C-b") 'ibuffer) | 690 | (cuss save-interprogram-paste-before-kill t) |
691 | (cuss apropos-do-all t) | ||
692 | (cuss mouse-yank-at-point t) | ||
693 | (cuss require-final-newline t) | ||
694 | (cuss visible-bell (not (string= (system-name) "larry"))) | ||
695 | (cuss ediff-window-setup-function #'ediff-setup-windows-plain) | ||
552 | #+end_src | 696 | #+end_src |
553 | 697 | ||
554 | *** Zap-up-to-char, not zap-to-char | 698 | **** Zap-up-to-char, not zap-to-char |
699 | |||
700 | Similarly to =ibuffer=, this is a Better default™. | ||
555 | 701 | ||
556 | #+begin_src emacs-lisp | 702 | #+begin_src emacs-lisp |
557 | (autoload 'zap-up-to-char "misc" | 703 | (autoload 'zap-up-to-char "misc" |
@@ -560,19 +706,18 @@ By the way, the [[https://www.reddit.com/r/emacs/comments/k3c0u7][Reddit announc | |||
560 | (global-set-key (kbd "M-z") 'zap-up-to-char) | 706 | (global-set-key (kbd "M-z") 'zap-up-to-char) |
561 | #+end_src | 707 | #+end_src |
562 | 708 | ||
563 | *** Other "[[https://git.sr.ht/~technomancy/better-defaults/tree/master/better-defaults.el][better defaults]]" | 709 | **** iBuffer |
710 | |||
711 | A Better Default™ for =C-x C-b=. I don't really use this, but everyone says it's worth it, so it's there. | ||
564 | 712 | ||
565 | #+begin_src emacs-lisp | 713 | #+begin_src emacs-lisp |
566 | (cuss save-interprogram-paste-before-kill t) | 714 | (global-set-key (kbd "C-x C-b") 'ibuffer) |
567 | (cuss apropos-do-all t) | ||
568 | (cuss mouse-yank-at-point t) | ||
569 | (cuss require-final-newline t) | ||
570 | (cuss visible-bell (not (string= (system-name) "larry"))) | ||
571 | (cuss ediff-window-setup-function #'ediff-setup-windows-plain) | ||
572 | #+end_src | 715 | #+end_src |
573 | 716 | ||
574 | *** So-long-mode | 717 | *** So-long-mode |
575 | 718 | ||
719 | I figure, why not go ahead and make Emacs deal with really long lines better? Can't hurt, right? | ||
720 | |||
576 | #+begin_src emacs-lisp | 721 | #+begin_src emacs-lisp |
577 | (if (boundp 'global-so-long-mode) | 722 | (if (boundp 'global-so-long-mode) |
578 | (global-so-long-mode)) | 723 | (global-so-long-mode)) |
@@ -580,6 +725,8 @@ By the way, the [[https://www.reddit.com/r/emacs/comments/k3c0u7][Reddit announc | |||
580 | 725 | ||
581 | *** Change =just-one-space= to =cycle-space= | 726 | *** Change =just-one-space= to =cycle-space= |
582 | 727 | ||
728 | I keep forgetting to actually /use/ this keybind (I think it's =M-SPC=?), but cycling spacing seems /way/ more useful than the default =just-one-space= function. | ||
729 | |||
583 | #+begin_src emacs-lisp | 730 | #+begin_src emacs-lisp |
584 | (defun acdw/cycle-spacing-1 () | 731 | (defun acdw/cycle-spacing-1 () |
585 | (interactive) | 732 | (interactive) |
@@ -590,7 +737,11 @@ By the way, the [[https://www.reddit.com/r/emacs/comments/k3c0u7][Reddit announc | |||
590 | 737 | ||
591 | * Persistence | 738 | * Persistence |
592 | 739 | ||
593 | ** Auto-saves | 740 | Honestly, persistence across sessions was one of the best things about my well-tuned Vim setup. Here's where I try to repeat that with Emacs. |
741 | |||
742 | ** Auto-saves with [[https://github.com/bbatsov/super-save][super-save]] | ||
743 | |||
744 | The default =auto-save= functionality isn't ... /enough/ for me. I want to /actually/ save the files, and I don't care about =#file#= stuff. So ... I use this package. | ||
594 | 745 | ||
595 | #+begin_src emacs-lisp | 746 | #+begin_src emacs-lisp |
596 | (use-package super-save | 747 | (use-package super-save |
@@ -603,6 +754,8 @@ By the way, the [[https://www.reddit.com/r/emacs/comments/k3c0u7][Reddit announc | |||
603 | 754 | ||
604 | ** Backup files | 755 | ** Backup files |
605 | 756 | ||
757 | To be honest, I probably don't need backup files at all. At some point, I will probably delete this. | ||
758 | |||
606 | #+begin_src emacs-lisp | 759 | #+begin_src emacs-lisp |
607 | (cuss backup-directory-alist | 760 | (cuss backup-directory-alist |
608 | `((".*" . ,(no-littering-expand-var-file-name "backup/")))) | 761 | `((".*" . ,(no-littering-expand-var-file-name "backup/")))) |
@@ -615,21 +768,27 @@ By the way, the [[https://www.reddit.com/r/emacs/comments/k3c0u7][Reddit announc | |||
615 | 768 | ||
616 | ** Recent files | 769 | ** Recent files |
617 | 770 | ||
771 | Since I apparently /only/ edit my =config.org=, this is also probably not necessary -- I'd be better off just adding a ~(find-file (concat (user-emacs-directory "config.org")))~ at the end 😎 | ||
772 | |||
773 | But until then, it's really nice to have a =recentf= list. | ||
774 | |||
618 | #+begin_src emacs-lisp | 775 | #+begin_src emacs-lisp |
619 | (use-package recentf | 776 | (require 'recentf) |
620 | :custom-update | 777 | |
621 | (recentf-exclude | 778 | (add-to-list 'recentf-exclude |
622 | '(no-littering-var-directory | 779 | '(no-littering-var-directory |
623 | no-littering-etc-directory)) | 780 | no-littering-etc-directory)) |
624 | :custom | 781 | |
625 | (recentf-max-menu-items 100) | 782 | (cuss recentf-max-menu-items 100) |
626 | (recentf-max-saved-items 100) | 783 | (cuss recentf-max-saved-items 100) |
627 | :config | 784 | |
628 | (recentf-mode 1)) | 785 | (recentf-mode 1) |
629 | #+end_src | 786 | #+end_src |
630 | 787 | ||
631 | *** Easily navigate recent files | 788 | *** Easily navigate recent files |
632 | 789 | ||
790 | Now I'm going through this, I might not need this function any more. I'll have to see how =consult= goes. | ||
791 | |||
633 | #+begin_src emacs-lisp | 792 | #+begin_src emacs-lisp |
634 | (defun recentf-find-file () | 793 | (defun recentf-find-file () |
635 | "Find a recent file using `completing-read'." | 794 | "Find a recent file using `completing-read'." |
@@ -644,32 +803,38 @@ By the way, the [[https://www.reddit.com/r/emacs/comments/k3c0u7][Reddit announc | |||
644 | ** Save places in visited files | 803 | ** Save places in visited files |
645 | 804 | ||
646 | #+begin_src emacs-lisp | 805 | #+begin_src emacs-lisp |
647 | (use-package saveplace | 806 | (require 'saveplace) |
648 | :custom | 807 | |
649 | (save-place-file (no-littering-expand-var-file-name "places")) | 808 | (cuss save-place-file (no-littering-expand-var-file-name "places")) |
650 | (save-place-forget-unreadable-files (not | 809 | |
651 | (eq system-type 'windows-nt)) | 810 | (cuss save-place-forget-unreadable-files |
652 | :config | 811 | (not (eq system-type 'windows-nt))) |
653 | (save-place-mode 1))) | 812 | |
813 | (save-place-mode 1) | ||
654 | #+end_src | 814 | #+end_src |
655 | 815 | ||
656 | ** Save history | 816 | ** Save history |
657 | 817 | ||
658 | #+begin_src emacs-lisp | 818 | #+begin_src emacs-lisp |
659 | (use-package savehist | 819 | (require 'savehist) |
660 | :custom | 820 | |
661 | (savehist-additional-variables | 821 | (cuss savehist-additional-variables |
662 | '(kill-ring | 822 | '(kill-ring |
663 | search-ring | 823 | search-ring |
664 | regexp-search-ring)) | 824 | regexp-search-ring)) |
665 | (savehist-save-minibuffer-history t) | 825 | |
666 | (history-length t) | 826 | (cuss savehist-save-minibuffer-history t) |
667 | (history-delete-duplicates t) | 827 | |
668 | :config | 828 | (cuss history-length t) |
669 | (savehist-mode 1)) | 829 | |
830 | (cuss history-delete-duplicates t) | ||
831 | |||
832 | (savehist-mode 1) | ||
670 | #+end_src | 833 | #+end_src |
671 | 834 | ||
672 | ** Undo | 835 | ** Undo: [[https://gitlab.com/ideasman42/emacs-undo-fu-session][undo-fu-session]] |
836 | |||
837 | The other Killer Feature of Neovim when I used it was the perisistent undo. I /think/ this works the same. Honestly, undo is giving me a little grief recently; I need to look into it. | ||
673 | 838 | ||
674 | #+begin_src emacs-lisp | 839 | #+begin_src emacs-lisp |
675 | (use-package undo-fu-session | 840 | (use-package undo-fu-session |
@@ -688,6 +853,8 @@ By the way, the [[https://www.reddit.com/r/emacs/comments/k3c0u7][Reddit announc | |||
688 | 853 | ||
689 | ** File encoding | 854 | ** File encoding |
690 | 855 | ||
856 | I just want to use UTF-8 everywhere, and end all files with UNIX line endings (=^J=, or =LF=). Hell, even Windows Notepad correctly reads UNIX files nowadays (though of course you can't configure it to /save/ the files in UNIX-mode). However, since Emacs is ~40 years old, it has a billion different ways to set encodings. This is my best attempt at setting everything up how I want it. | ||
857 | |||
691 | I'm going to be honest -- most of this is a stab in the dark. | 858 | I'm going to be honest -- most of this is a stab in the dark. |
692 | 859 | ||
693 | #+begin_src emacs-lisp | 860 | #+begin_src emacs-lisp |
@@ -709,7 +876,9 @@ I'm going to be honest -- most of this is a stab in the dark. | |||
709 | (add-hook 'find-file-hooks #'acdw/no-junk-please-were-unixish) | 876 | (add-hook 'find-file-hooks #'acdw/no-junk-please-were-unixish) |
710 | #+end_src | 877 | #+end_src |
711 | 878 | ||
712 | ** Undo | 879 | ** [[https://gitlab.com/ideasman42/emacs-undo-fu][undo-fu]] |
880 | |||
881 | I've heard that Emacs' undo is weird, so here I am, trying to make it .... /less/ weird. I keep forgetting I've installed this though, so I might uninstall it at some point. | ||
713 | 882 | ||
714 | #+begin_src emacs-lisp | 883 | #+begin_src emacs-lisp |
715 | (use-package undo-fu | 884 | (use-package undo-fu |
@@ -718,7 +887,9 @@ I'm going to be honest -- most of this is a stab in the dark. | |||
718 | ("C-?" . undo-fu-only-redo)) | 887 | ("C-?" . undo-fu-only-redo)) |
719 | #+end_src | 888 | #+end_src |
720 | 889 | ||
721 | ** Find/replace | 890 | ** Find/replace: [[https://github.com/benma/visual-regexp.el][visual-regexp]] |
891 | |||
892 | Another replacement for a Killer Feature in Neovim -- the ease of regexp find/replace was so wonderful, because I could easily see /what/ I'd be changing with a =%s= command, as well as /how/ it'd change. This works... pretty similarly. It could be a little better. | ||
722 | 893 | ||
723 | #+begin_src emacs-lisp | 894 | #+begin_src emacs-lisp |
724 | (use-package visual-regexp | 895 | (use-package visual-regexp |
@@ -729,7 +900,9 @@ I'm going to be honest -- most of this is a stab in the dark. | |||
729 | 900 | ||
730 | ** Visual editing | 901 | ** Visual editing |
731 | 902 | ||
732 | *** Volatile highlights | 903 | *** [[https://github.com/k-talo/volatile-highlights.el][volatile-highlights]] |
904 | |||
905 | Highlights text changed by certain operations. | ||
733 | 906 | ||
734 | #+begin_src emacs-lisp | 907 | #+begin_src emacs-lisp |
735 | (use-package volatile-highlights | 908 | (use-package volatile-highlights |
@@ -737,7 +910,11 @@ I'm going to be honest -- most of this is a stab in the dark. | |||
737 | (volatile-highlights-mode 1)) | 910 | (volatile-highlights-mode 1)) |
738 | #+end_src | 911 | #+end_src |
739 | 912 | ||
740 | *** Expand region | 913 | *** [[https://github.com/magnars/expand-region.el][expand-region]] |
914 | |||
915 | I don't use this a /ton/, but not because it's not useful -- I just forget it's there sometimes. | ||
916 | |||
917 | Basically, it allows you to do like a Kakoune-style incremental widening of the selection by semantic units. | ||
741 | 918 | ||
742 | #+begin_src emacs-lisp | 919 | #+begin_src emacs-lisp |
743 | (use-package expand-region | 920 | (use-package expand-region |
@@ -748,6 +925,8 @@ I'm going to be honest -- most of this is a stab in the dark. | |||
748 | 925 | ||
749 | ** Clean up white space on save | 926 | ** Clean up white space on save |
750 | 927 | ||
928 | I'm not sure if I'll /keep/ this forever, because in combination with =super-save= I lose the final "thinking spaces" when I shift contexts to another window. | ||
929 | |||
751 | #+begin_src emacs-lisp | 930 | #+begin_src emacs-lisp |
752 | (add-hook 'before-save-hook #'whitespace-cleanup) | 931 | (add-hook 'before-save-hook #'whitespace-cleanup) |
753 | (add-hook 'before-save-hook #'delete-trailing-whitespace) | 932 | (add-hook 'before-save-hook #'delete-trailing-whitespace) |
@@ -755,13 +934,17 @@ I'm going to be honest -- most of this is a stab in the dark. | |||
755 | 934 | ||
756 | ** Automatically revert a file to what it is on disk | 935 | ** Automatically revert a file to what it is on disk |
757 | 936 | ||
937 | Revert a buffer to reflect what's on disk if it's changed outside of Emacs. | ||
938 | |||
758 | #+begin_src emacs-lisp | 939 | #+begin_src emacs-lisp |
759 | (global-auto-revert-mode 1) | 940 | (global-auto-revert-mode 1) |
760 | #+end_src | 941 | #+end_src |
761 | 942 | ||
762 | * Writing | 943 | * Writing |
763 | 944 | ||
764 | ** Word count | 945 | Configurations related to writing prose or verse. |
946 | |||
947 | ** Word count: [[https://github.com/bnbeckwith/wc-mode][wc-mode]] | ||
765 | 948 | ||
766 | #+begin_src emacs-lisp | 949 | #+begin_src emacs-lisp |
767 | (use-package wc-mode | 950 | (use-package wc-mode |
@@ -770,7 +953,11 @@ I'm going to be honest -- most of this is a stab in the dark. | |||
770 | :hook text-mode) | 953 | :hook text-mode) |
771 | #+end_src | 954 | #+end_src |
772 | 955 | ||
773 | ** Visual fill column mode | 956 | ** [[https://github.com/joostkremers/visual-fill-column][visual-fill-column-mode]] |
957 | |||
958 | Center the text part of the frame within a =fill-column=-sized area in the frame as a whole. | ||
959 | |||
960 | The one thing I need to fix: binding scrolling to =<left-margin> <mouse-4>= and friends. | ||
774 | 961 | ||
775 | #+begin_src emacs-lisp | 962 | #+begin_src emacs-lisp |
776 | (use-package visual-fill-column | 963 | (use-package visual-fill-column |
@@ -786,7 +973,11 @@ I'm going to be honest -- most of this is a stab in the dark. | |||
786 | (text-mode . visual-fill-column-mode)) | 973 | (text-mode . visual-fill-column-mode)) |
787 | #+end_src | 974 | #+end_src |
788 | 975 | ||
789 | ** Org mode | 976 | ** [[https://orgmode.org/][org-mode]] |
977 | |||
978 | Pretty self-explanatory, I think... | ||
979 | |||
980 | I need to break this config up and like, comment it better. | ||
790 | 981 | ||
791 | #+begin_src emacs-lisp | 982 | #+begin_src emacs-lisp |
792 | (use-package org | 983 | (use-package org |
@@ -961,17 +1152,25 @@ from [[https://github.com/alphapapa/unpackaged.el#org-return-dwim][unpackaged.el | |||
961 | 1152 | ||
962 | * Coding | 1153 | * Coding |
963 | 1154 | ||
1155 | The Other Thing Emacs is Good For. | ||
1156 | |||
964 | ** Formatting | 1157 | ** Formatting |
965 | 1158 | ||
966 | *** Indenting | 1159 | *** Indenting: [[https://github.com/Malabarba/aggressive-indent-mode][aggressive-indent-mode]] |
1160 | |||
1161 | This automagically indents code on every change, as opposed to =electric-indent-mode=, which only does when I like, hit =RET= or whatever. As such, I can turn =electric-indent-mode= off. | ||
967 | 1162 | ||
968 | #+begin_src emacs-lisp | 1163 | #+begin_src emacs-lisp |
969 | (use-package aggressive-indent | 1164 | (use-package aggressive-indent |
1165 | :init | ||
1166 | (electric-indent-mode -1) | ||
970 | :config | 1167 | :config |
971 | (global-aggressive-indent-mode 1)) | 1168 | (global-aggressive-indent-mode 1)) |
972 | #+end_src | 1169 | #+end_src |
973 | 1170 | ||
974 | *** Smart tabs | 1171 | *** [[https://github.com/jcsalomon/smarttabs][Smart tabs]] |
1172 | |||
1173 | I really want to like, use tabs all the time. But I thought the =smart-tabs= package author made some good points about using tabs for semantic indentation, and spaces for the rest. So. | ||
975 | 1174 | ||
976 | #+begin_src emacs-lisp | 1175 | #+begin_src emacs-lisp |
977 | (use-package smart-tabs-mode | 1176 | (use-package smart-tabs-mode |
@@ -988,6 +1187,8 @@ from [[https://github.com/alphapapa/unpackaged.el#org-return-dwim][unpackaged.el | |||
988 | 1187 | ||
989 | *** Prettify symbols mode | 1188 | *** Prettify symbols mode |
990 | 1189 | ||
1190 | By default, I think =prettify-symbols-mode= only changes =lambda= to =λ=. I should, at some point, add some prettified symbols. | ||
1191 | |||
991 | #+begin_src emacs-lisp | 1192 | #+begin_src emacs-lisp |
992 | (add-hook 'prog-mode-hook #'prettify-symbols-mode) | 1193 | (add-hook 'prog-mode-hook #'prettify-symbols-mode) |
993 | #+end_src | 1194 | #+end_src |
@@ -996,12 +1197,16 @@ from [[https://github.com/alphapapa/unpackaged.el#org-return-dwim][unpackaged.el | |||
996 | 1197 | ||
997 | **** =show-paren-style= | 1198 | **** =show-paren-style= |
998 | 1199 | ||
1200 | A =mixed= =show-paren-style= means that, when both parentheses are visible, it just highlights them. If one is /not/, though, it highlights the entire block. | ||
1201 | |||
999 | #+begin_src emacs-lisp | 1202 | #+begin_src emacs-lisp |
1000 | (cuss show-paren-style 'mixed) | 1203 | (cuss show-paren-style 'mixed) |
1001 | (show-paren-mode 1) | 1204 | (show-paren-mode 1) |
1002 | #+end_src | 1205 | #+end_src |
1003 | 1206 | ||
1004 | **** Smartparens | 1207 | **** [[https://github.com/Fuco1/smartparens][smartparens]] |
1208 | |||
1209 | Automagically close pairs and stuff. See also [[https://www.emacswiki.org/emacs/ParEdit][ParEdit]] -- maybe test that one? | ||
1005 | 1210 | ||
1006 | #+begin_src emacs-lisp | 1211 | #+begin_src emacs-lisp |
1007 | (use-package smartparens | 1212 | (use-package smartparens |
@@ -1013,14 +1218,18 @@ from [[https://github.com/alphapapa/unpackaged.el#org-return-dwim][unpackaged.el | |||
1013 | (prog-mode . acdw/setup-smartparens)) | 1218 | (prog-mode . acdw/setup-smartparens)) |
1014 | #+end_src | 1219 | #+end_src |
1015 | 1220 | ||
1016 | **** Rainbow delimiters | 1221 | **** [[https://github.com/Fanael/rainbow-delimiters][rainbow-delimiters]] |
1222 | |||
1223 | Show different pairs of delimiters in diffferent colors. Pretty! Useful! | ||
1017 | 1224 | ||
1018 | #+begin_src emacs-lisp | 1225 | #+begin_src emacs-lisp |
1019 | (use-package rainbow-delimiters | 1226 | (use-package rainbow-delimiters |
1020 | :hook (prog-mode . rainbow-delimiters-mode)) | 1227 | :hook (prog-mode . rainbow-delimiters-mode)) |
1021 | #+end_src | 1228 | #+end_src |
1022 | 1229 | ||
1023 | *** Rainbow mode | 1230 | *** [[https://elpa.gnu.org/packages/rainbow-mode.html][rainbow-mode]] |
1231 | |||
1232 | Show different colors /in that color/. Useful! Pretty! | ||
1024 | 1233 | ||
1025 | #+begin_src emacs-lisp | 1234 | #+begin_src emacs-lisp |
1026 | (use-package rainbow-mode | 1235 | (use-package rainbow-mode |
@@ -1031,6 +1240,8 @@ from [[https://github.com/alphapapa/unpackaged.el#org-return-dwim][unpackaged.el | |||
1031 | 1240 | ||
1032 | *** Line numbers | 1241 | *** Line numbers |
1033 | 1242 | ||
1243 | I only want line numbers in =prog-mode=-derived modes. In addition, apparently =linum-mode= works better in TUI, but is slower that =display-line-numbers=. So I want to do some logic to see what to use. | ||
1244 | |||
1034 | #+begin_src emacs-lisp | 1245 | #+begin_src emacs-lisp |
1035 | (defun acdw/enable-line-numbers () | 1246 | (defun acdw/enable-line-numbers () |
1036 | "Enable line numbers, either through `display-line-numbers-mode' | 1247 | "Enable line numbers, either through `display-line-numbers-mode' |
@@ -1047,6 +1258,8 @@ from [[https://github.com/alphapapa/unpackaged.el#org-return-dwim][unpackaged.el | |||
1047 | 1258 | ||
1048 | ** Programming languages | 1259 | ** Programming languages |
1049 | 1260 | ||
1261 | These are the programming languages I (don't really) use. | ||
1262 | |||
1050 | *** Fish shell | 1263 | *** Fish shell |
1051 | 1264 | ||
1052 | #+begin_src emacs-lisp | 1265 | #+begin_src emacs-lisp |
@@ -1107,7 +1320,17 @@ from [[https://github.com/alphapapa/unpackaged.el#org-return-dwim][unpackaged.el | |||
1107 | 1320 | ||
1108 | * Applications | 1321 | * Applications |
1109 | 1322 | ||
1110 | ** Git | 1323 | Of course, the real reason we love emacs is for the application layer. What is it they say? |
1324 | |||
1325 | #+begin_quote | ||
1326 | Emacs is a great operating system, lacking only a decent editor. | ||
1327 | #+end_quote | ||
1328 | |||
1329 | Yeah, that's it 😎 | ||
1330 | |||
1331 | ** Git: [[https://magit.vc/][magit]] | ||
1332 | |||
1333 | The magical porcelain. | ||
1111 | 1334 | ||
1112 | #+begin_src emacs-lisp | 1335 | #+begin_src emacs-lisp |
1113 | (use-package magit | 1336 | (use-package magit |
@@ -1151,9 +1374,10 @@ from [[https://github.com/alphapapa/unpackaged.el#org-return-dwim][unpackaged.el | |||
1151 | '(("duckwork")))) | 1374 | '(("duckwork")))) |
1152 | #+end_src | 1375 | #+end_src |
1153 | 1376 | ||
1154 | |||
1155 | ** Dired | 1377 | ** Dired |
1156 | 1378 | ||
1379 | I'm still figuring out what all I can do with =dired=. | ||
1380 | |||
1157 | #+begin_src emacs-lisp | 1381 | #+begin_src emacs-lisp |
1158 | (with-eval-after-load 'dired | 1382 | (with-eval-after-load 'dired |
1159 | (cuss dired-dwim-target t) | 1383 | (cuss dired-dwim-target t) |
@@ -1165,6 +1389,8 @@ from [[https://github.com/alphapapa/unpackaged.el#org-return-dwim][unpackaged.el | |||
1165 | 1389 | ||
1166 | ** Proced | 1390 | ** Proced |
1167 | 1391 | ||
1392 | The process editor. | ||
1393 | |||
1168 | #+begin_src emacs-lisp | 1394 | #+begin_src emacs-lisp |
1169 | (defun acdw/setup-proced () | 1395 | (defun acdw/setup-proced () |
1170 | (variable-pitch-mode -1) | 1396 | (variable-pitch-mode -1) |
@@ -1174,7 +1400,13 @@ from [[https://github.com/alphapapa/unpackaged.el#org-return-dwim][unpackaged.el | |||
1174 | (add-hook 'proced-mode-hook #'acdw/setup-proced) | 1400 | (add-hook 'proced-mode-hook #'acdw/setup-proced) |
1175 | #+end_src | 1401 | #+end_src |
1176 | 1402 | ||
1177 | ** Elpher | 1403 | ** Gemini (and gopher) |
1404 | |||
1405 | *** [[https://thelambdalab.xyz/elpher/][elpher]] | ||
1406 | |||
1407 | Actually, =elpher= is the reason I started using Emacs. So thanks, smol web denizens! | ||
1408 | |||
1409 | Fun fact: these packages are /also/ why I use =straight.el=, since they're none of them on GitHub. | ||
1178 | 1410 | ||
1179 | #+BEGIN_SRC emacs-lisp | 1411 | #+BEGIN_SRC emacs-lisp |
1180 | (use-package elpher | 1412 | (use-package elpher |
@@ -1206,7 +1438,13 @@ from [[https://github.com/alphapapa/unpackaged.el#org-return-dwim][unpackaged.el | |||
1206 | ("G" . elpher-go-current)) | 1438 | ("G" . elpher-go-current)) |
1207 | :hook | 1439 | :hook |
1208 | (elpher-mode . visual-fill-column-mode)) | 1440 | (elpher-mode . visual-fill-column-mode)) |
1441 | #+end_src | ||
1209 | 1442 | ||
1443 | *** [[https://git.carcosa.net/jmcbray/gemini.el][gemini-mode]] | ||
1444 | |||
1445 | A major mode for =text/gemini= files. I've changed the headings to match Elpher's. | ||
1446 | |||
1447 | #+BEGIN_SRC emacs-lisp | ||
1210 | (use-package gemini-mode | 1448 | (use-package gemini-mode |
1211 | :straight (gemini-mode | 1449 | :straight (gemini-mode |
1212 | :repo "https://git.carcosa.net/jmcbray/gemini.el.git") | 1450 | :repo "https://git.carcosa.net/jmcbray/gemini.el.git") |
@@ -1226,19 +1464,33 @@ from [[https://github.com/alphapapa/unpackaged.el#org-return-dwim][unpackaged.el | |||
1226 | (gemini-mode . acdw/setup-gemini-mode)) | 1464 | (gemini-mode . acdw/setup-gemini-mode)) |
1227 | #+end_src | 1465 | #+end_src |
1228 | 1466 | ||
1467 | *** [[https://alexschroeder.ch/cgit/gemini-write/about/][gemini-write]] | ||
1468 | |||
1469 | Alex Schroeder's Emacs implementation of the Titan protocol. This is why I use his Gemini server, [[https://alexschroeder.ch/cgit/phoebe/][Phoebe]]! | ||
1470 | |||
1471 | #+BEGIN_SRC emacs-lisp | ||
1229 | (use-package gemini-write | 1472 | (use-package gemini-write |
1230 | :straight (gemini-write | 1473 | :straight (gemini-write |
1231 | :repo "https://alexschroeder.ch/cgit/gemini-write") | 1474 | :repo "https://alexschroeder.ch/cgit/gemini-write") |
1232 | :config | 1475 | :config |
1233 | (add-to-list 'elpher-gemini-tokens | 1476 | (when (boundp 'acdw-secrets/elpher-gemini-tokens) |
1234 | (acdw-secrets/elpher-gemini-tokens))) | 1477 | (add-to-list 'elpher-gemini-tokens |
1478 | (acdw-secrets/elpher-gemini-tokens)))) | ||
1479 | #+end_src | ||
1480 | |||
1481 | *** [[https://git.sr.ht/~acdw/post-to-gemlog-blue.el][post-to-gemlog-blue]] | ||
1482 | |||
1483 | My first (!) Emacs package, to allow posting to [[https://gemlog.blue][gemlog.blue's web interface]]. I don't use gemlog.blue any more, but if I didn't have this package, no one would 😎 | ||
1235 | 1484 | ||
1485 | #+BEGIN_SRC emacs-lisp | ||
1236 | (use-package post-to-gemlog-blue | 1486 | (use-package post-to-gemlog-blue |
1237 | :straight (post-to-gemlog-blue | 1487 | :straight (post-to-gemlog-blue |
1238 | :repo "https://git.sr.ht/~acdw/post-to-gemlog-blue.el")) | 1488 | :repo "https://git.sr.ht/~acdw/post-to-gemlog-blue.el")) |
1239 | #+END_SRC | 1489 | #+END_SRC |
1240 | 1490 | ||
1241 | ** Pastebin (0x0) | 1491 | ** Pastebin: [[https://git.sr.ht/~zge/nullpointer-emacs][0x0]] |
1492 | |||
1493 | Pastebins are so useful. Now I can use them from Emacs. | ||
1242 | 1494 | ||
1243 | #+BEGIN_SRC emacs-lisp | 1495 | #+BEGIN_SRC emacs-lisp |
1244 | (use-package 0x0 | 1496 | (use-package 0x0 |
@@ -1246,7 +1498,9 @@ from [[https://github.com/alphapapa/unpackaged.el#org-return-dwim][unpackaged.el | |||
1246 | (0x0-default-service 'ttm)) | 1498 | (0x0-default-service 'ttm)) |
1247 | #+END_SRC | 1499 | #+END_SRC |
1248 | 1500 | ||
1249 | ** Mu4e | 1501 | ** [[https://www.djcbsoftware.nl/code/mu/mu4e.html][mu4e]] |
1502 | |||
1503 | I've just recently started (again) using mu4e. We'll see how it goes. | ||
1250 | 1504 | ||
1251 | #+begin_src emacs-lisp | 1505 | #+begin_src emacs-lisp |
1252 | (when (executable-find "mu") | 1506 | (when (executable-find "mu") |