about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--README.md658
-rw-r--r--config.org332
2 files changed, 706 insertions, 284 deletions
diff --git a/README.md b/README.md index fd7ed85..6a727f9 100644 --- a/README.md +++ b/README.md
@@ -1,86 +1,97 @@
1 1
2# Table of Contents 2# Table of Contents
3 3
41. [Pave the way](#org24d31f9) 41. [Pave the way](#org8865364)
5 1. [Correct `exec-path`](#org82dd805) 5 1. [Correct `exec-path`](#orga7e2c6f)
6 2. [Package management](#org947e1de) 6 2. [Package management](#org3148c95)
7 1. [Straight.el](#orgd711f6b) 7 1. [Straight.el](#orgfaed4fc)
8 2. [Use-package](#org9392b5d) 8 2. [Use-package](#org41bc53b)
9 3. [Extra use-package keywords](#orgc93ae09) 9 3. [Extra use-package keywords](#org1849e90)
10 3. [Customize variables](#org7cae7fe) 10 3. [Customize variables](#orgc528316)
11 1. [Put customizations in a separate file](#org126d855) 11 1. [Put customizations in a separate file](#orgf585c3e)
12 2. [A macro for ease of customization](#org2cf1d1a) 12 2. [A macro for ease of customization](#orgad4e3a9)
13 4. [Keep a tidy `~/.emacs`](#orga6c0096) 13 4. [Keep a tidy `~/.emacs`](#orgf4003c0)
142. [Look and Feel](#org1ecbcc5) 142. [Look and Feel](#org11edc2b)
15 1. [Simplify the UI](#org23fb19e) 15 1. [Simplify the UI](#orgb076fea)
16 1. [Tool bars and menu bars](#orgad64258) 16 1. [Tool bars and menu bars](#org586efe9)
17 2. [Scroll bars](#org9b2f49e) 17 2. [Scroll bars](#org298e07a)
18 3. [Dialog boxen](#orgf1c5f65) 18 3. [Dialog boxen](#org439037b)
19 4. [Shorten confirmations](#orgedf9e78) 19 4. [Shorten confirmations](#orgbb289dc)
20 5. [Remove the bell](#org1643ce2) 20 5. [Remove the bell](#org2d64864)
21 6. [Tell Ediff to setup windows better](#org3996a6f) 21 6. [Tell Ediff to setup windows better](#org0b4a638)
22 2. [Tweak the remaining UI](#orgcdf874b) 22 2. [Tweak the remaining UI](#org2ca3449)
23 1. [Window dividers](#org187505c) 23 1. [Fringes](#orgae020e2)
24 2. [Fringes](#org3fd2bc6) 24 2. [Minibuffer](#orgc8f4148)
25 3. [Minibuffer](#org8ff32ea) 25 3. [Tabs](#org83e5b37)
26 4. [Tabs](#orgef2a000) 26 4. [Cursor](#org818f06f)
27 5. [Cursor](#orge57d1b2) 27 5. [Buffer names](#org403cbfb)
28 6. [Buffer names](#orgb3f29a9) 28 6. [Buffer boundaries](#org86d72cc)
29 7. [Buffer boundaries](#org2627b1e) 29 3. [Startup](#org06a8610)
30 3. [Startup](#org1fc3c6d) 30 4. [Theme](#org3cecd0a)
31 4. [Theme](#org207a1bd) 31 1. [Modeline](#org1cecd04)
32 1. [Fonts](#org52f6c8c) 32 2. [Fonts](#org52f810d)
333. [Interactivity](#org6cbcfe5) 333. [Interactivity](#orgb1b190a)
34 1. [Selectrum](#org7f26398) 34 1. [Selectrum](#orge91bc0a)
35 2. [Prescient](#orgea8df9e) 35 2. [Prescient](#org2dec02d)
36 3. [Consult](#org8818eb9) 36 3. [Consult](#org793390e)
37 4. [Marginalia](#orgd31a964) 37 4. [Ignore case](#orgf0e1425)
38 5. [Ignore case](#org6e4913f) 38 5. [Search](#orgcb1ee5e)
39 6. [Search](#org416dd18) 39 6. [Mouse](#orgf588a26)
404. [Persistence](#orgb20768d) 404. [Persistence](#orgb6ade5d)
41 1. [Save history](#org7dfee32) 41 1. [Save history](#org9a6f451)
42 2. [Save places in files](#org0f20005) 42 2. [Save places in files](#org3041895)
43 3. [Recent files](#org6d1a477) 43 3. [Recent files](#orgfddf139)
44 1. [Easily navigate recent files](#org9368a6b) 44 1. [Easily navigate recent files](#org5211a84)
45 4. [Undo](#orgbb4f91a) 45 4. [Undo](#org203b48b)
465. [Editing](#org52b008a) 465. [Editing](#org697ec47)
47 1. [Operate visually on lines](#orgce838ba) 47 1. [Operate visually on lines](#org958bd79)
48 2. [Require a final newline](#org6f67996) 48 2. [Require a final newline](#orgc5ef3b6)
49 3. [Killing & Yanking](#orga2bdb3e) 49 3. [Killing & Yanking](#orgba62063)
50 1. [Replace selection when typing](#org16c1a6b) 50 1. [Replace selection when typing](#orgcb04f02)
51 2. [Save existing clipboard text into kill ring before replacing it](#orgea7fd73) 51 2. [Save existing clipboard text into kill ring before replacing it](#orgdf80771)
52 4. [So long mode](#org27f430f) 52 4. [So long mode](#org2252a8b)
536. [Files](#org8cc8ee8) 53 5. [Multiple cursors](#org6fe3b6b)
54 1. [Encoding](#org8ca2e9b) 54 6. [Expand region](#orgfe5b963)
55 1. [UTF-8](#org54363a7) 556. [Files](#org0b92a32)
56 2. [Convert all files to UNIX-style line endings](#orgeaed3bd) 56 1. [Encoding](#orgf1babbf)
57 2. [Backups](#org7239c47) 57 1. [UTF-8](#org8dd350d)
58 3. [Auto-saves](#org32fc658) 58 2. [Convert all files to UNIX-style line endings](#org34854a5)
59 4. [Revert files](#org94456e2) 59 2. [Backups](#org184d029)
60 5. [Add a timestamp to files](#orgb586b3b) 60 3. [Auto-saves](#org72595b4)
617. [Programming](#org738fbd9) 61 4. [Revert files](#orgd374486)
62 1. [Which function are we in?](#org080eb2f) 62 5. [Add a timestamp to files](#org8ac0e64)
638. [Writing](#org6bf5097) 637. [Programming](#org97bb90c)
64 1. [Visual Fill Column](#org6f01971) 64 1. [Which function are we in?](#orgbcce753)
65 2. [Type nice-looking quote-type marks](#org03e747d) 65 2. [Parentheses](#org7d7c4d6)
669. [Applications](#org9528516) 66 1. [Show parentheses](#orgbe3915d)
67 1. [Magit](#orgd2a60aa) 67 2. [Smart parentheses](#org9415ceb)
6810. [Appendices](#org7339cf2) 68 3. [Line numbers](#org2ebc45e)
69 1. [Emacs' files](#org6070b2c) 698. [Writing](#orge8c66c9)
70 1. [init.el](#org0d720f6) 70 1. [Visual Fill Column](#org5278827)
71 2. [early-init.el](#orgd6bffd2) 71 2. [Type nice-looking quote-type marks](#org63bd7b9)
72 2. [Ease tangling and loading of Emacs' init](#org9c5b437) 729. [Applications](#org50abb5d)
73 3. [License](#org1a4bb4d) 73 1. [Magit](#orgf68bfba)
74 1. [Note on the license](#orga6047ee) 74 2. [Org mode](#org66c3b6b)
75 75 1. [Export to markdown](#org34de14b)
76 76 2. [Make bullets look like bullets](#orge32cf6b)
77 77 3. [A better return in Org mode](#org5d13ece)
78<a id="org24d31f9"></a> 7810. [Appendices](#org1c0423c)
79 1. [Emacs' files](#orgea74573)
80 1. [init.el](#org1ed6b18)
81 2. [early-init.el](#org1e22a5e)
82 2. [Ease tangling and loading of Emacs' init](#org50bd83d)
83 3. [License](#org551e420)
84 1. [Note on the license](#org15f94a8)
85 4. [Keymaps for *this* file](#org3bda9ee)
86
87
88
89<a id="org8865364"></a>
79 90
80# Pave the way 91# Pave the way
81 92
82 93
83<a id="org82dd805"></a> 94<a id="orga7e2c6f"></a>
84 95
85## Correct `exec-path` 96## Correct `exec-path`
86 97
@@ -102,12 +113,12 @@
102 (add-to-list 'exec-path path)))) 113 (add-to-list 'exec-path path))))
103 114
104 115
105<a id="org947e1de"></a> 116<a id="org3148c95"></a>
106 117
107## Package management 118## Package management
108 119
109 120
110<a id="orgd711f6b"></a> 121<a id="orgfaed4fc"></a>
111 122
112### Straight.el 123### Straight.el
113 124
@@ -125,15 +136,16 @@
125 (load bootstrap-file nil 'nomessage)) 136 (load bootstrap-file nil 'nomessage))
126 137
127 138
128<a id="org9392b5d"></a> 139<a id="org41bc53b"></a>
129 140
130### Use-package 141### Use-package
131 142
132 (setq straight-use-package-by-default t) 143 (setq straight-use-package-by-default t)
144 (setq use-package-hook-name-suffix nil)
133 (straight-use-package 'use-package) 145 (straight-use-package 'use-package)
134 146
135 147
136<a id="orgc93ae09"></a> 148<a id="org1849e90"></a>
137 149
138### Extra use-package keywords 150### Extra use-package keywords
139 151
@@ -141,18 +153,18 @@
141 153
142 (straight-use-package 154 (straight-use-package
143 '(use-package-custom-update 155 '(use-package-custom-update
144 :host "github" 156 :host github
145 :repo "a13/use-package-custom-update")) 157 :repo "a13/use-package-custom-update"))
146 158
147 (require 'use-package-custom-update) 159 (require 'use-package-custom-update)
148 160
149 161
150<a id="org7cae7fe"></a> 162<a id="orgc528316"></a>
151 163
152## Customize variables 164## Customize variables
153 165
154 166
155<a id="org126d855"></a> 167<a id="orgf585c3e"></a>
156 168
157### Put customizations in a separate file 169### Put customizations in a separate file
158 170
@@ -160,7 +172,7 @@
160 (expand-file-name "custom.el" user-emacs-directory)) 172 (expand-file-name "custom.el" user-emacs-directory))
161 173
162 174
163<a id="org2cf1d1a"></a> 175<a id="orgad4e3a9"></a>
164 176
165### A macro for ease of customization 177### A macro for ease of customization
166 178
@@ -170,7 +182,7 @@
170 ',var ,val)) 182 ',var ,val))
171 183
172 184
173<a id="orga6c0096"></a> 185<a id="orgf4003c0"></a>
174 186
175## Keep a tidy `~/.emacs` 187## Keep a tidy `~/.emacs`
176 188
@@ -196,17 +208,17 @@
196 (make-directory (no-littering-expand-var-file-name dir) t)) 208 (make-directory (no-littering-expand-var-file-name dir) t))
197 209
198 210
199<a id="org1ecbcc5"></a> 211<a id="org11edc2b"></a>
200 212
201# Look and Feel 213# Look and Feel
202 214
203 215
204<a id="org23fb19e"></a> 216<a id="orgb076fea"></a>
205 217
206## Simplify the UI 218## Simplify the UI
207 219
208 220
209<a id="orgad64258"></a> 221<a id="org586efe9"></a>
210 222
211### Tool bars and menu bars 223### Tool bars and menu bars
212 224
@@ -218,7 +230,7 @@
218 (tool-bar-mode -1) 230 (tool-bar-mode -1)
219 231
220 232
221<a id="org9b2f49e"></a> 233<a id="org298e07a"></a>
222 234
223### Scroll bars 235### Scroll bars
224 236
@@ -229,28 +241,28 @@
229 (horizontal-scroll-bar-mode -1) 241 (horizontal-scroll-bar-mode -1)
230 242
231 243
232<a id="orgf1c5f65"></a> 244<a id="org439037b"></a>
233 245
234### Dialog boxen 246### Dialog boxen
235 247
236 (cuss use-dialog-box nil) 248 (cuss use-dialog-box nil)
237 249
238 250
239<a id="orgedf9e78"></a> 251<a id="orgbb289dc"></a>
240 252
241### Shorten confirmations 253### Shorten confirmations
242 254
243 (fset 'yes-or-no-p #'y-or-n-p) 255 (fset 'yes-or-no-p #'y-or-n-p)
244 256
245 257
246<a id="org1643ce2"></a> 258<a id="org2d64864"></a>
247 259
248### Remove the bell 260### Remove the bell
249 261
250 (cuss visible-bell (not (string= (system-name) "larry"))) 262 (cuss visible-bell (not (string= (system-name) "larry")))
251 263
252 264
253<a id="org3996a6f"></a> 265<a id="org0b4a638"></a>
254 266
255### Tell Ediff to setup windows better 267### Tell Ediff to setup windows better
256 268
@@ -258,20 +270,12 @@
258 (cuss ediff-window-setup-function #'ediff-setup-windows-plain) 270 (cuss ediff-window-setup-function #'ediff-setup-windows-plain)
259 271
260 272
261<a id="orgcdf874b"></a> 273<a id="org2ca3449"></a>
262 274
263## Tweak the remaining UI 275## Tweak the remaining UI
264 276
265 277
266<a id="org187505c"></a> 278<a id="orgae020e2"></a>
267
268### Window dividers
269
270 (add-to-list 'default-frame-alist '(right-divider-width . 2))
271 (add-to-list 'default-frame-alist '(bottom-divider-width . 2))
272
273
274<a id="org3fd2bc6"></a>
275 279
276### Fringes 280### Fringes
277 281
@@ -279,7 +283,7 @@
279 (add-to-list 'default-frame-alist '(right-fringe-width . 2)) 283 (add-to-list 'default-frame-alist '(right-fringe-width . 2))
280 284
281 285
282<a id="org8ff32ea"></a> 286<a id="orgc8f4148"></a>
283 287
284### Minibuffer 288### Minibuffer
285 289
@@ -298,7 +302,7 @@
298 '(read-only t cursor-intangible t face minibuffer-prompt)) 302 '(read-only t cursor-intangible t face minibuffer-prompt))
299 303
300 304
301<a id="orgef2a000"></a> 305<a id="org83e5b37"></a>
302 306
303### Tabs 307### Tabs
304 308
@@ -308,18 +312,22 @@
308 312
3092. Only show the tab bar when there's more than one tab 3132. Only show the tab bar when there's more than one tab
310 314
311 (cuss tab-bar-show 1) 315 (cuss tab-bar-show 1
316 "Show the tab bar only when there's more than 1 tab.")
312 317
313 318
314<a id="orge57d1b2"></a> 319<a id="org818f06f"></a>
315 320
316### Cursor 321### Cursor
317 322
318 (cuss cursor-type 'bar) 323 (cuss cursor-type 'bar
319 (cuss cursor-in-non-selected-windows 'hollow) 324 "Show a vertical bar for the cursor.")
325 (cuss cursor-in-non-selected-windows 'hollow
326 "In inactive windows, make the cursor an empty box.")
327 (blink-cursor-mode 0)
320 328
321 329
322<a id="orgb3f29a9"></a> 330<a id="org403cbfb"></a>
323 331
324### Buffer names 332### Buffer names
325 333
@@ -327,7 +335,7 @@
327 (cuss uniquify-buffer-name-style 'forward) 335 (cuss uniquify-buffer-name-style 'forward)
328 336
329 337
330<a id="org2627b1e"></a> 338<a id="org86d72cc"></a>
331 339
332### Buffer boundaries 340### Buffer boundaries
333 341
@@ -339,17 +347,16 @@
339 (cuss indicate-empty-lines t) 347 (cuss indicate-empty-lines t)
340 348
341 349
342<a id="org1fc3c6d"></a> 350<a id="org06a8610"></a>
343 351
344## Startup 352## Startup
345 353
346 (cuss inhibit-startup-buffer-menu t) 354 (cuss inhibit-startup-screen t "Don't show Emacs' startup buffer.")
347 (cuss inhibit-start-screen t) 355 (cuss initial-buffer-choice t "Start at *scratch*.")
348 (cuss initial-buffer-choice t) 356 (cuss initial-scratch-message "" "Empty *scratch*.")
349 (cuss initial-scratch-message ";; Hi there!\n")
350 357
351 358
352<a id="org207a1bd"></a> 359<a id="org3cecd0a"></a>
353 360
354## Theme 361## Theme
355 362
@@ -388,7 +395,26 @@
388 (load-theme 'modus-operandi t)) 395 (load-theme 'modus-operandi t))
389 396
390 397
391<a id="org52f6c8c"></a> 398<a id="org1cecd04"></a>
399
400### Modeline
401
402 (custom-set-faces
403 '(mode-line ((t (:family "fixed"
404 :height 100
405 :overline t
406 :box nil
407 :foreground "black"
408 :background "white"))))
409 '(mode-line-inactive ((t (:family "fixed"
410 :height 80
411 :overline t
412 :box nil
413 :foreground "#808080"
414 :background "white")))))
415
416
417<a id="org52f810d"></a>
392 418
393### Fonts 419### Fonts
394 420
@@ -405,30 +431,31 @@
405 the first time, so it should be added to `window-setup-hook'. It 431 the first time, so it should be added to `window-setup-hook'. It
406 removes itself from that hook." 432 removes itself from that hook."
407 (interactive) 433 (interactive)
408 (set-face-attribute 'default nil 434 (when (display-graphic-p)
409 :font 435 (set-face-attribute 'default nil
410 (font-candidate 436 :font
411 "Libertinus Mono-11" 437 (font-candidate
412 "Linux Libertine Mono O-11" 438 "Libertinus Mono-11"
413 "Go Mono-10" 439 "Linux Libertine Mono O-11"
414 "Consolas-10")) 440 "Go Mono-10"
441 "Consolas-10"))
415 442
416 (set-face-attribute 'fixed-pitch nil 443 (set-face-attribute 'fixed-pitch nil
417 :font 444 :font
418 (font-candidate 445 (font-candidate
419 "Libertinus Mono-11" 446 "Libertinus Mono-11"
420 "Linux Libertine Mono O-11" 447 "Linux Libertine Mono O-11"
421 "Go Mono-10" 448 "Go Mono-10"
422 "Consolas-10")) 449 "Consolas-10"))
423 450
424 (set-face-attribute 'variable-pitch nil 451 (set-face-attribute 'variable-pitch nil
425 :font 452 :font
426 (font-candidate 453 (font-candidate
427 "Libertinus Serif-13" 454 "Libertinus Serif-13"
428 "Linux Libertine O-12" 455 "Linux Libertine O-12"
429 "Georgia-11")) 456 "Georgia-11"))
430 457
431 (remove-hook 'window-setup-hook #'acdw/setup-fonts)) 458 (remove-hook 'window-setup-hook #'acdw/setup-fonts)))
432 459
433 (add-hook 'window-setup-hook #'acdw/setup-fonts) 460 (add-hook 'window-setup-hook #'acdw/setup-fonts)
434 461
@@ -447,12 +474,12 @@
447 (unicode-fonts-setup)) 474 (unicode-fonts-setup))
448 475
449 476
450<a id="org6cbcfe5"></a> 477<a id="orgb1b190a"></a>
451 478
452# Interactivity 479# Interactivity
453 480
454 481
455<a id="org7f26398"></a> 482<a id="orge91bc0a"></a>
456 483
457## Selectrum 484## Selectrum
458 485
@@ -461,7 +488,7 @@
461 (selectrum-mode +1)) 488 (selectrum-mode +1))
462 489
463 490
464<a id="orgea8df9e"></a> 491<a id="org2dec02d"></a>
465 492
466## Prescient 493## Prescient
467 494
@@ -475,7 +502,7 @@
475 (selectrum-prescient-mode +1)) 502 (selectrum-prescient-mode +1))
476 503
477 504
478<a id="org8818eb9"></a> 505<a id="org793390e"></a>
479 506
480## Consult 507## Consult
481 508
@@ -496,29 +523,7 @@
496 (fset 'multi-occur #'consult-multi-occur)) 523 (fset 'multi-occur #'consult-multi-occur))
497 524
498 525
499<a id="orgd31a964"></a> 526<a id="orgf0e1425"></a>
500
501## Marginalia
502
503 (use-package marginalia
504 :straight (marginalia
505 :host github
506 :repo "minad/marginalia"
507 :branch "main")
508 :custom
509 (marginalia-annotators
510 '((command . marginalia-annotate-command-full)
511 (customize-group . marginalia-annotate-customize-group)
512 (variable . marginalia-annotate-variable)
513 (face . marginalia-annotate-face)
514 (symbol . marginalia-annotate-symbol)
515 (variable . marginalia-annotate-variable)
516 (package . marginalia-annotate-package)))
517 :init
518 (marginalia-mode +1))
519
520
521<a id="org6e4913f"></a>
522 527
523## Ignore case 528## Ignore case
524 529
@@ -527,7 +532,7 @@
527 (cuss read-file-name-completion-ignore-case t) 532 (cuss read-file-name-completion-ignore-case t)
528 533
529 534
530<a id="org416dd18"></a> 535<a id="orgcb1ee5e"></a>
531 536
532## Search 537## Search
533 538
@@ -543,12 +548,23 @@
543 (ctrlf-mode +1)) 548 (ctrlf-mode +1))
544 549
545 550
546<a id="orgb20768d"></a> 551<a id="orgf588a26"></a>
552
553## Mouse
554
555 (dolist (vec '([left-margin wheel-down]
556 [right-margin wheel-down]
557 [left-margin wheel-up]
558 [right-margin wheel-up]))
559 (bind-key vec #'mwheel-scroll))
560
561
562<a id="orgb6ade5d"></a>
547 563
548# Persistence 564# Persistence
549 565
550 566
551<a id="org7dfee32"></a> 567<a id="org9a6f451"></a>
552 568
553## Save history 569## Save history
554 570
@@ -568,7 +584,7 @@
568 (savehist-mode +1) 584 (savehist-mode +1)
569 585
570 586
571<a id="org0f20005"></a> 587<a id="org3041895"></a>
572 588
573## Save places in files 589## Save places in files
574 590
@@ -580,7 +596,7 @@
580 (save-place-mode 1) 596 (save-place-mode 1)
581 597
582 598
583<a id="org6d1a477"></a> 599<a id="orgfddf139"></a>
584 600
585## Recent files 601## Recent files
586 602
@@ -596,7 +612,7 @@
596 (recentf-mode 1) 612 (recentf-mode 1)
597 613
598 614
599<a id="org9368a6b"></a> 615<a id="org5211a84"></a>
600 616
601### Easily navigate recent files 617### Easily navigate recent files
602 618
@@ -610,7 +626,7 @@
610 (global-set-key (kbd "C-x C-r") #'recentf-find-file) 626 (global-set-key (kbd "C-x C-r") #'recentf-find-file)
611 627
612 628
613<a id="orgbb4f91a"></a> 629<a id="org203b48b"></a>
614 630
615## Undo 631## Undo
616 632
@@ -619,45 +635,45 @@
619 (undohist-initialize)) 635 (undohist-initialize))
620 636
621 637
622<a id="org52b008a"></a> 638<a id="org697ec47"></a>
623 639
624# Editing 640# Editing
625 641
626 642
627<a id="orgce838ba"></a> 643<a id="org958bd79"></a>
628 644
629## Operate visually on lines 645## Operate visually on lines
630 646
631 (global-visual-line-mode +1) 647 (global-visual-line-mode +1)
632 648
633 649
634<a id="org6f67996"></a> 650<a id="orgc5ef3b6"></a>
635 651
636## Require a final newline 652## Require a final newline
637 653
638 (cuss require-final-newline t) 654 (cuss require-final-newline t)
639 655
640 656
641<a id="orga2bdb3e"></a> 657<a id="orgba62063"></a>
642 658
643## Killing & Yanking 659## Killing & Yanking
644 660
645 661
646<a id="org16c1a6b"></a> 662<a id="orgcb04f02"></a>
647 663
648### Replace selection when typing 664### Replace selection when typing
649 665
650 (delete-selection-mode +1) 666 (delete-selection-mode +1)
651 667
652 668
653<a id="orgea7fd73"></a> 669<a id="orgdf80771"></a>
654 670
655### Save existing clipboard text into kill ring before replacing it 671### Save existing clipboard text into kill ring before replacing it
656 672
657 (cuss save-interprogram-paste-before-kill t) 673 (cuss save-interprogram-paste-before-kill t)
658 674
659 675
660<a id="org27f430f"></a> 676<a id="org2252a8b"></a>
661 677
662## So long mode 678## So long mode
663 679
@@ -665,17 +681,38 @@
665 (global-so-long-mode)) 681 (global-so-long-mode))
666 682
667 683
668<a id="org8cc8ee8"></a> 684<a id="org6fe3b6b"></a>
685
686## Multiple cursors
687
688 (use-package multiple-cursors
689 :bind
690 ("C->" . mc/mark-next-like-this)
691 ("C-<" . mc/mark-previous-like-this)
692 ("C-c C-<" . mc/mark-all-like-this))
693
694
695<a id="orgfe5b963"></a>
696
697## Expand region
698
699 (use-package expand-region
700 :bind
701 (("C-=" . er/expand-region)
702 ("C-+" . er/contract-region)))
703
704
705<a id="org0b92a32"></a>
669 706
670# Files 707# Files
671 708
672 709
673<a id="org8ca2e9b"></a> 710<a id="orgf1babbf"></a>
674 711
675## Encoding 712## Encoding
676 713
677 714
678<a id="org54363a7"></a> 715<a id="org8dd350d"></a>
679 716
680### UTF-8 717### UTF-8
681 718
@@ -687,7 +724,7 @@
687 (prefer-coding-system 'utf-8) 724 (prefer-coding-system 'utf-8)
688 725
689 726
690<a id="orgeaed3bd"></a> 727<a id="org34854a5"></a>
691 728
692### Convert all files to UNIX-style line endings 729### Convert all files to UNIX-style line endings
693 730
@@ -705,7 +742,7 @@ I add it to the `find-file-hook` *and* `before-save-hook` because I don't want t
705 (add-hook 'before-save-hook #'ewiki/no-junk-please-were-unixish) 742 (add-hook 'before-save-hook #'ewiki/no-junk-please-were-unixish)
706 743
707 744
708<a id="org7239c47"></a> 745<a id="org184d029"></a>
709 746
710## Backups 747## Backups
711 748
@@ -715,14 +752,14 @@ I add it to the `find-file-hook` *and* `before-save-hook` because I don't want t
715 (cuss vc-make-backup-files t) 752 (cuss vc-make-backup-files t)
716 753
717 754
718<a id="org32fc658"></a> 755<a id="org72595b4"></a>
719 756
720## Auto-saves 757## Auto-saves
721 758
722 (auto-save-visited-mode 1) 759 (auto-save-visited-mode 1)
723 760
724 761
725<a id="org94456e2"></a> 762<a id="orgd374486"></a>
726 763
727## Revert files 764## Revert files
728 765
@@ -730,31 +767,82 @@ I add it to the `find-file-hook` *and* `before-save-hook` because I don't want t
730 (global-auto-revert-mode +1) 767 (global-auto-revert-mode +1)
731 768
732 769
733<a id="orgb586b3b"></a> 770<a id="org8ac0e64"></a>
734 771
735## Add a timestamp to files 772## Add a timestamp to files
736 773
737 (add-hook 'before-save-hook #'time-stamp) 774 (add-hook 'before-save-hook #'time-stamp)
738 775
739 776
740<a id="org738fbd9"></a> 777<a id="org97bb90c"></a>
741 778
742# Programming 779# Programming
743 780
744 781
745<a id="org080eb2f"></a> 782<a id="orgbcce753"></a>
746 783
747## Which function are we in? 784## Which function are we in?
748 785
749 (which-function-mode +1) 786 (which-function-mode +1)
750 787
751 788
752<a id="org6bf5097"></a> 789<a id="org7d7c4d6"></a>
790
791## Parentheses
792
793
794<a id="orgbe3915d"></a>
795
796### Show parentheses
797
798 (cuss show-paren-delay 0 "Show matching parens immediately.")
799 (cuss show-paren-style 'mixed
800 "Show parenthesis, or whole expression, depending on visibility.")
801 (cuss show-paren-when-point-in-periphery t
802 "Show paren when point is near-to paren.")
803 (cuss show-paren-when-point-inside-paren t
804 "Show surrounding parens.")
805
806 (add-hook 'prog-mode-hook #'show-paren-mode)
807
808
809<a id="org9415ceb"></a>
810
811### Smart parentheses
812
813 (use-package smartparens
814 :init
815 (require 'smartparens-config)
816 :config
817 (show-smartparens-global-mode +1)
818 :hook
819 (prog-mode-hook . smart-parens-strict-mode))
820
821
822<a id="org2ebc45e"></a>
823
824## Line numbers
825
826 (defun acdw/enable-line-numbers ()
827 "Enable line numbers, through either
828 `display-line-numbers-mode' or through `linum-mode'."
829 (if (and (fboundp 'display-line-numbers-mode)
830 (display-graphic-p))
831 (display-line-numbers-mode +1)
832 (linum-mode +1)))
833
834 (cuss display-line-numbers-width 2
835 "Always have at least 2 digits for line numbers.")
836
837 (add-hook 'prog-mode-hook #'acdw/enable-line-numbers)
838
839
840<a id="orge8c66c9"></a>
753 841
754# Writing 842# Writing
755 843
756 844
757<a id="org6f01971"></a> 845<a id="org5278827"></a>
758 846
759## Visual Fill Column 847## Visual Fill Column
760 848
@@ -768,24 +856,24 @@ I add it to the `find-file-hook` *and* `before-save-hook` because I don't want t
768 (advice-add 'text-scale-adjust 856 (advice-add 'text-scale-adjust
769 :after #'visual-fill-column-adjust) 857 :after #'visual-fill-column-adjust)
770 :hook 858 :hook
771 (text-mode . visual-fill-column-mode)) 859 (text-mode-hook . visual-fill-column-mode))
772 860
773 861
774<a id="org03e747d"></a> 862<a id="org63bd7b9"></a>
775 863
776## Type nice-looking quote-type marks 864## Type nice-looking quote-type marks
777 865
778 (use-package typo 866 (use-package typo
779 :hook 867 :hook
780 (text-mode . typo-mode)) 868 (text-mode-hook . typo-mode))
781 869
782 870
783<a id="org9528516"></a> 871<a id="org50abb5d"></a>
784 872
785# Applications 873# Applications
786 874
787 875
788<a id="orgd2a60aa"></a> 876<a id="orgf68bfba"></a>
789 877
790## Magit 878## Magit
791 879
@@ -794,17 +882,133 @@ I add it to the `find-file-hook` *and* `before-save-hook` because I don't want t
794 ("C-x g" . magit-status)) 882 ("C-x g" . magit-status))
795 883
796 884
797<a id="org7339cf2"></a> 885<a id="org66c3b6b"></a>
886
887## Org mode
888
889I’ve put org mode under Applications, as opposed to [8](#orge8c66c9), because it’s more generally-applicable than that.
890
891 (use-package org
892 :custom
893 (org-hide-emphasis-markers t)
894 (org-fontify-done-headline t)
895 (org-fontify-whole-heading-line t)
896 (org-fontify-quote-and-verse-blocks t)
897 (org-pretty-entities t)
898
899 (org-src-tab-acts-natively t)
900 (org-src-fontify-natively t)
901 (org-src-window-setup 'current-window)
902 (org-confirm-babel-evaluate nil))
903
904
905<a id="org34de14b"></a>
906
907### Export to markdown
908
909 (require 'ox-md)
910
911
912<a id="orge32cf6b"></a>
913
914### Make bullets look like bullets
915
916 (font-lock-add-keywords
917 'org-mode
918 '(("^ *\\([-+]\\) "
919 (0 (prog1 ()
920 (compose-region (match-beginning 1)
921 (match-end 1)
922 "•"))))))
923
924
925<a id="org5d13ece"></a>
926
927### [A better return in Org mode](http://kitchingroup.cheme.cmu.edu/blog/2017/04/09/A-better-return-in-org-mode/)
928
929 (require 'org-inlinetask)
930
931 (defun scimax/org-return (&optional ignore)
932 "Add new list item, heading or table row with RET.
933 A double return on an empty element deletes it.
934 Use a prefix arg to get regular RET."
935 (interactive "P")
936 (if ignore
937 (org-return)
938 (cond
939
940 ((eq 'line-break (car (org-element-context)))
941 (org-return t))
942
943 ;; Open links like usual, unless point is at the end of a line.
944 ;; and if at beginning of line, just press enter.
945 ((or (and (eq 'link (car (org-element-context))) (not (eolp)))
946 (bolp))
947 (org-return))
948
949 ;; It doesn't make sense to add headings in inline tasks. Thanks Anders
950 ;; Johansson!
951 ((org-inlinetask-in-task-p)
952 (org-return))
953
954 ;; checkboxes too
955 ((org-at-item-checkbox-p)
956 (org-insert-todo-heading nil))
957
958 ;; lists end with two blank lines, so we need to make sure we are also not
959 ;; at the beginning of a line to avoid a loop where a new entry gets
960 ;; created with only one blank line.
961 ((org-in-item-p)
962 (if (save-excursion (beginning-of-line) (org-element-property :contents-begin (org-element-context)))
963 (org-insert-heading)
964 (beginning-of-line)
965 (delete-region (line-beginning-position) (line-end-position))
966 (org-return)))
967
968 ;; org-heading
969 ((org-at-heading-p)
970 (if (not (string= "" (org-element-property :title (org-element-context))))
971 (progn (org-end-of-meta-data)
972 (org-insert-heading-respect-content)
973 (outline-show-entry))
974 (beginning-of-line)
975 (setf (buffer-substring
976 (line-beginning-position) (line-end-position)) "")))
977
978 ;; tables
979 ((org-at-table-p)
980 (if (-any?
981 (lambda (x) (not (string= "" x)))
982 (nth
983 (- (org-table-current-dline) 1)
984 (org-table-to-lisp)))
985 (org-return)
986 ;; empty row
987 (beginning-of-line)
988 (setf (buffer-substring
989 (line-beginning-position) (line-end-position)) "")
990 (org-return)))
991
992 ;; fall-through case
993 (t
994 (org-return)))))
995
996
997 (define-key org-mode-map (kbd "RET")
998 'scimax/org-return)
999
1000
1001<a id="org1c0423c"></a>
798 1002
799# Appendices 1003# Appendices
800 1004
801 1005
802<a id="org6070b2c"></a> 1006<a id="orgea74573"></a>
803 1007
804## Emacs' files 1008## Emacs' files
805 1009
806 1010
807<a id="org0d720f6"></a> 1011<a id="org1ed6b18"></a>
808 1012
809### init.el 1013### init.el
810 1014
@@ -825,7 +1029,7 @@ I add it to the `find-file-hook` *and* `before-save-hook` because I don't want t
825 (org-babel-load-file org)))) 1029 (org-babel-load-file org))))
826 1030
827 1031
828<a id="orgd6bffd2"></a> 1032<a id="org1e22a5e"></a>
829 1033
830### early-init.el 1034### early-init.el
831 1035
@@ -835,34 +1039,35 @@ I add it to the `find-file-hook` *and* `before-save-hook` because I don't want t
835 (setq frame-inhibit-implied-resize t) 1039 (setq frame-inhibit-implied-resize t)
836 1040
837 1041
838<a id="org9c5b437"></a> 1042<a id="org50bd83d"></a>
839 1043
840## Ease tangling and loading of Emacs' init 1044## Ease tangling and loading of Emacs' init
841 1045
842 (defun acdw/tangle-and-load-init () 1046 (defun refresh-emacs (&optional disable-load)
843 (interactive) 1047 (interactive "P")
844 "If the current buffer is `config.org', tangle it, then byte-compile." 1048 "Tangle `config.org', then byte-compile the resulting files.
1049 Then, load the byte-compilations unless passed with a prefix argument."
845 (let ((config (expand-file-name "config.org" user-emacs-directory))) 1050 (let ((config (expand-file-name "config.org" user-emacs-directory)))
846 (when (string= (buffer-file-name) config) 1051 (save-mark-and-excursion
847 (let ((prog-mode-hook nil)) 1052 (with-current-buffer (find-file config)
848 (require 'org) 1053 (let ((prog-mode-hook nil))
849 (org-babel-tangle-file config) 1054 ;; generate the readme
850 (org-md-export-to-markdown) 1055 (require 'ox-md)
851 1056 (org-md-export-to-markdown)
852 (dolist (file `(,(expand-file-name "init.el" 1057 ;; tangle config.org
853 user-emacs-directory) 1058 (require 'org)
854 ,(expand-file-name "config.el" 1059 (let ((inits (org-babel-tangle)))
855 user-emacs-directory))) 1060 ;; byte-compile resulting files
856 (byte-compile-file file t)))))) 1061 (dolist (f inits)
857 1062 (when (string-match "\\.el\\'" f)
858 (add-hook 'after-save-hook #'acdw/tangle-and-load-init) 1063 (byte-compile-file f (not disable-load))))))))))
859 1064
860 1065
861<a id="org1a4bb4d"></a> 1066<a id="org551e420"></a>
862 1067
863## License 1068## License
864 1069
865Copyright © 2020 Case Duckworth <acdw@acdw.net> 1070Copyright © 2020 Case Duckworth <acdw@acdw.net>
866 1071
867This work is free. You can redistribute it and/or modify it under the 1072This work is free. You can redistribute it and/or modify it under the
868terms of the Do What the Fuck You Want To Public License, Version 2, 1073terms of the Do What the Fuck You Want To Public License, Version 2,
@@ -885,7 +1090,7 @@ following source block, for details.
885 0. You just DO WHAT THE FUCK YOU WANT TO. 1090 0. You just DO WHAT THE FUCK YOU WANT TO.
886 1091
887 1092
888<a id="orga6047ee"></a> 1093<a id="org15f94a8"></a>
889 1094
890### Note on the license 1095### Note on the license
891 1096
@@ -894,3 +1099,10 @@ GPL, for what should be fairly obvious reasons. To that, I say:
894 1099
895**SUE ME, RMS!** 1100**SUE ME, RMS!**
896 1101
1102
1103<a id="org3bda9ee"></a>
1104
1105## Keymaps for *this* file
1106
1107This isn’t working … yet.
1108
diff --git a/config.org b/config.org index c025f03..d171ac9 100644 --- a/config.org +++ b/config.org
@@ -3,7 +3,7 @@
3#+PROPERTY: header-args :tangle config.el :comments both :mkdirp yes 3#+PROPERTY: header-args :tangle config.el :comments both :mkdirp yes
4#+EXPORT_FILE_NAME: README.md 4#+EXPORT_FILE_NAME: README.md
5#+BANKRUPTCY_COUNT: 3 5#+BANKRUPTCY_COUNT: 3
6#+Time-stamp: <2020-12-08 23:51:18 acdw> 6#+Time-stamp: <2020-12-09 18:28:04 acdw>
7 7
8* Pave the way 8* Pave the way
9** Correct =exec-path= 9** Correct =exec-path=
@@ -50,6 +50,7 @@
50 50
51 #+begin_src emacs-lisp 51 #+begin_src emacs-lisp
52 (setq straight-use-package-by-default t) 52 (setq straight-use-package-by-default t)
53 (setq use-package-hook-name-suffix nil)
53 (straight-use-package 'use-package) 54 (straight-use-package 'use-package)
54 #+end_src 55 #+end_src
55 56
@@ -60,7 +61,7 @@
60#+begin_src emacs-lisp 61#+begin_src emacs-lisp
61 (straight-use-package 62 (straight-use-package
62 '(use-package-custom-update 63 '(use-package-custom-update
63 :host "github" 64 :host github
64 :repo "a13/use-package-custom-update")) 65 :repo "a13/use-package-custom-update"))
65 66
66 (require 'use-package-custom-update) 67 (require 'use-package-custom-update)
@@ -161,13 +162,6 @@
161 162
162** Tweak the remaining UI 163** Tweak the remaining UI
163 164
164*** Window dividers
165
166#+begin_src emacs-lisp
167 (add-to-list 'default-frame-alist '(right-divider-width . 2))
168 (add-to-list 'default-frame-alist '(bottom-divider-width . 2))
169#+end_src
170
171*** Fringes 165*** Fringes
172 166
173#+begin_src emacs-lisp 167#+begin_src emacs-lisp
@@ -206,14 +200,18 @@
206**** Only show the tab bar when there's more than one tab 200**** Only show the tab bar when there's more than one tab
207 201
208#+begin_src emacs-lisp 202#+begin_src emacs-lisp
209 (cuss tab-bar-show 1) 203 (cuss tab-bar-show 1
204 "Show the tab bar only when there's more than 1 tab.")
210#+end_src 205#+end_src
211 206
212*** Cursor 207*** Cursor
213 208
214#+begin_src emacs-lisp 209#+begin_src emacs-lisp
215 (cuss cursor-type 'bar) 210 (cuss cursor-type 'bar
216 (cuss cursor-in-non-selected-windows 'hollow) 211 "Show a vertical bar for the cursor.")
212 (cuss cursor-in-non-selected-windows 'hollow
213 "In inactive windows, make the cursor an empty box.")
214 (blink-cursor-mode 0)
217#+end_src 215#+end_src
218 216
219*** Buffer names 217*** Buffer names
@@ -237,10 +235,9 @@
237** Startup 235** Startup
238 236
239#+begin_src emacs-lisp 237#+begin_src emacs-lisp
240 (cuss inhibit-startup-buffer-menu t) 238 (cuss inhibit-startup-screen t "Don't show Emacs' startup buffer.")
241 (cuss inhibit-start-screen t) 239 (cuss initial-buffer-choice t "Start at *scratch*.")
242 (cuss initial-buffer-choice t) 240 (cuss initial-scratch-message "" "Empty *scratch*.")
243 (cuss initial-scratch-message ";; Hi there!\n")
244#+end_src 241#+end_src
245 242
246** Theme 243** Theme
@@ -281,6 +278,22 @@
281 (load-theme 'modus-operandi t)) 278 (load-theme 'modus-operandi t))
282#+end_src 279#+end_src
283 280
281*** Modeline
282
283#+begin_src emacs-lisp
284 (custom-set-faces
285 '(mode-line ((t (:height 0.8
286 :overline t
287 :box nil
288 :foreground "black"
289 :background "white"))))
290 '(mode-line-inactive ((t (:height 0.8
291 :overline t
292 :box nil
293 :foreground "#808080"
294 :background "white")))))
295#+end_src
296
284*** Fonts 297*** Fonts
285 298
286**** Define fonts 299**** Define fonts
@@ -297,30 +310,31 @@
297 the first time, so it should be added to `window-setup-hook'. It 310 the first time, so it should be added to `window-setup-hook'. It
298 removes itself from that hook." 311 removes itself from that hook."
299 (interactive) 312 (interactive)
300 (set-face-attribute 'default nil 313 (when (display-graphic-p)
301 :font 314 (set-face-attribute 'default nil
302 (font-candidate 315 :font
303 "Libertinus Mono-11" 316 (font-candidate
304 "Linux Libertine Mono O-11" 317 "Libertinus Mono-11"
305 "Go Mono-10" 318 "Linux Libertine Mono O-11"
306 "Consolas-10")) 319 "Go Mono-10"
307 320 "Consolas-10"))
308 (set-face-attribute 'fixed-pitch nil 321
309 :font 322 (set-face-attribute 'fixed-pitch nil
310 (font-candidate 323 :font
311 "Libertinus Mono-11" 324 (font-candidate
312 "Linux Libertine Mono O-11" 325 "Libertinus Mono-11"
313 "Go Mono-10" 326 "Linux Libertine Mono O-11"
314 "Consolas-10")) 327 "Go Mono-10"
315 328 "Consolas-10"))
316 (set-face-attribute 'variable-pitch nil 329
317 :font 330 (set-face-attribute 'variable-pitch nil
318 (font-candidate 331 :font
319 "Libertinus Serif-13" 332 (font-candidate
320 "Linux Libertine O-12" 333 "Libertinus Serif-13"
321 "Georgia-11")) 334 "Linux Libertine O-12"
322 335 "Georgia-11"))
323 (remove-hook 'window-setup-hook #'acdw/setup-fonts)) 336
337 (remove-hook 'window-setup-hook #'acdw/setup-fonts)))
324 338
325 (add-hook 'window-setup-hook #'acdw/setup-fonts) 339 (add-hook 'window-setup-hook #'acdw/setup-fonts)
326#+end_src 340#+end_src
@@ -388,7 +402,9 @@
388 (fset 'multi-occur #'consult-multi-occur)) 402 (fset 'multi-occur #'consult-multi-occur))
389#+end_src 403#+end_src
390 404
391** Marginalia 405** COMMENT Marginalia
406
407Until the =marginalia-annotators= settles, I’m disabling this section.
392 408
393#+begin_src emacs-lisp 409#+begin_src emacs-lisp
394 (use-package marginalia 410 (use-package marginalia
@@ -432,6 +448,16 @@
432 (ctrlf-mode +1)) 448 (ctrlf-mode +1))
433#+end_src 449#+end_src
434 450
451** Mouse
452
453#+begin_src emacs-lisp
454 (dolist (vec '([left-margin wheel-down]
455 [right-margin wheel-down]
456 [left-margin wheel-up]
457 [right-margin wheel-up]))
458 (bind-key vec #'mwheel-scroll))
459#+end_src
460
435* Persistence 461* Persistence
436 462
437** Save history 463** Save history
@@ -535,6 +561,25 @@
535 (global-so-long-mode)) 561 (global-so-long-mode))
536#+end_src 562#+end_src
537 563
564** Multiple cursors
565
566#+begin_src emacs-lisp
567 (use-package multiple-cursors
568 :bind
569 ("C->" . mc/mark-next-like-this)
570 ("C-<" . mc/mark-previous-like-this)
571 ("C-c C-<" . mc/mark-all-like-this))
572#+end_src
573
574** Expand region
575
576#+begin_src emacs-lisp
577 (use-package expand-region
578 :bind
579 (("C-=" . er/expand-region)
580 ("C-+" . er/contract-region)))
581#+end_src
582
538* Files 583* Files
539 584
540** Encoding 585** Encoding
@@ -604,6 +649,51 @@
604 (which-function-mode +1) 649 (which-function-mode +1)
605#+end_src 650#+end_src
606 651
652** Parentheses
653
654*** Show parentheses
655
656#+begin_src emacs-lisp
657 (cuss show-paren-delay 0 "Show matching parens immediately.")
658 (cuss show-paren-style 'mixed
659 "Show parenthesis, or whole expression, depending on visibility.")
660 (cuss show-paren-when-point-in-periphery t
661 "Show paren when point is near-to paren.")
662 (cuss show-paren-when-point-inside-paren t
663 "Show surrounding parens.")
664
665 (add-hook 'prog-mode-hook #'show-paren-mode)
666#+end_src
667
668*** Smart parentheses
669
670#+begin_src emacs-lisp
671 (use-package smartparens
672 :init
673 (require 'smartparens-config)
674 :config
675 (show-smartparens-global-mode +1)
676 :hook
677 (prog-mode-hook . smart-parens-strict-mode))
678#+end_src
679
680** Line numbers
681
682#+begin_src emacs-lisp
683 (defun acdw/enable-line-numbers ()
684 "Enable line numbers, through either
685 `display-line-numbers-mode' or through `linum-mode'."
686 (if (and (fboundp 'display-line-numbers-mode)
687 (display-graphic-p))
688 (display-line-numbers-mode +1)
689 (linum-mode +1)))
690
691 (cuss display-line-numbers-width 2
692 "Always have at least 2 digits for line numbers.")
693
694 (add-hook 'prog-mode-hook #'acdw/enable-line-numbers)
695#+end_src
696
607* Writing 697* Writing
608 698
609** Visual Fill Column 699** Visual Fill Column
@@ -619,7 +709,7 @@
619 (advice-add 'text-scale-adjust 709 (advice-add 'text-scale-adjust
620 :after #'visual-fill-column-adjust) 710 :after #'visual-fill-column-adjust)
621 :hook 711 :hook
622 (text-mode . visual-fill-column-mode)) 712 (text-mode-hook . visual-fill-column-mode))
623#+end_src 713#+end_src
624 714
625** Type nice-looking quote-type marks 715** Type nice-looking quote-type marks
@@ -627,7 +717,7 @@
627#+begin_src emacs-lisp 717#+begin_src emacs-lisp
628 (use-package typo 718 (use-package typo
629 :hook 719 :hook
630 (text-mode . typo-mode)) 720 (text-mode-hook . typo-mode))
631#+end_src 721#+end_src
632 722
633* Applications 723* Applications
@@ -640,6 +730,118 @@
640 ("C-x g" . magit-status)) 730 ("C-x g" . magit-status))
641#+end_src 731#+end_src
642 732
733** Org mode
734
735I’ve put org mode under Applications, as opposed to [[*Writing]], because it’s more generally-applicable than that.
736
737#+begin_src emacs-lisp
738 (use-package org
739 :custom
740 (org-hide-emphasis-markers t)
741 (org-fontify-done-headline t)
742 (org-fontify-whole-heading-line t)
743 (org-fontify-quote-and-verse-blocks t)
744 (org-pretty-entities t)
745
746 (org-src-tab-acts-natively t)
747 (org-src-fontify-natively t)
748 (org-src-window-setup 'current-window)
749 (org-confirm-babel-evaluate nil))
750#+end_src
751
752*** Export to markdown
753
754#+begin_src emacs-lisp
755 (require 'ox-md)
756#+end_src
757
758*** Make bullets look like bullets
759
760#+begin_src emacs-lisp
761 (font-lock-add-keywords
762 'org-mode
763 '(("^ *\\([-+]\\) "
764 (0 (prog1 ()
765 (compose-region (match-beginning 1)
766 (match-end 1)
767 "•"))))))
768#+end_src
769
770*** [[http://kitchingroup.cheme.cmu.edu/blog/2017/04/09/A-better-return-in-org-mode/][A better return in Org mode]]
771
772#+begin_src emacs-lisp
773 (require 'org-inlinetask)
774
775 (defun scimax/org-return (&optional ignore)
776 "Add new list item, heading or table row with RET.
777 A double return on an empty element deletes it.
778 Use a prefix arg to get regular RET."
779 (interactive "P")
780 (if ignore
781 (org-return)
782 (cond
783
784 ((eq 'line-break (car (org-element-context)))
785 (org-return t))
786
787 ;; Open links like usual, unless point is at the end of a line.
788 ;; and if at beginning of line, just press enter.
789 ((or (and (eq 'link (car (org-element-context))) (not (eolp)))
790 (bolp))
791 (org-return))
792
793 ;; It doesn't make sense to add headings in inline tasks. Thanks Anders
794 ;; Johansson!
795 ((org-inlinetask-in-task-p)
796 (org-return))
797
798 ;; checkboxes too
799 ((org-at-item-checkbox-p)
800 (org-insert-todo-heading nil))
801
802 ;; lists end with two blank lines, so we need to make sure we are also not
803 ;; at the beginning of a line to avoid a loop where a new entry gets
804 ;; created with only one blank line.
805 ((org-in-item-p)
806 (if (save-excursion (beginning-of-line) (org-element-property :contents-begin (org-element-context)))
807 (org-insert-heading)
808 (beginning-of-line)
809 (delete-region (line-beginning-position) (line-end-position))
810 (org-return)))
811
812 ;; org-heading
813 ((org-at-heading-p)
814 (if (not (string= "" (org-element-property :title (org-element-context))))
815 (progn (org-end-of-meta-data)
816 (org-insert-heading-respect-content)
817 (outline-show-entry))
818 (beginning-of-line)
819 (setf (buffer-substring
820 (line-beginning-position) (line-end-position)) "")))
821
822 ;; tables
823 ((org-at-table-p)
824 (if (-any?
825 (lambda (x) (not (string= "" x)))
826 (nth
827 (- (org-table-current-dline) 1)
828 (org-table-to-lisp)))
829 (org-return)
830 ;; empty row
831 (beginning-of-line)
832 (setf (buffer-substring
833 (line-beginning-position) (line-end-position)) "")
834 (org-return)))
835
836 ;; fall-through case
837 (t
838 (org-return)))))
839
840
841 (define-key org-mode-map (kbd "RET")
842 'scimax/org-return)
843#+end_src
844
643* Appendices 845* Appendices
644** Emacs' files 846** Emacs' files
645*** init.el 847*** init.el
@@ -683,30 +885,32 @@
683** Ease tangling and loading of Emacs' init 885** Ease tangling and loading of Emacs' init
684 886
685 #+begin_src emacs-lisp 887 #+begin_src emacs-lisp
686 (defun acdw/tangle-and-load-init () 888 (defun refresh-emacs (&optional disable-load)
687 (interactive) 889 (interactive "P")
688 "If the current buffer is `config.org', tangle it, then byte-compile." 890 "Tangle `config.org', then byte-compile the resulting files.
891 Then, load the byte-compilations unless passed with a prefix argument."
689 (let ((config (expand-file-name "config.org" user-emacs-directory))) 892 (let ((config (expand-file-name "config.org" user-emacs-directory)))
690 (when (string= (buffer-file-name) config) 893 (save-mark-and-excursion
691 (let ((prog-mode-hook nil)) 894 (with-current-buffer (find-file config)
692 (require 'org) 895 (let ((prog-mode-hook nil))
693 (org-babel-tangle-file config) 896 ;; generate the readme
694 (org-md-export-to-markdown) 897 (require 'ox-md)
695 898 (org-md-export-to-markdown)
696 (dolist (file `(,(expand-file-name "init.el" 899 ;; tangle config.org
697 user-emacs-directory) 900 (require 'org)
698 ,(expand-file-name "config.el" 901 (let ((inits (org-babel-tangle)))
699 user-emacs-directory))) 902 ;; byte-compile resulting files
700 (byte-compile-file file t)))))) 903 (dolist (f inits)
701 904 (when (string-match "\\.el\\'" f)
702 (add-hook 'after-save-hook #'acdw/tangle-and-load-init) 905 (byte-compile-file f (not disable-load))))))))))
703 #+end_src 906 #+end_src
907
704** License 908** License
705 :PROPERTIES: 909 :PROPERTIES:
706 :header-args: :tangle LICENSE :comments no 910 :header-args: :tangle LICENSE :comments no
707 :END: 911 :END:
708 912
709 Copyright © 2020 Case Duckworth <acdw@acdw.net> 913 Copyright © 2020 Case Duckworth <acdw@acdw.net>
710 914
711 This work is free. You can redistribute it and/or modify it under the 915 This work is free. You can redistribute it and/or modify it under the
712 terms of the Do What the Fuck You Want To Public License, Version 2, 916 terms of the Do What the Fuck You Want To Public License, Version 2,
@@ -736,3 +940,9 @@
736 GPL, for what should be fairly obvious reasons. To that, I say: 940 GPL, for what should be fairly obvious reasons. To that, I say:
737 941
738 *SUE ME, RMS!* 942 *SUE ME, RMS!*
943
944** Keymaps for /this/ file
945
946This isn’t working … yet.
947
948#+KEYMAP: C-c C-v t | refresh-emacs