diff options
-rw-r--r-- | README.md | 603 |
1 files changed, 474 insertions, 129 deletions
diff --git a/README.md b/README.md index 9fdd0a0..6e45992 100644 --- a/README.md +++ b/README.md | |||
@@ -42,14 +42,15 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
42 | 42 | ||
43 | ## Original init.el | 43 | ## Original init.el |
44 | 44 | ||
45 | ;; This file replaces itself with the actual configuration when | 45 | 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: |
46 | ;; first run. To keep only this version in git, run this command: | 46 | |
47 | ;; | 47 | git update-index --assume-unchanged init.el |
48 | ;; git update-index --assume-unchanged init.el | 48 | |
49 | ;; | 49 | If, for some reason, you want to change this original file to be re-tracked, run this command: |
50 | ;; If it needs to be changed, start tracking it again thusly: | 50 | |
51 | ;; | 51 | git update-index --no-assume-unchanged init.el |
52 | ;; git update-index --no-assume-unchanged init.el | 52 | |
53 | Otherwise, here's the actual, original `init.el` that tangles this Org file and gets us going. | ||
53 | 54 | ||
54 | (require 'org) | 55 | (require 'org) |
55 | (find-file (concat user-emacs-directory "config.org")) | 56 | (find-file (concat user-emacs-directory "config.org")) |
@@ -59,8 +60,15 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
59 | (byte-compile-file (concat user-emacs-directory "init.el")) | 60 | (byte-compile-file (concat user-emacs-directory "init.el")) |
60 | 61 | ||
61 | 62 | ||
63 | ### TODO What I should do instead | ||
64 | |||
65 | 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 … | ||
66 | |||
67 | |||
62 | ## Tangling | 68 | ## Tangling |
63 | 69 | ||
70 | 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`. | ||
71 | |||
64 | (defun acdw/tangle-init () | 72 | (defun acdw/tangle-init () |
65 | "If the current buffer is `config.org', tangle it, then compile | 73 | "If the current buffer is `config.org', tangle it, then compile |
66 | and load the resulting files." | 74 | and load the resulting files." |
@@ -80,8 +88,12 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
80 | (acdw/load-init) | 88 | (acdw/load-init) |
81 | (message "Tangled and loaded: %s" response))))) | 89 | (message "Tangled and loaded: %s" response))))) |
82 | 90 | ||
91 | Since I want to tangle every time I save `config.org`, I've added `acdw/tangle-init` to a hook. | ||
92 | |||
83 | (add-hook 'after-save-hook #'acdw/tangle-init) | 93 | (add-hook 'after-save-hook #'acdw/tangle-init) |
84 | 94 | ||
95 | 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`. | ||
96 | |||
85 | (defun acdw/load-init () | 97 | (defun acdw/load-init () |
86 | (interactive) | 98 | (interactive) |
87 | (load-file (expand-file-name | 99 | (load-file (expand-file-name |
@@ -95,25 +107,35 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
95 | 107 | ||
96 | ### Add directories to `load-path` | 108 | ### Add directories to `load-path` |
97 | 109 | ||
110 | I also put lispy stuff in the `lisp/` subdirectory of my Emacs config, and under my SyncThing directory (for easy syncing ;P). | ||
111 | |||
98 | (dolist (dir `(,(concat user-emacs-directory | 112 | (dolist (dir `(,(concat user-emacs-directory |
99 | (convert-standard-filename "lisp/")) | 113 | (convert-standard-filename "lisp/")) |
100 | ,(expand-file-name "~/Sync/elisp/"))) | 114 | ,(expand-file-name "~/Sync/elisp/"))) |
101 | (add-to-list 'load-path dir)) | 115 | (add-to-list 'load-path dir)) |
102 | 116 | ||
103 | 117 | ||
104 | ### Require my secrets | 118 | ### TODO Require my secrets |
119 | |||
120 | 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 [Bill Dietrich's setup](https://www.billdietrich.me/Authentication.html?expandall=1#KeePassXCandSecretService). | ||
105 | 121 | ||
106 | (require 'acdw-secrets) | 122 | (require 'acdw-secrets) |
107 | 123 | ||
108 | 124 | ||
109 | # Early initiation | 125 | # Early initiation |
110 | 126 | ||
127 | 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. | ||
128 | |||
129 | Of course, I also want to set some really early-on settings here too, like `load-prefer-newer` – why not? | ||
130 | |||
111 | ;; early-init.el -*- lexical-binding: t; no-byte-compile: t -*- | 131 | ;; early-init.el -*- lexical-binding: t; no-byte-compile: t -*- |
112 | (setq load-prefer-newer t) | 132 | (setq load-prefer-newer t) |
113 | 133 | ||
114 | 134 | ||
115 | ## Increase the garbage collector | 135 | ## Increase the garbage collector |
116 | 136 | ||
137 | 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. | ||
138 | |||
117 | (setq gc-cons-threshold (* 100 100 1000)) | 139 | (setq gc-cons-threshold (* 100 100 1000)) |
118 | 140 | ||
119 | (add-hook 'after-init-hook | 141 | (add-hook 'after-init-hook |
@@ -123,16 +145,28 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
123 | gc-cons-threshold))) | 145 | gc-cons-threshold))) |
124 | 146 | ||
125 | 147 | ||
126 | ## Add more paths to the `exec-path` when using Windows | 148 | ## Add more paths to the `exec-path` |
149 | |||
150 | When using Windows (at work), I need to use the PortableGit installation I've downloaded, since I don't have Admin privileges. | ||
127 | 151 | ||
128 | (when (eq system-type 'windows-nt) | 152 | (when (eq system-type 'windows-nt) |
129 | (dolist (path '("~/bin" | 153 | (dolist (path '("C:/Users/aduckworth/Downloads/PortableGit/bin" |
130 | "C:/Users/aduckworth/Downloads/PortableGit/bin" | ||
131 | "C:/Users/aduckworth/Downloads/PortableGit/usr/bin")) | 154 | "C:/Users/aduckworth/Downloads/PortableGit/usr/bin")) |
132 | (add-to-list 'exec-path path))) | 155 | (add-to-list 'exec-path path))) |
133 | 156 | ||
157 | 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 ~. | ||
158 | |||
159 | (dolist (path '("~/bin" | ||
160 | "~/.local/bin" | ||
161 | "~/Scripts")) | ||
162 | (add-to-list 'exec-path path)) | ||
163 | |||
134 | 164 | ||
135 | ## Bootstrap `straight.el` | 165 | ## Bootstrap [straight.el](https://github.com/raxod502/straight.el) |
166 | |||
167 | 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`! | ||
168 | |||
169 | 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 [download the master-branch zip file](https://github.com/raxod502/straight.el/archive/master.zip) and extract it to `~/.emacs.d/straight/repos/`. | ||
136 | 170 | ||
137 | (defvar bootstrap-version) | 171 | (defvar bootstrap-version) |
138 | (let ((bootstrap-file | 172 | (let ((bootstrap-file |
@@ -149,13 +183,17 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
149 | (load bootstrap-file nil 'nomessage)) | 183 | (load bootstrap-file nil 'nomessage)) |
150 | 184 | ||
151 | 185 | ||
152 | ## Use `use-package` | 186 | ## Use [use-package](https://jwiegley.github.io/use-package/) |
187 | |||
188 | Like I said, `straight.el` hooks into `use-package` easily. These two lines get the latter to use the former by default. | ||
153 | 189 | ||
154 | (setq straight-use-package-by-default t) | 190 | (setq straight-use-package-by-default t) |
155 | (straight-use-package 'use-package) | 191 | (straight-use-package 'use-package) |
156 | 192 | ||
157 | 193 | ||
158 | ## Keep `~/.emacs.d` tidy | 194 | ## Keep `~/.emacs.d` tidy with [no-littering](https://github.com/emacscollective/no-littering) |
195 | |||
196 | 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`. | ||
159 | 197 | ||
160 | (straight-use-package 'no-littering) | 198 | (straight-use-package 'no-littering) |
161 | (require 'no-littering) | 199 | (require 'no-littering) |
@@ -164,7 +202,21 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
164 | ## Additional `use-package` keywords | 202 | ## Additional `use-package` keywords |
165 | 203 | ||
166 | 204 | ||
167 | ### `:custom-update` | 205 | ### [:custom-update](https://github.com/a13/use-package-custom-update) |
206 | |||
207 | The `:custom-update` keyword lets me do this: | ||
208 | |||
209 | (use-package package | ||
210 | :custom-update | ||
211 | (package-list '(1 2 3))) | ||
212 | |||
213 | instead of this: | ||
214 | |||
215 | (use-package package | ||
216 | :config | ||
217 | (add-to-list 'package-list '(1 2 3))) | ||
218 | |||
219 | It's not … perfect, but it's kind of nice. | ||
168 | 220 | ||
169 | (use-package use-package-custom-update | 221 | (use-package use-package-custom-update |
170 | :straight (use-package-custom-update | 222 | :straight (use-package-custom-update |
@@ -172,7 +224,9 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
172 | :repo "a13/use-package-custom-update")) | 224 | :repo "a13/use-package-custom-update")) |
173 | 225 | ||
174 | 226 | ||
175 | ## Setup async | 227 | ## Setup [async](https://github.com/jwiegley/emacs-async) |
228 | |||
229 | I thought this was included in Emacs at first, but it's not – so we need to install and require it. | ||
176 | 230 | ||
177 | (straight-use-package 'async) | 231 | (straight-use-package 'async) |
178 | (require 'async) | 232 | (require 'async) |
@@ -183,6 +237,10 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
183 | 237 | ||
184 | ## Customizing variables | 238 | ## Customizing variables |
185 | 239 | ||
240 | 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. | ||
241 | |||
242 | 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. | ||
243 | |||
186 | (defmacro cuss (var val) | 244 | (defmacro cuss (var val) |
187 | "Basically `use-package''s `:custom', but without using either." | 245 | "Basically `use-package''s `:custom', but without using either." |
188 | `(progn | 246 | `(progn |
@@ -190,9 +248,11 @@ It's highly likely that the WTFPL is completely incompatible with the GPL, for w | |||
190 | ',var ,val))) | 248 | ',var ,val))) |
191 | 249 | ||
192 | 250 | ||
193 | # Theme | 251 | # Theme: [Modus](https://protesilaos.com/modus-themes/) |
252 | |||
253 | 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. | ||
194 | 254 | ||
195 | I'm using the [Modus](https://protesilaos.com/modus-themes/) themes. | 255 | The big `dolist` form is from [his documentation](https://protesilaos.com/modus-themes/#h:a897b302-8e10-4a26-beab-3caaee1e1193); it basically allows me to configure both themes before loading them. I've tweaked his code a little to use `use-package`. |
196 | 256 | ||
197 | (defmacro modus-themes-format-sexp (sexp &rest objects) | 257 | (defmacro modus-themes-format-sexp (sexp &rest objects) |
198 | `(eval (read (format ,(format "%S" sexp) ,@objects)))) | 258 | `(eval (read (format ,(format "%S" sexp) ,@objects)))) |
@@ -200,33 +260,39 @@ I'm using the [Modus](https://protesilaos.com/modus-themes/) themes. | |||
200 | (dolist (theme '("operandi" "vivendi")) | 260 | (dolist (theme '("operandi" "vivendi")) |
201 | (modus-themes-format-sexp | 261 | (modus-themes-format-sexp |
202 | (use-package modus-%1$s-theme | 262 | (use-package modus-%1$s-theme |
203 | :init | 263 | :custom |
204 | (setq modus-%1$s-theme-slanted-constructs t | 264 | (modus-%1$s-theme-slanted-constructs t) |
205 | modus-%1$s-theme-bold-constructs t | 265 | (modus-%1$s-theme-bold-constructs t) |
206 | modus-%1$s-theme-fringes 'subtle | 266 | (modus-%1$s-theme-fringes nil) |
207 | modus-%1$s-theme-mode-line '3d | 267 | (modus-%1$s-theme-mode-line '3d) |
208 | modus-%1$s-theme-syntax 'yellow-comments | 268 | (modus-%1$s-theme-syntax 'yellow-comments) |
209 | modus-%1$s-theme-intense-hl-line nil | 269 | (modus-%1$s-theme-intense-hl-line nil) |
210 | modus-%1$s-theme-intense-paren-match t | 270 | (modus-%1$s-theme-intense-paren-match t) |
211 | modus-%1$s-theme-links nil | 271 | (modus-%1$s-theme-links nil) |
212 | modus-%1$s-theme-no-mixed-fonts nil | 272 | (modus-%1$s-theme-no-mixed-fonts nil) |
213 | modus-%1$s-theme-prompts nil | 273 | (modus-%1$s-theme-prompts nil) |
214 | modus-%1$s-theme-completions nil | 274 | (modus-%1$s-theme-completions nil) |
215 | modus-%1$s-theme-diffs nil | 275 | (modus-%1$s-theme-diffs nil) |
216 | modus-%1$s-theme-org-blocks 'grayscale | 276 | (modus-%1$s-theme-org-blocks 'grayscale) |
217 | modus-%1$s-theme-headings | 277 | (modus-%1$s-theme-headings |
218 | '((1 . section) | 278 | '((1 . section) |
219 | (2 . line) | 279 | (2 . line) |
220 | (t . rainbow-line-no-bold)) | 280 | (t . rainbow-line))) |
221 | modus-%1$s-theme-variable-pitch-headings nil | 281 | (modus-%1$s-theme-variable-pitch-headings t) |
222 | modus-%1$s-theme-scale-headings t | 282 | (modus-%1$s-theme-scale-headings t) |
223 | modus-%1$s-theme-scale-1 1.1 | 283 | (modus-%1$s-theme-scale-1 1.1) |
224 | modus-%1$s-theme-scale-2 1.15 | 284 | (modus-%1$s-theme-scale-2 1.15) |
225 | modus-%1$s-theme-scale-3 1.21 | 285 | (modus-%1$s-theme-scale-3 1.21) |
226 | modus-%1$s-theme-scale-4 1.27 | 286 | (modus-%1$s-theme-scale-4 1.27) |
227 | modus-%1$s-theme-scale-5 1.33)) | 287 | (modus-%1$s-theme-scale-5 1.33) |
288 | :custom-face | ||
289 | (font-lock-comment-face | ||
290 | ((t (:inherit (custom-comment italic variable-pitch)))))) | ||
228 | theme)) | 291 | theme)) |
229 | 292 | ||
293 | |||
294 | ## Theme changer | ||
295 | |||
230 | I also want to switch themes between night and day. | 296 | I also want to switch themes between night and day. |
231 | 297 | ||
232 | (use-package theme-changer | 298 | (use-package theme-changer |
@@ -240,12 +306,16 @@ I also want to switch themes between night and day. | |||
240 | # Simplify GUI | 306 | # Simplify GUI |
241 | 307 | ||
242 | 308 | ||
309 | <a id="orga685025"></a> | ||
310 | |||
243 | ## Frame defaults | 311 | ## Frame defaults |
244 | 312 | ||
313 | 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. | ||
314 | |||
245 | (cuss default-frame-alist | 315 | (cuss default-frame-alist |
246 | '((tool-bar-lines . 0) | 316 | '((tool-bar-lines . 0) |
247 | (menu-bar-lines . 0) | 317 | (menu-bar-lines . 0) |
248 | (vertical-scroll-bars . 'right) | 318 | (vertical-scroll-bars . nil) |
249 | (horizontal-scroll-bars . nil) | 319 | (horizontal-scroll-bars . nil) |
250 | (right-divider-width . 2) | 320 | (right-divider-width . 2) |
251 | (bottom-divider-width . 2) | 321 | (bottom-divider-width . 2) |
@@ -255,6 +325,8 @@ I also want to switch themes between night and day. | |||
255 | 325 | ||
256 | ## Minibuffer window/frame defaults | 326 | ## Minibuffer window/frame defaults |
257 | 327 | ||
328 | 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. | ||
329 | |||
258 | (cuss minibuffer-frame-alist | 330 | (cuss minibuffer-frame-alist |
259 | '((width . 80) | 331 | '((width . 80) |
260 | (height . 2) | 332 | (height . 2) |
@@ -265,24 +337,50 @@ I also want to switch themes between night and day. | |||
265 | 337 | ||
266 | ## Remove unneeded GUI elements | 338 | ## Remove unneeded GUI elements |
267 | 339 | ||
340 | The [Frame Defaults](#orga685025) 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. | ||
341 | |||
268 | (menu-bar-mode -1) | 342 | (menu-bar-mode -1) |
269 | (tool-bar-mode -1) | 343 | (tool-bar-mode -1) |
344 | (scroll-bar-mode -1) | ||
270 | (horizontal-scroll-bar-mode -1) | 345 | (horizontal-scroll-bar-mode -1) |
271 | 346 | ||
272 | 347 | ||
348 | ## Tabs | ||
349 | |||
350 | I'm kind of getting into Emacs tabs – but I like not showing the `tab-bar` when there's only one. | ||
351 | |||
352 | (cuss tab-bar-show 1) | ||
353 | |||
354 | (cuss tab-bar-tab-name-function 'tab-bar-tab-name-current-with-count) | ||
355 | |||
356 | (tab-bar-mode 1) | ||
357 | |||
358 | |||
273 | ## Word wrap and operate visually | 359 | ## Word wrap and operate visually |
274 | 360 | ||
361 | `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. | ||
362 | |||
275 | (global-visual-line-mode 1) | 363 | (global-visual-line-mode 1) |
276 | 364 | ||
277 | 365 | ||
278 | ## Modeline | 366 | ## Modeline |
279 | 367 | ||
368 | |||
369 | ### [smart-mode-line](https://github.com/Malabarba/smart-mode-line) | ||
370 | |||
280 | (use-package smart-mode-line | 371 | (use-package smart-mode-line |
281 | :custom | 372 | :custom |
282 | (sml/no-confirm-load-theme t) | 373 | (sml/no-confirm-load-theme t) |
283 | :config | 374 | :config |
284 | (sml/setup)) | 375 | (sml/setup)) |
285 | 376 | ||
377 | |||
378 | ### [rich-minority](https://github.com/Malabarba/rich-minority) | ||
379 | |||
380 | `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. | ||
381 | |||
382 | 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")`. | ||
383 | |||
286 | (defun rm/whitelist-add (regexp) | 384 | (defun rm/whitelist-add (regexp) |
287 | "Add a REGEXP to the whitelist for `rich-minority'." | 385 | "Add a REGEXP to the whitelist for `rich-minority'." |
288 | (if (listp 'rm--whitelist-regexps) | 386 | (if (listp 'rm--whitelist-regexps) |
@@ -309,6 +407,8 @@ from [Ergo Emacs](http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html | |||
309 | 407 | ||
310 | ## Show `^L` as a line | 408 | ## Show `^L` as a line |
311 | 409 | ||
410 | 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. | ||
411 | |||
312 | (use-package form-feed | 412 | (use-package form-feed |
313 | :hook | 413 | :hook |
314 | ((text-mode prog-mode) . form-feed-mode)) | 414 | ((text-mode prog-mode) . form-feed-mode)) |
@@ -316,11 +416,18 @@ from [Ergo Emacs](http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html | |||
316 | 416 | ||
317 | ## Cursor | 417 | ## Cursor |
318 | 418 | ||
419 | I want my cursor to be a bar in focused windows, but a hollow box in non-focused windows. | ||
420 | |||
319 | (cuss cursor-type 'bar) | 421 | (cuss cursor-type 'bar) |
320 | (cuss cursor-in-non-selected-windows 'hollow) | 422 | (cuss cursor-in-non-selected-windows 'hollow) |
321 | 423 | ||
322 | 424 | ||
323 | # Fonts | 425 | # Typesetting |
426 | |||
427 | |||
428 | ## Fonts | ||
429 | |||
430 | 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 ["Testing if fonts are available?"](https://www.emacswiki.org/emacs/SetFonts#toc11) section of the SetFonts page on EmacsWiki. | ||
324 | 431 | ||
325 | See [this StackExchange question and answer](https://emacs.stackexchange.com/questions/12351/when-to-call-find-font-if-launching-emacs-in-daemon-mode) for more information on why I have these font settings applied in a hook. | 432 | See [this StackExchange question and answer](https://emacs.stackexchange.com/questions/12351/when-to-call-find-font-if-launching-emacs-in-daemon-mode) for more information on why I have these font settings applied in a hook. |
326 | 433 | ||
@@ -363,7 +470,9 @@ See [this StackExchange question and answer](https://emacs.stackexchange.com/que | |||
363 | (add-hook 'focus-in-hook #'acdw/setup-fonts) | 470 | (add-hook 'focus-in-hook #'acdw/setup-fonts) |
364 | 471 | ||
365 | 472 | ||
366 | ## Unicode | 473 | ## [unicode-fonts](https://github.com/rolandwalker/unicode-fonts) |
474 | |||
475 | This does something similar to the above code, but for the entirety of the Unicode field (I think). | ||
367 | 476 | ||
368 | (use-package unicode-fonts | 477 | (use-package unicode-fonts |
369 | :config | 478 | :config |
@@ -372,18 +481,49 @@ See [this StackExchange question and answer](https://emacs.stackexchange.com/que | |||
372 | 481 | ||
373 | ## Variable pitch faces | 482 | ## Variable pitch faces |
374 | 483 | ||
484 | 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. | ||
485 | |||
375 | (add-hook 'text-mode-hook #'variable-pitch-mode) | 486 | (add-hook 'text-mode-hook #'variable-pitch-mode) |
376 | 487 | ||
377 | 488 | ||
489 | ## Padding | ||
490 | |||
491 | This has been taken from ["Ricing Org Mode"](https://lepisma.xyz/2017/10/28/ricing-org-mode/) – of course, I want the typographic niceties everywhere. | ||
492 | |||
493 | (cuss line-spacing 0.1) | ||
494 | |||
495 | |||
378 | # Ease of use | 496 | # Ease of use |
379 | 497 | ||
380 | 498 | ||
381 | ## Selectrum & Prescient | 499 | ## Startup |
500 | |||
501 | I want a minimal screen when I start Emacs. Based on the beauty of configs like [Nicolas Rougier's](https://github.com/rougier/elegant-emacs) [splash screen](https://github.com/rougier/emacs-splash) [experiments](https://github.com/rougier/nano-emacs), I might try my hand at some kind of splash screen or dashboard – but until then, a simple "Hi there!" will suffice 😎 | ||
502 | |||
503 | (cuss inhibit-startup-buffer-menu t) | ||
504 | (cuss inhibit-startup-screen t) | ||
505 | (cuss initial-buffer-choice t) | ||
506 | (cuss initial-scratch-message ";; Hi there!\n") | ||
507 | |||
508 | |||
509 | ## Completing-read niceties | ||
510 | |||
511 | `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. | ||
512 | |||
513 | |||
514 | ### [selectrum](https://github.com/raxod502/selectrum) | ||
515 | |||
516 | `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`. | ||
382 | 517 | ||
383 | (use-package selectrum | 518 | (use-package selectrum |
384 | :config | 519 | :config |
385 | (selectrum-mode 1)) | 520 | (selectrum-mode 1)) |
386 | 521 | ||
522 | |||
523 | ### [prescient](https://github.com/raxod502/prescient.el) | ||
524 | |||
525 | `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 [orderless](https://github.com/oantolin/orderless), enough to maybe try it as well sometime. | ||
526 | |||
387 | (use-package prescient | 527 | (use-package prescient |
388 | :config | 528 | :config |
389 | (prescient-persist-mode 1)) | 529 | (prescient-persist-mode 1)) |
@@ -394,7 +534,44 @@ See [this StackExchange question and answer](https://emacs.stackexchange.com/que | |||
394 | (selectrum-prescient-mode 1)) | 534 | (selectrum-prescient-mode 1)) |
395 | 535 | ||
396 | 536 | ||
397 | ## CtrlF | 537 | ### [consult](https://github.com/minad/cconsult) |
538 | |||
539 | `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. | ||
540 | |||
541 | By the way, the [Reddit announcement thread for consult](https://www.reddit.com/r/emacs/comments/k3c0u7) has a great comment by the author detailing [the differences between different completing-read implementations](https://www.reddit.com/r/emacs/comments/k3c0u7/consult_counselswiper_alternative_for/ge460z3/) that actually is what convinced me to try `consult`. | ||
542 | |||
543 | (use-package consult | ||
544 | :after (selectrum) | ||
545 | :straight (consult | ||
546 | :host github | ||
547 | :repo "minad/consult") | ||
548 | :bind (("C-x b" . consult-buffer) | ||
549 | ("C-x 4 b" . consult-buffer-other-window) | ||
550 | ("C-x 5 b" . consult-buffer-other-frame) | ||
551 | ("M-g o" . consult-outline) | ||
552 | ("M-g l" . consult-line) | ||
553 | ("M-y" . consult-yank-pop) | ||
554 | ("<help> a" . consult-apropos)) | ||
555 | :init | ||
556 | (fset 'multi-occur #'consult-multi-occur) | ||
557 | (consult-annotate-mode) | ||
558 | :config | ||
559 | (setf (alist-get 'execute-extended-command consult-annotate-alist) | ||
560 | #'consult-annotate-command-full)) | ||
561 | |||
562 | |||
563 | ### Ignore case | ||
564 | |||
565 | I don't like holding the Shift key if I can help it. | ||
566 | |||
567 | (cuss completion-ignore-case t) | ||
568 | (cuss read-buffer-completion-ignore-case t) | ||
569 | (cuss read-file-name-completion-ignore-case t) | ||
570 | |||
571 | |||
572 | ## [ctrlf](https://github.com/raxod502/ctrlf) | ||
573 | |||
574 | The biggest reason I use this over the default functionality of `C-s` is that `ctrlf-forward-*` wraps the search around by default. | ||
398 | 575 | ||
399 | (use-package ctrlf | 576 | (use-package ctrlf |
400 | :custom | 577 | :custom |
@@ -408,22 +585,9 @@ See [this StackExchange question and answer](https://emacs.stackexchange.com/que | |||
408 | (ctrlf-mode 1)) | 585 | (ctrlf-mode 1)) |
409 | 586 | ||
410 | 587 | ||
411 | ## Startup | 588 | ## [which-key](https://github.com/justbur/emacs-which-key) |
412 | 589 | ||
413 | (cuss inhibit-startup-buffer-menu t) | 590 | This package is really helpful for discovering functionality. When I get more adept in my Emacs-fu, I might remove this. |
414 | (cuss inhibit-startup-screen t) | ||
415 | (cuss initial-buffer-choice t) | ||
416 | (cuss initial-scratch-message ";; Hi there!\n") | ||
417 | |||
418 | |||
419 | ## Ignore case | ||
420 | |||
421 | (cuss completion-ignore-case t) | ||
422 | (cuss read-buffer-completion-ignore-case t) | ||
423 | (cuss read-file-name-completion-ignore-case t) | ||
424 | |||
425 | |||
426 | ## Which key | ||
427 | 591 | ||
428 | (use-package which-key | 592 | (use-package which-key |
429 | :custom | 593 | :custom |
@@ -434,8 +598,12 @@ See [this StackExchange question and answer](https://emacs.stackexchange.com/que | |||
434 | 598 | ||
435 | ## Miscellaneous settings | 599 | ## Miscellaneous settings |
436 | 600 | ||
601 | Maybe a better title for this section is **Other settings** – or maybe I should put them somewhere else entirely. | ||
602 | |||
437 | 603 | ||
438 | ### Set view mode when in a read-only file | 604 | ### Set `view-mode` when in a read-only file |
605 | |||
606 | `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. | ||
439 | 607 | ||
440 | (cuss view-read-only t) | 608 | (cuss view-read-only t) |
441 | 609 | ||
@@ -447,22 +615,30 @@ See [this StackExchange question and answer](https://emacs.stackexchange.com/que | |||
447 | 615 | ||
448 | ### Enable all functions | 616 | ### Enable all functions |
449 | 617 | ||
618 | By default, Emacs disables some commands, because NeWbIeS wOuLd GeT cOnFuSeD or some ish. I just want to use the dang editor! | ||
619 | |||
450 | (cuss disabled-command-function nil) | 620 | (cuss disabled-command-function nil) |
451 | 621 | ||
452 | 622 | ||
453 | ### Shorter confirmations | 623 | ### Shorter confirmations |
454 | 624 | ||
625 | Instead of making me type *yes* or *no*, just let me hit the *y* or *n* key. | ||
626 | |||
455 | (fset 'yes-or-no-p #'y-or-n-p) | 627 | (fset 'yes-or-no-p #'y-or-n-p) |
456 | 628 | ||
457 | 629 | ||
458 | ### Uniquify buffer names | 630 | ### Uniquify buffer names |
459 | 631 | ||
632 | 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). | ||
633 | |||
460 | (require 'uniquify) | 634 | (require 'uniquify) |
461 | (cuss uniquify-buffer-name-style 'forward) | 635 | (cuss uniquify-buffer-name-style 'forward) |
462 | 636 | ||
463 | 637 | ||
464 | ### Show buffer boundaries | 638 | ### Show buffer boundaries |
465 | 639 | ||
640 | These little L-shaped graphics at the top and bottom of buffers don't do anything, but I like 'em. | ||
641 | |||
466 | (cuss indicate-buffer-boundaries | 642 | (cuss indicate-buffer-boundaries |
467 | '((top . right) | 643 | '((top . right) |
468 | (bottom . right) | 644 | (bottom . right) |
@@ -471,23 +647,14 @@ See [this StackExchange question and answer](https://emacs.stackexchange.com/que | |||
471 | 647 | ||
472 | ### Hippie expand | 648 | ### Hippie expand |
473 | 649 | ||
474 | (global-set-key (kbd "M-/") 'hippie-expand) | 650 | At some point, will probably replace with [company](https://company-mode.github.io/). |
475 | |||
476 | 651 | ||
477 | ### iBuffer | 652 | (global-set-key (kbd "M-/") 'hippie-expand) |
478 | |||
479 | (global-set-key (kbd "C-x C-b") 'ibuffer) | ||
480 | |||
481 | |||
482 | ### Zap-up-to-char, not zap-to-char | ||
483 | |||
484 | (autoload 'zap-up-to-char "misc" | ||
485 | "Kill up to, but not including, ARGth occurrence of CHAR." t) | ||
486 | 653 | ||
487 | (global-set-key (kbd "M-z") 'zap-up-to-char) | ||
488 | 654 | ||
655 | ### "[better defaults](https://git.sr.ht/~technomancy/better-defaults/tree/master/better-defaults.el)" | ||
489 | 656 | ||
490 | ### Other "[better defaults](https://git.sr.ht/~technomancy/better-defaults/tree/master/better-defaults.el)" | 657 | Most of these come from technomancy's repo, linked above, just copy-pasted into here. |
491 | 658 | ||
492 | (cuss save-interprogram-paste-before-kill t) | 659 | (cuss save-interprogram-paste-before-kill t) |
493 | (cuss apropos-do-all t) | 660 | (cuss apropos-do-all t) |
@@ -496,15 +663,34 @@ See [this StackExchange question and answer](https://emacs.stackexchange.com/que | |||
496 | (cuss visible-bell (not (string= (system-name) "larry"))) | 663 | (cuss visible-bell (not (string= (system-name) "larry"))) |
497 | (cuss ediff-window-setup-function #'ediff-setup-windows-plain) | 664 | (cuss ediff-window-setup-function #'ediff-setup-windows-plain) |
498 | 665 | ||
666 | 1. Zap-up-to-char, not zap-to-char | ||
667 | |||
668 | Similarly to `ibuffer`, this is a Better default™. | ||
669 | |||
670 | (autoload 'zap-up-to-char "misc" | ||
671 | "Kill up to, but not including, ARGth occurrence of CHAR." t) | ||
672 | |||
673 | (global-set-key (kbd "M-z") 'zap-up-to-char) | ||
674 | |||
675 | 2. iBuffer | ||
676 | |||
677 | 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. | ||
678 | |||
679 | (global-set-key (kbd "C-x C-b") 'ibuffer) | ||
680 | |||
499 | 681 | ||
500 | ### So-long-mode | 682 | ### So-long-mode |
501 | 683 | ||
684 | I figure, why not go ahead and make Emacs deal with really long lines better? Can't hurt, right? | ||
685 | |||
502 | (if (boundp 'global-so-long-mode) | 686 | (if (boundp 'global-so-long-mode) |
503 | (global-so-long-mode)) | 687 | (global-so-long-mode)) |
504 | 688 | ||
505 | 689 | ||
506 | ### Change `just-one-space` to `cycle-space` | 690 | ### Change `just-one-space` to `cycle-space` |
507 | 691 | ||
692 | 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. | ||
693 | |||
508 | (defun acdw/cycle-spacing-1 () | 694 | (defun acdw/cycle-spacing-1 () |
509 | (interactive) | 695 | (interactive) |
510 | (cycle-spacing -1)) | 696 | (cycle-spacing -1)) |
@@ -514,8 +700,12 @@ See [this StackExchange question and answer](https://emacs.stackexchange.com/que | |||
514 | 700 | ||
515 | # Persistence | 701 | # Persistence |
516 | 702 | ||
703 | 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. | ||
517 | 704 | ||
518 | ## Auto-saves | 705 | |
706 | ## Auto-saves with [super-save](https://github.com/bbatsov/super-save) | ||
707 | |||
708 | 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. | ||
519 | 709 | ||
520 | (use-package super-save | 710 | (use-package super-save |
521 | :custom | 711 | :custom |
@@ -527,6 +717,8 @@ See [this StackExchange question and answer](https://emacs.stackexchange.com/que | |||
527 | 717 | ||
528 | ## Backup files | 718 | ## Backup files |
529 | 719 | ||
720 | To be honest, I probably don't need backup files at all. At some point, I will probably delete this. | ||
721 | |||
530 | (cuss backup-directory-alist | 722 | (cuss backup-directory-alist |
531 | `((".*" . ,(no-littering-expand-var-file-name "backup/")))) | 723 | `((".*" . ,(no-littering-expand-var-file-name "backup/")))) |
532 | 724 | ||
@@ -538,20 +730,26 @@ See [this StackExchange question and answer](https://emacs.stackexchange.com/que | |||
538 | 730 | ||
539 | ## Recent files | 731 | ## Recent files |
540 | 732 | ||
541 | (use-package recentf | 733 | 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 😎 |
542 | :custom-update | 734 | |
543 | (recentf-exclude | 735 | But until then, it's really nice to have a `recentf` list. |
544 | '(no-littering-var-directory | 736 | |
545 | no-littering-etc-directory)) | 737 | (require 'recentf) |
546 | :custom | 738 | |
547 | (recentf-max-menu-items 100) | 739 | (add-to-list 'recentf-exclude |
548 | (recentf-max-saved-items 100) | 740 | '(no-littering-var-directory |
549 | :config | 741 | no-littering-etc-directory)) |
550 | (recentf-mode 1)) | 742 | |
743 | (cuss recentf-max-menu-items 100) | ||
744 | (cuss recentf-max-saved-items 100) | ||
745 | |||
746 | (recentf-mode 1) | ||
551 | 747 | ||
552 | 748 | ||
553 | ### Easily navigate recent files | 749 | ### Easily navigate recent files |
554 | 750 | ||
751 | Now I'm going through this, I might not need this function any more. I'll have to see how `consult` goes. | ||
752 | |||
555 | (defun recentf-find-file () | 753 | (defun recentf-find-file () |
556 | "Find a recent file using `completing-read'." | 754 | "Find a recent file using `completing-read'." |
557 | (interactive) | 755 | (interactive) |
@@ -564,31 +762,39 @@ See [this StackExchange question and answer](https://emacs.stackexchange.com/que | |||
564 | 762 | ||
565 | ## Save places in visited files | 763 | ## Save places in visited files |
566 | 764 | ||
567 | (use-package saveplace | 765 | (require 'saveplace) |
568 | :custom | 766 | |
569 | (save-place-file (no-littering-expand-var-file-name "places")) | 767 | (cuss save-place-file (no-littering-expand-var-file-name "places")) |
570 | (save-place-forget-unreadable-files (not | 768 | |
571 | (eq system-type 'windows-nt)) | 769 | (cuss save-place-forget-unreadable-files |
572 | :config | 770 | (not (eq system-type 'windows-nt))) |
573 | (save-place-mode 1))) | 771 | |
772 | (save-place-mode 1) | ||
574 | 773 | ||
575 | 774 | ||
576 | ## Save history | 775 | ## Save history |
577 | 776 | ||
578 | (use-package savehist | 777 | (require 'savehist) |
579 | :custom | 778 | |
580 | (savehist-additional-variables | 779 | (cuss savehist-additional-variables |
581 | '(kill-ring | 780 | '(kill-ring |
582 | search-ring | 781 | search-ring |
583 | regexp-search-ring)) | 782 | regexp-search-ring)) |
584 | (savehist-save-minibuffer-history t) | ||
585 | (history-length t) | ||
586 | (history-delete-duplicates t) | ||
587 | :config | ||
588 | (savehist-mode 1)) | ||
589 | 783 | ||
784 | (cuss savehist-save-minibuffer-history t) | ||
590 | 785 | ||
591 | ## Undo | 786 | (cuss history-length t) |
787 | |||
788 | (cuss history-delete-duplicates t) | ||
789 | |||
790 | (savehist-mode 1) | ||
791 | |||
792 | |||
793 | ## Undo: [undo-fu-session](https://gitlab.com/ideasman42/emacs-undo-fu-session) | ||
794 | |||
795 | 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. | ||
796 | |||
797 | Note to self: if I *do* switch away from `undo-fu`, look at [undohist](https://github.com/emacsorphanage/undohist). | ||
592 | 798 | ||
593 | (use-package undo-fu-session | 799 | (use-package undo-fu-session |
594 | :after (no-littering undo-fu) | 800 | :after (no-littering undo-fu) |
@@ -607,6 +813,8 @@ See [this StackExchange question and answer](https://emacs.stackexchange.com/que | |||
607 | 813 | ||
608 | ## File encoding | 814 | ## File encoding |
609 | 815 | ||
816 | 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. | ||
817 | |||
610 | I'm going to be honest – most of this is a stab in the dark. | 818 | I'm going to be honest – most of this is a stab in the dark. |
611 | 819 | ||
612 | (set-language-environment 'utf-8) | 820 | (set-language-environment 'utf-8) |
@@ -627,7 +835,9 @@ I'm going to be honest – most of this is a stab in the dark. | |||
627 | (add-hook 'find-file-hooks #'acdw/no-junk-please-were-unixish) | 835 | (add-hook 'find-file-hooks #'acdw/no-junk-please-were-unixish) |
628 | 836 | ||
629 | 837 | ||
630 | ## Undo | 838 | ## [undo-fu](https://gitlab.com/ideasman42/emacs-undo-fu) |
839 | |||
840 | 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. | ||
631 | 841 | ||
632 | (use-package undo-fu | 842 | (use-package undo-fu |
633 | :bind | 843 | :bind |
@@ -635,7 +845,9 @@ I'm going to be honest – most of this is a stab in the dark. | |||
635 | ("C-?" . undo-fu-only-redo)) | 845 | ("C-?" . undo-fu-only-redo)) |
636 | 846 | ||
637 | 847 | ||
638 | ## Find/replace | 848 | ## Find/replace: [visual-regexp](https://github.com/benma/visual-regexp.el) |
849 | |||
850 | 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. | ||
639 | 851 | ||
640 | (use-package visual-regexp | 852 | (use-package visual-regexp |
641 | :bind | 853 | :bind |
@@ -646,14 +858,20 @@ I'm going to be honest – most of this is a stab in the dark. | |||
646 | ## Visual editing | 858 | ## Visual editing |
647 | 859 | ||
648 | 860 | ||
649 | ### Volatile highlights | 861 | ### [volatile-highlights](https://github.com/k-talo/volatile-highlights.el) |
862 | |||
863 | Highlights text changed by certain operations. | ||
650 | 864 | ||
651 | (use-package volatile-highlights | 865 | (use-package volatile-highlights |
652 | :config | 866 | :config |
653 | (volatile-highlights-mode 1)) | 867 | (volatile-highlights-mode 1)) |
654 | 868 | ||
655 | 869 | ||
656 | ### Expand region | 870 | ### [expand-region](https://github.com/magnars/expand-region.el) |
871 | |||
872 | I don't use this a *ton*, but not because it's not useful – I just forget it's there sometimes. | ||
873 | |||
874 | Basically, it allows you to do like a Kakoune-style incremental widening of the selection by semantic units. | ||
657 | 875 | ||
658 | (use-package expand-region | 876 | (use-package expand-region |
659 | :bind | 877 | :bind |
@@ -663,19 +881,25 @@ I'm going to be honest – most of this is a stab in the dark. | |||
663 | 881 | ||
664 | ## Clean up white space on save | 882 | ## Clean up white space on save |
665 | 883 | ||
884 | 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. | ||
885 | |||
666 | (add-hook 'before-save-hook #'whitespace-cleanup) | 886 | (add-hook 'before-save-hook #'whitespace-cleanup) |
667 | (add-hook 'before-save-hook #'delete-trailing-whitespace) | 887 | (add-hook 'before-save-hook #'delete-trailing-whitespace) |
668 | 888 | ||
669 | 889 | ||
670 | ## Automatically revert a file to what it is on disk | 890 | ## Automatically revert a file to what it is on disk |
671 | 891 | ||
892 | Revert a buffer to reflect what's on disk if it's changed outside of Emacs. | ||
893 | |||
672 | (global-auto-revert-mode 1) | 894 | (global-auto-revert-mode 1) |
673 | 895 | ||
674 | 896 | ||
675 | # Writing | 897 | # Writing |
676 | 898 | ||
899 | Configurations related to writing prose or verse. | ||
900 | |||
677 | 901 | ||
678 | ## Word count | 902 | ## Word count: [wc-mode](https://github.com/bnbeckwith/wc-mode) |
679 | 903 | ||
680 | (use-package wc-mode | 904 | (use-package wc-mode |
681 | :config | 905 | :config |
@@ -683,7 +907,9 @@ I'm going to be honest – most of this is a stab in the dark. | |||
683 | :hook text-mode) | 907 | :hook text-mode) |
684 | 908 | ||
685 | 909 | ||
686 | ## Visual fill column mode | 910 | ## [visual-fill-column-mode](https://github.com/joostkremers/visual-fill-column) |
911 | |||
912 | Center the text part of the frame within a `fill-column`-sized area in the frame as a whole. | ||
687 | 913 | ||
688 | (use-package visual-fill-column | 914 | (use-package visual-fill-column |
689 | :custom | 915 | :custom |
@@ -698,7 +924,22 @@ I'm going to be honest – most of this is a stab in the dark. | |||
698 | (text-mode . visual-fill-column-mode)) | 924 | (text-mode . visual-fill-column-mode)) |
699 | 925 | ||
700 | 926 | ||
701 | ## Org mode | 927 | ### Fix mouse bindings |
928 | |||
929 | In `visual-fill-column-mode`, mouse bindings on the margins don't work. In fact, they don't work when *not* in `visual-fill-column-mode`. Let's bind those bindings. | ||
930 | |||
931 | (bind-key [left-margin wheel-down] 'scroll-down-command) | ||
932 | (bind-key [right-margin wheel-down] 'scroll-down-command) | ||
933 | |||
934 | (bind-key [left-margin wheel-up] 'scroll-up-command) | ||
935 | (bind-key [right-margin wheel-up] 'scroll-up-command) | ||
936 | |||
937 | |||
938 | ## [org-mode](https://orgmode.org/) | ||
939 | |||
940 | Pretty self-explanatory, I think… | ||
941 | |||
942 | I need to break this config up and like, comment it better. | ||
702 | 943 | ||
703 | (use-package org | 944 | (use-package org |
704 | :custom | 945 | :custom |
@@ -707,10 +948,25 @@ I'm going to be honest – most of this is a stab in the dark. | |||
707 | (org-hide-emphasis-markers t) | 948 | (org-hide-emphasis-markers t) |
708 | (org-fontify-done-headline t) | 949 | (org-fontify-done-headline t) |
709 | (org-fontify-whole-heading-line t) | 950 | (org-fontify-whole-heading-line t) |
951 | (org-fontify-quote-and-verse-blocks t) | ||
710 | (org-hide-leading-stars t) | 952 | (org-hide-leading-stars t) |
711 | (org-hidden-keywords '(author date title)) | 953 | (org-hidden-keywords '(author date title)) |
712 | (org-src-window-setup 'current-window) | 954 | (org-src-window-setup 'current-window) |
713 | (org-pretty-entities t)) | 955 | (org-pretty-entities t) |
956 | (org-ellipsis " ⋯ ")) | ||
957 | |||
958 | |||
959 | ### Make bullets look like centered dots | ||
960 | |||
961 | from [zzamboni.org](https://zzamboni.org/post/beautifying-org-mode-in-emacs/) | ||
962 | |||
963 | (font-lock-add-keywords | ||
964 | 'org-mode | ||
965 | '(("^ *\\([-+]\\) " | ||
966 | (0 (prog1 () | ||
967 | (compose-region (match-beginning 1) | ||
968 | (match-end 1) | ||
969 | "•")))))) | ||
714 | 970 | ||
715 | 971 | ||
716 | ### Enable markdown export | 972 | ### Enable markdown export |
@@ -869,18 +1125,26 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#org-return-dwim) | |||
869 | 1125 | ||
870 | # Coding | 1126 | # Coding |
871 | 1127 | ||
1128 | The Other Thing Emacs is Good For. | ||
1129 | |||
872 | 1130 | ||
873 | ## Formatting | 1131 | ## Formatting |
874 | 1132 | ||
875 | 1133 | ||
876 | ### Indenting | 1134 | ### Indenting: [aggressive-indent-mode](https://github.com/Malabarba/aggressive-indent-mode) |
1135 | |||
1136 | 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. | ||
877 | 1137 | ||
878 | (use-package aggressive-indent | 1138 | (use-package aggressive-indent |
1139 | :init | ||
1140 | (electric-indent-mode -1) | ||
879 | :config | 1141 | :config |
880 | (global-aggressive-indent-mode 1)) | 1142 | (global-aggressive-indent-mode 1)) |
881 | 1143 | ||
882 | 1144 | ||
883 | ### Smart tabs | 1145 | ### [Smart tabs](https://github.com/jcsalomon/smarttabs) |
1146 | |||
1147 | 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. | ||
884 | 1148 | ||
885 | (use-package smart-tabs-mode | 1149 | (use-package smart-tabs-mode |
886 | :custom | 1150 | :custom |
@@ -897,6 +1161,8 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#org-return-dwim) | |||
897 | 1161 | ||
898 | ### Prettify symbols mode | 1162 | ### Prettify symbols mode |
899 | 1163 | ||
1164 | By default, I think `prettify-symbols-mode` only changes `lambda` to `λ`. I should, at some point, add some prettified symbols. | ||
1165 | |||
900 | (add-hook 'prog-mode-hook #'prettify-symbols-mode) | 1166 | (add-hook 'prog-mode-hook #'prettify-symbols-mode) |
901 | 1167 | ||
902 | 1168 | ||
@@ -904,10 +1170,14 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#org-return-dwim) | |||
904 | 1170 | ||
905 | 1. `show-paren-style` | 1171 | 1. `show-paren-style` |
906 | 1172 | ||
1173 | 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. | ||
1174 | |||
907 | (cuss show-paren-style 'mixed) | 1175 | (cuss show-paren-style 'mixed) |
908 | (show-paren-mode 1) | 1176 | (show-paren-mode 1) |
909 | 1177 | ||
910 | 2. Smartparens | 1178 | 2. [smartparens](https://github.com/Fuco1/smartparens) |
1179 | |||
1180 | Automagically close pairs and stuff. See also [ParEdit](https://www.emacswiki.org/emacs/ParEdit) – maybe test that one? | ||
911 | 1181 | ||
912 | (use-package smartparens | 1182 | (use-package smartparens |
913 | :init | 1183 | :init |
@@ -917,13 +1187,17 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#org-return-dwim) | |||
917 | :hook | 1187 | :hook |
918 | (prog-mode . acdw/setup-smartparens)) | 1188 | (prog-mode . acdw/setup-smartparens)) |
919 | 1189 | ||
920 | 3. Rainbow delimiters | 1190 | 3. [rainbow-delimiters](https://github.com/Fanael/rainbow-delimiters) |
1191 | |||
1192 | Show different pairs of delimiters in diffferent colors. Pretty! Useful! | ||
921 | 1193 | ||
922 | (use-package rainbow-delimiters | 1194 | (use-package rainbow-delimiters |
923 | :hook (prog-mode . rainbow-delimiters-mode)) | 1195 | :hook (prog-mode . rainbow-delimiters-mode)) |
924 | 1196 | ||
925 | 1197 | ||
926 | ### Rainbow mode | 1198 | ### [rainbow-mode](https://elpa.gnu.org/packages/rainbow-mode.html) |
1199 | |||
1200 | Show different colors *in that color*. Useful! Pretty! | ||
927 | 1201 | ||
928 | (use-package rainbow-mode | 1202 | (use-package rainbow-mode |
929 | :custom | 1203 | :custom |
@@ -933,6 +1207,8 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#org-return-dwim) | |||
933 | 1207 | ||
934 | ### Line numbers | 1208 | ### Line numbers |
935 | 1209 | ||
1210 | 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. | ||
1211 | |||
936 | (defun acdw/enable-line-numbers () | 1212 | (defun acdw/enable-line-numbers () |
937 | "Enable line numbers, either through `display-line-numbers-mode' | 1213 | "Enable line numbers, either through `display-line-numbers-mode' |
938 | or through `linum-mode'." | 1214 | or through `linum-mode'." |
@@ -948,6 +1224,8 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#org-return-dwim) | |||
948 | 1224 | ||
949 | ## Programming languages | 1225 | ## Programming languages |
950 | 1226 | ||
1227 | These are the programming languages I (don't really) use. | ||
1228 | |||
951 | 1229 | ||
952 | ### Fish shell | 1230 | ### Fish shell |
953 | 1231 | ||
@@ -1001,14 +1279,25 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#org-return-dwim) | |||
1001 | 1279 | ||
1002 | # Applications | 1280 | # Applications |
1003 | 1281 | ||
1282 | Of course, the real reason we love emacs is for the application layer. What is it they say? | ||
1283 | |||
1284 | > Emacs is a great operating system, lacking only a decent editor. | ||
1285 | |||
1286 | Yeah, that's it 😎 | ||
1287 | |||
1004 | 1288 | ||
1005 | ## Git | 1289 | ## Git: [magit](https://magit.vc/) |
1290 | |||
1291 | The magical porcelain. | ||
1006 | 1292 | ||
1007 | (use-package magit | 1293 | (use-package magit |
1008 | :bind | 1294 | :bind |
1009 | ("C-x g" . magit-status) | 1295 | ("C-x g" . magit-status) |
1010 | :custom-update | 1296 | :custom-update |
1011 | (magit-no-confirm '(stage-all-changes))) | 1297 | (magit-no-confirm '(stage-all-changes)) |
1298 | :config | ||
1299 | (add-hook 'magit-process-find-password-functions | ||
1300 | #'magit-process-password-auth-source)) | ||
1012 | 1301 | ||
1013 | 1302 | ||
1014 | ### Hook into `prescient` | 1303 | ### Hook into `prescient` |
@@ -1044,6 +1333,8 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#org-return-dwim) | |||
1044 | 1333 | ||
1045 | ## Dired | 1334 | ## Dired |
1046 | 1335 | ||
1336 | I'm still figuring out what all I can do with `dired`. | ||
1337 | |||
1047 | (with-eval-after-load 'dired | 1338 | (with-eval-after-load 'dired |
1048 | (cuss dired-dwim-target t) | 1339 | (cuss dired-dwim-target t) |
1049 | (cuss dired-listing-switches "-alDh") | 1340 | (cuss dired-listing-switches "-alDh") |
@@ -1052,8 +1343,20 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#org-return-dwim) | |||
1052 | (bind-key "C-c w" #'wdired-change-to-wdired-mode 'dired-mode-map)) | 1343 | (bind-key "C-c w" #'wdired-change-to-wdired-mode 'dired-mode-map)) |
1053 | 1344 | ||
1054 | 1345 | ||
1346 | ### dired-subtree | ||
1347 | |||
1348 | Part of the [dired-hacks](https://github.com/Fuco1/dired-hacks) package. | ||
1349 | |||
1350 | (use-package dired-subtree | ||
1351 | :bind (:map dired-mode-map | ||
1352 | (("i" . dired-subtree-insert) | ||
1353 | (";" . dired-subtree-remove)))) | ||
1354 | |||
1355 | |||
1055 | ## Proced | 1356 | ## Proced |
1056 | 1357 | ||
1358 | The process editor. | ||
1359 | |||
1057 | (defun acdw/setup-proced () | 1360 | (defun acdw/setup-proced () |
1058 | (variable-pitch-mode -1) | 1361 | (variable-pitch-mode -1) |
1059 | (toggle-truncate-lines 1) | 1362 | (toggle-truncate-lines 1) |
@@ -1062,7 +1365,14 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#org-return-dwim) | |||
1062 | (add-hook 'proced-mode-hook #'acdw/setup-proced) | 1365 | (add-hook 'proced-mode-hook #'acdw/setup-proced) |
1063 | 1366 | ||
1064 | 1367 | ||
1065 | ## Elpher | 1368 | ## Gemini (and gopher) |
1369 | |||
1370 | |||
1371 | ### [elpher](https://thelambdalab.xyz/elpher/) | ||
1372 | |||
1373 | Actually, `elpher` is the reason I started using Emacs. So thanks, smol web denizens! | ||
1374 | |||
1375 | Fun fact: these packages are *also* why I use `straight.el`, since they're none of them on GitHub. | ||
1066 | 1376 | ||
1067 | (use-package elpher | 1377 | (use-package elpher |
1068 | :straight (elpher | 1378 | :straight (elpher |
@@ -1094,6 +1404,11 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#org-return-dwim) | |||
1094 | :hook | 1404 | :hook |
1095 | (elpher-mode . visual-fill-column-mode)) | 1405 | (elpher-mode . visual-fill-column-mode)) |
1096 | 1406 | ||
1407 | |||
1408 | ### [gemini-mode](https://git.carcosa.net/jmcbray/gemini.el) | ||
1409 | |||
1410 | A major mode for `text/gemini` files. I've changed the headings to match Elpher's. | ||
1411 | |||
1097 | (use-package gemini-mode | 1412 | (use-package gemini-mode |
1098 | :straight (gemini-mode | 1413 | :straight (gemini-mode |
1099 | :repo "https://git.carcosa.net/jmcbray/gemini.el.git") | 1414 | :repo "https://git.carcosa.net/jmcbray/gemini.el.git") |
@@ -1105,29 +1420,48 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#org-return-dwim) | |||
1105 | ((t (:inherit (elpher-gemini-heading2))))) | 1420 | ((t (:inherit (elpher-gemini-heading2))))) |
1106 | (gemini-heading-face3 | 1421 | (gemini-heading-face3 |
1107 | ((t (:inherit (elpher-gemini-heading3))))) | 1422 | ((t (:inherit (elpher-gemini-heading3))))) |
1423 | :init | ||
1424 | (defun acdw/setup-gemini-mode () | ||
1425 | (visual-fill-column-mode 1) | ||
1426 | (variable-pitch-mode -1)) | ||
1108 | :hook | 1427 | :hook |
1109 | (gemini-mode . visual-fill-column-mode)) | 1428 | (gemini-mode . acdw/setup-gemini-mode)) |
1429 | |||
1430 | |||
1431 | ### [gemini-write](https://alexschroeder.ch/cgit/gemini-write/about/) | ||
1432 | |||
1433 | Alex Schroeder's Emacs implementation of the Titan protocol. This is why I use his Gemini server, [Phoebe](https://alexschroeder.ch/cgit/phoebe/)! | ||
1110 | 1434 | ||
1111 | (use-package gemini-write | 1435 | (use-package gemini-write |
1112 | :straight (gemini-write | 1436 | :straight (gemini-write |
1113 | :repo "https://alexschroeder.ch/cgit/gemini-write") | 1437 | :repo "https://alexschroeder.ch/cgit/gemini-write") |
1114 | :config | 1438 | :config |
1115 | (add-to-list 'elpher-gemini-tokens | 1439 | (when (boundp 'acdw-secrets/elpher-gemini-tokens) |
1116 | (acdw-secrets/elpher-gemini-tokens))) | 1440 | (add-to-list 'elpher-gemini-tokens |
1441 | acdw-secrets/elpher-gemini-tokens))) | ||
1442 | |||
1443 | |||
1444 | ### [post-to-gemlog-blue](https://git.sr.ht/~acdw/post-to-gemlog-blue.el) | ||
1445 | |||
1446 | My first (!) Emacs package, to allow posting to [gemlog.blue's web interface](https://gemlog.blue). I don't use gemlog.blue any more, but if I didn't have this package, no one would 😎 | ||
1117 | 1447 | ||
1118 | (use-package post-to-gemlog-blue | 1448 | (use-package post-to-gemlog-blue |
1119 | :straight (post-to-gemlog-blue | 1449 | :straight (post-to-gemlog-blue |
1120 | :repo "https://git.sr.ht/~acdw/post-to-gemlog-blue.el")) | 1450 | :repo "https://git.sr.ht/~acdw/post-to-gemlog-blue.el")) |
1121 | 1451 | ||
1122 | 1452 | ||
1123 | ## Pastebin (0x0) | 1453 | ## Pastebin: [0x0](https://git.sr.ht/~zge/nullpointer-emacs) |
1454 | |||
1455 | Pastebins are so useful. Now I can use them from Emacs. | ||
1124 | 1456 | ||
1125 | (use-package 0x0 | 1457 | (use-package 0x0 |
1126 | :custom | 1458 | :custom |
1127 | (0x0-default-service 'ttm)) | 1459 | (0x0-default-service 'ttm)) |
1128 | 1460 | ||
1129 | 1461 | ||
1130 | ## Mu4e | 1462 | ## [mu4e](https://www.djcbsoftware.nl/code/mu/mu4e.html) |
1463 | |||
1464 | I've just recently started (again) using mu4e. We'll see how it goes. | ||
1131 | 1465 | ||
1132 | (when (executable-find "mu") | 1466 | (when (executable-find "mu") |
1133 | (add-to-list 'load-path | 1467 | (add-to-list 'load-path |
@@ -1213,3 +1547,14 @@ if ! emacsclient -nc "$@" 2>/dev/null; then | |||
1213 | emacs --daemon | 1547 | emacs --daemon |
1214 | emacsclient -nc "$@" | 1548 | emacsclient -nc "$@" |
1215 | fi | 1549 | fi |
1550 | |||
1551 | |||
1552 | # Appendix B: areas for further research | ||
1553 | |||
1554 | - [ebuku](https://github.com/flexibeast/ebuku) (of course, I'd need [buku](https://github.com/jarun/buku) as well) – bookmarks | ||
1555 | - [KeePassXC as Secret Service](https://www.billdietrich.me/Authentication.html?expandall=1#KeePassXCandSecretService) | ||
1556 | - [Ignoramus](https://github.com/rolandwalker/ignoramus) – this might not e necessary | ||
1557 | - [Dynamic fonts](https://github.com/rolandwalker/dynamic-fonts) – take a look @ this and compare with my fonts section | ||
1558 | - [Simple clipboard integration](https://github.com/rolandwalker/simpleclip) – test with Windows, maybe | ||
1559 | - [visible mark](https://git.sr.ht/~iank/visible-mark) – show where the marks are … | ||
1560 | - consider this Reddit thread: [speeding up magit](https://www.reddit.com/r/emacs/comments/k3xfa1/speeding_up_magit/) | ||