summary refs log tree commit diff stats
path: root/README.md
diff options
context:
space:
mode:
authorCase Duckworth2020-12-09 20:24:42 -0600
committerCase Duckworth2020-12-09 20:24:42 -0600
commita1293a9c3de5afbfd4c93e0fa7a3aa8eb9cc3970 (patch)
tree52ed83e154def3c56c21855eee9ac4fdd8a6013c /README.md
parentI DECLARE … BANKRUPTCY!!! (diff)
downloademacs-a1293a9c3de5afbfd4c93e0fa7a3aa8eb9cc3970.tar.gz
emacs-a1293a9c3de5afbfd4c93e0fa7a3aa8eb9cc3970.zip
Add a lot of stuff … back
Diffstat (limited to 'README.md')
-rw-r--r--README.md658
1 files changed, 435 insertions, 223 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