diff options
Diffstat (limited to 'config.org')
-rw-r--r-- | config.org | 332 |
1 files changed, 271 insertions, 61 deletions
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 | |||
407 | Until 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 | |||
735 | I’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 | |||
946 | This isn’t working … yet. | ||
947 | |||
948 | #+KEYMAP: C-c C-v t | refresh-emacs | ||