diff options
Diffstat (limited to 'config.org')
-rw-r--r-- | config.org | 217 |
1 files changed, 172 insertions, 45 deletions
diff --git a/config.org b/config.org index 35922e6..782e318 100644 --- a/config.org +++ b/config.org | |||
@@ -4,7 +4,7 @@ | |||
4 | #+EXPORT_FILE_NAME: README.md | 4 | #+EXPORT_FILE_NAME: README.md |
5 | #+OPTIONS: toc:nil | 5 | #+OPTIONS: toc:nil |
6 | #+BANKRUPTCY_COUNT: 3 | 6 | #+BANKRUPTCY_COUNT: 3 |
7 | #+Time-stamp: <2020-12-10 00:40:50 acdw> | 7 | #+Time-stamp: <2020-12-10 17:46:10 aduckworth> |
8 | 8 | ||
9 | Let’s configure Emacs using Org mode, they said. It’ll be fun, they said. | 9 | Let’s configure Emacs using Org mode, they said. It’ll be fun, they said. |
10 | 10 | ||
@@ -35,6 +35,8 @@ Let’s configure Emacs using Org mode, they said. It’ll be fun, they said. | |||
35 | 35 | ||
36 | *** Straight.el | 36 | *** Straight.el |
37 | 37 | ||
38 | This still doesn’t work under Windows – I have to manually download the [[https://github.com/raxod502/straight.el/archive/master.zip][repo archive]] and unzip it. Not the biggest burden, I suppose. | ||
39 | |||
38 | #+begin_src emacs-lisp | 40 | #+begin_src emacs-lisp |
39 | (defvar bootstrap-version) | 41 | (defvar bootstrap-version) |
40 | (let ((bootstrap-file | 42 | (let ((bootstrap-file |
@@ -111,7 +113,7 @@ Let’s configure Emacs using Org mode, they said. It’ll be fun, they said. | |||
111 | "autosaves" | 113 | "autosaves" |
112 | "undos" | 114 | "undos" |
113 | "elpher-certificates")) | 115 | "elpher-certificates")) |
114 | (make-directory (no-littering-expand-var-file-name dir) t)) | 116 | (make-directory (no-littering-expand-var-file-name dir) 'parents)) |
115 | #+end_src | 117 | #+end_src |
116 | 118 | ||
117 | ** About me | 119 | ** About me |
@@ -274,7 +276,8 @@ Let’s configure Emacs using Org mode, they said. It’ll be fun, they said. | |||
274 | (modus-themes-diffs nil) | 276 | (modus-themes-diffs nil) |
275 | (modus-themes-org-blocks 'grayscale) | 277 | (modus-themes-org-blocks 'grayscale) |
276 | (modus-themes-headings | 278 | (modus-themes-headings |
277 | '()) | 279 | '((1 . line) |
280 | (t . t))) | ||
278 | (modus-themes-variable-pitch-headings t) | 281 | (modus-themes-variable-pitch-headings t) |
279 | (modus-themes-scale-headings t) | 282 | (modus-themes-scale-headings t) |
280 | (modus-themes-scale-1 1.1) | 283 | (modus-themes-scale-1 1.1) |
@@ -289,20 +292,27 @@ Let’s configure Emacs using Org mode, they said. It’ll be fun, they said. | |||
289 | (load-theme 'modus-operandi t)) | 292 | (load-theme 'modus-operandi t)) |
290 | #+end_src | 293 | #+end_src |
291 | 294 | ||
292 | *** COMMENT Modeline | 295 | *** Change theme based on time of day |
296 | |||
297 | #+begin_src emacs-lisp | ||
298 | (cuss calendar-latitude 30.4515) | ||
299 | (cuss calendar-longitude -91.1871) | ||
300 | |||
301 | (use-package circadian | ||
302 | :after solar | ||
303 | :custom | ||
304 | (circadian-themes '((:sunrise . modus-operandi) | ||
305 | (:sunset . modus-vivendi))) | ||
306 | :config | ||
307 | (circadian-setup)) | ||
308 | #+end_src | ||
309 | |||
310 | *** Modeline | ||
293 | 311 | ||
294 | #+begin_src emacs-lisp | 312 | #+begin_src emacs-lisp |
295 | (custom-set-faces | 313 | (use-package mood-line |
296 | '(mode-line ((t (:height 0.8 | 314 | :config |
297 | :overline t | 315 | (mood-line-mode +1)) |
298 | :box nil | ||
299 | :foreground "black" | ||
300 | :background "white")))) | ||
301 | '(mode-line-inactive ((t (:height 0.8 | ||
302 | :overline t | ||
303 | :box nil | ||
304 | :foreground "#808080" | ||
305 | :background "white"))))) | ||
306 | #+end_src | 316 | #+end_src |
307 | 317 | ||
308 | *** Fonts | 318 | *** Fonts |
@@ -370,7 +380,6 @@ Let’s configure Emacs using Org mode, they said. It’ll be fun, they said. | |||
370 | (unicode-fonts-setup)) | 380 | (unicode-fonts-setup)) |
371 | #+end_src | 381 | #+end_src |
372 | 382 | ||
373 | |||
374 | * Interactivity | 383 | * Interactivity |
375 | 384 | ||
376 | ** Selectrum | 385 | ** Selectrum |
@@ -594,8 +603,6 @@ Until the =marginalia-annotators= settles, I’m disabling this section. | |||
594 | 603 | ||
595 | * Files | 604 | * Files |
596 | 605 | ||
597 | |||
598 | |||
599 | ** Encoding | 606 | ** Encoding |
600 | 607 | ||
601 | *** UTF-8 | 608 | *** UTF-8 |
@@ -717,6 +724,42 @@ Until the =marginalia-annotators= settles, I’m disabling this section. | |||
717 | (global-aggressive-indent-mode +1)) | 724 | (global-aggressive-indent-mode +1)) |
718 | #+end_src | 725 | #+end_src |
719 | 726 | ||
727 | ** Completion | ||
728 | |||
729 | #+begin_src emacs-lisp | ||
730 | (use-package company | ||
731 | :custom | ||
732 | (company-idle-delay 0.1) | ||
733 | |||
734 | :init | ||
735 | (defun acdw/company-complete-common-or-cycle+1 () | ||
736 | (interactive) | ||
737 | (company-complete-common-or-cycle +1)) | ||
738 | |||
739 | (defun acdw/company-complete-common-or-cycle-1 () | ||
740 | (interactive) | ||
741 | (company-complete-common-or-cycle -1)) | ||
742 | |||
743 | :bind | ||
744 | (:map company-active-map | ||
745 | ("C-n" . acdw/company-complete-common-or-cycle+1) | ||
746 | ("C-p" . acdw/company-complete-common-or-cycle-1)) | ||
747 | |||
748 | :hook | ||
749 | (prog-mode-hook . company-mode)) | ||
750 | |||
751 | (use-package company-prescient | ||
752 | :hook | ||
753 | (company-mode-hook . company-prescient-mode)) | ||
754 | |||
755 | ;; this comes with company-quickhelp, so.... | ||
756 | |||
757 | (use-package company-posframe | ||
758 | :after (company) | ||
759 | :config | ||
760 | (company-posframe-mode +1)) | ||
761 | #+end_src | ||
762 | |||
720 | * Writing | 763 | * Writing |
721 | 764 | ||
722 | ** Visual Fill Column | 765 | ** Visual Fill Column |
@@ -879,8 +922,9 @@ from [[https://github.com/alphapapa/unpackaged.el#ensure-blank-lines-between-hea | |||
879 | (interactive "P") | 922 | (interactive "P") |
880 | (org-map-entries (lambda () | 923 | (org-map-entries (lambda () |
881 | (org-with-wide-buffer | 924 | (org-with-wide-buffer |
882 | ;; `org-map-entries' narrows the buffer, which prevents us from seeing | 925 | ;; `org-map-entries' narrows the buffer, which prevents us |
883 | ;; newlines before the current heading, so we do this part widened. | 926 | ;; from seeing newlines before the current heading, so we |
927 | ;; do this part widened. | ||
884 | (while (not (looking-back "\n\n" nil)) | 928 | (while (not (looking-back "\n\n" nil)) |
885 | ;; Insert blank lines before heading. | 929 | ;; Insert blank lines before heading. |
886 | (insert "\n"))) | 930 | (insert "\n"))) |
@@ -892,9 +936,10 @@ from [[https://github.com/alphapapa/unpackaged.el#ensure-blank-lines-between-hea | |||
892 | ;; Skip planning lines | 936 | ;; Skip planning lines |
893 | (forward-line)) | 937 | (forward-line)) |
894 | (while (re-search-forward org-drawer-regexp end t) | 938 | (while (re-search-forward org-drawer-regexp end t) |
895 | ;; Skip drawers. You might think that `org-at-drawer-p' would suffice, but | 939 | ;; Skip drawers. You might think that `org-at-drawer-p' |
896 | ;; for some reason it doesn't work correctly when operating on hidden text. | 940 | ;; would suffice, but for some reason it doesn't work |
897 | ;; This works, taken from `org-agenda-get-some-entry-text'. | 941 | ;; correctly when operating on hidden text. This |
942 | ;; works, taken from `org-agenda-get-some-entry-text'. | ||
898 | (re-search-forward "^[ \t]*:END:.*\n?" end t) | 943 | (re-search-forward "^[ \t]*:END:.*\n?" end t) |
899 | (goto-char (match-end 0))) | 944 | (goto-char (match-end 0))) |
900 | (unless (or (= (point) (point-max)) | 945 | (unless (or (= (point) (point-max)) |
@@ -917,6 +962,86 @@ from [[https://github.com/alphapapa/unpackaged.el#ensure-blank-lines-between-hea | |||
917 | (add-hook 'before-save-hook #'cribbed/org-mode-fix-blank-lines) | 962 | (add-hook 'before-save-hook #'cribbed/org-mode-fix-blank-lines) |
918 | #+end_src | 963 | #+end_src |
919 | 964 | ||
965 | ** Elpher | ||
966 | |||
967 | #+begin_src emacs-lisp | ||
968 | (use-package elpher | ||
969 | :straight (elpher | ||
970 | :repo "git://thelambdalab.xyz/elpher.git" | ||
971 | :branch "patch_multiple_buffers") | ||
972 | |||
973 | :custom | ||
974 | (elpher-ipv4-always t) | ||
975 | |||
976 | :custom-face | ||
977 | (elpher-gemini-heading1 | ||
978 | ((t (:inherit (modus-theme-heading-1))))) | ||
979 | (elpher-gemini-heading2 | ||
980 | ((t (:inherit (modus-theme-heading-2))))) | ||
981 | (elpher-gemini-heading3 | ||
982 | ((t (:inherit (modus-theme-heading-3))))) | ||
983 | |||
984 | :config | ||
985 | (defun elpher:eww-browse-url (original url &optional new-window) | ||
986 | "Handle gemini/gopher links with eww." | ||
987 | (cond ((string-match-p "\\`\\(gemini\\|gopher\\)://" url) | ||
988 | (require 'elpher) | ||
989 | (elpher-go url)) | ||
990 | (t (funcall original url new-window)))) | ||
991 | (advice-add 'eww-browse-url :around 'elpher:eww-browse-url) | ||
992 | |||
993 | :bind (:map elpher-mode-map | ||
994 | ("n" . elpher-next-link) | ||
995 | ("p" . elpher-prev-link) | ||
996 | ("o" . elpher-follow-current-link) | ||
997 | ("G" . elpher-go-current)) | ||
998 | |||
999 | :hook | ||
1000 | (elpher-mode-hook . visual-fill-column-mode)) | ||
1001 | #+end_src | ||
1002 | |||
1003 | *** Gemini mode | ||
1004 | |||
1005 | #+begin_src emacs-lisp | ||
1006 | (use-package gemini-mode | ||
1007 | :straight (gemini-mode | ||
1008 | :repo "https://git.carcosa.net/jmcbray/gemini.el.git") | ||
1009 | |||
1010 | :mode "\\.\\(gemini|gmi\\)\\'" | ||
1011 | |||
1012 | :custom-face | ||
1013 | (gemini-heading-face-1 | ||
1014 | ((t (:inherit (elpher-gemini-heading1))))) | ||
1015 | (gemini-heading-face2 | ||
1016 | ((t (:inherit (elpher-gemini-heading2))))) | ||
1017 | (gemini-heading-face3 | ||
1018 | ((t (:inherit (elpher-gemini-heading3))))) | ||
1019 | |||
1020 | :init | ||
1021 | (defun acdw/setup-gemini-mode () | ||
1022 | (visual-fill-column-mode 1) | ||
1023 | (variable-pitch-mode -1)) | ||
1024 | |||
1025 | :hook | ||
1026 | (gemini-mode-hook . acdw/setup-gemini-mode)) | ||
1027 | #+end_src | ||
1028 | |||
1029 | *** Gemini write | ||
1030 | |||
1031 | #+begin_src emacs-lisp | ||
1032 | (use-package gemini-write | ||
1033 | :straight (gemini-write | ||
1034 | :repo "https://alexschroeder.ch/cgit/gemini-write")) | ||
1035 | #+end_src | ||
1036 | |||
1037 | ** Pastebin | ||
1038 | |||
1039 | #+begin_src emacs-lisp | ||
1040 | (use-package 0x0 | ||
1041 | :custom | ||
1042 | (0x0-default-service 'ttm)) | ||
1043 | #+end_src | ||
1044 | |||
920 | * Appendices | 1045 | * Appendices |
921 | 1046 | ||
922 | ** Emacs' files | 1047 | ** Emacs' files |
@@ -932,18 +1057,14 @@ from [[https://github.com/alphapapa/unpackaged.el#ensure-blank-lines-between-hea | |||
932 | 1057 | ||
933 | **** Load config | 1058 | **** Load config |
934 | 1059 | ||
935 | from [[https://protesilaos.com/dotemacs/#h:584c3604-55a1-49d0-9c31-abe46cb1f028][Protesilaos Stavrou]]. | 1060 | inspired by [[https://protesilaos.com/dotemacs/#h:584c3604-55a1-49d0-9c31-abe46cb1f028][Protesilaos Stavrou]]. |
936 | 1061 | ||
937 | #+begin_src emacs-lisp | 1062 | #+begin_src emacs-lisp |
938 | (let* ((conf (expand-file-name "config" | 1063 | (let ((conf (expand-file-name "config" |
939 | user-emacs-directory)) | 1064 | user-emacs-directory))) |
940 | (elc (concat conf ".elc")) | 1065 | (unless (load conf 'no-error) |
941 | (el (concat conf ".el")) | 1066 | (require 'org) |
942 | (org (concat conf ".org"))) | 1067 | (org-babel-load-file (concat conf ".org")))) |
943 | (cond ((file-exists-p elc) (load-file elc)) | ||
944 | ((file-exists-p el) (load-file el)) | ||
945 | (t (require 'org) | ||
946 | (org-babel-load-file org)))) | ||
947 | #+end_src | 1068 | #+end_src |
948 | 1069 | ||
949 | *** early-init.el | 1070 | *** early-init.el |
@@ -970,24 +1091,30 @@ from [[https://github.com/alphapapa/unpackaged.el#ensure-blank-lines-between-hea | |||
970 | (let ((config (expand-file-name "config.org" user-emacs-directory))) | 1091 | (let ((config (expand-file-name "config.org" user-emacs-directory))) |
971 | (save-mark-and-excursion | 1092 | (save-mark-and-excursion |
972 | (with-current-buffer (find-file config) | 1093 | (with-current-buffer (find-file config) |
973 | (let ((prog-mode-hook nil)) | 1094 | (let ((prog-mode-hook nil)) |
974 | ;; generate the readme | 1095 | ;; generate the readme |
975 | (require 'ox-md) | 1096 | (when (file-newer-than-file-p config (expand-file-name |
976 | (org-md-export-to-markdown) | 1097 | "README.md" |
977 | ;; tangle config.org | 1098 | user-emacs-directory)) |
978 | (require 'org) | 1099 | (require 'ox-md) |
979 | (let ((inits (org-babel-tangle))) | 1100 | (org-md-export-to-markdown)) |
980 | ;; byte-compile resulting files | 1101 | ;; tangle config.org |
981 | (dolist (f inits) | 1102 | (when (file-newer-than-file-p config (expand-file-name |
982 | (when (string-match "\\.el\\'" f) | 1103 | "config.el" |
983 | (byte-compile-file f (not disable-load)))))))))) | 1104 | user-emacs-directory)) |
1105 | (require 'org) | ||
1106 | (let ((inits (org-babel-tangle))) | ||
1107 | ;; byte-compile resulting files | ||
1108 | (dolist (f inits) | ||
1109 | (when (string-match "\\.el\\'" f) | ||
1110 | (byte-compile-file f (not disable-load))))))))))) | ||
984 | #+end_src | 1111 | #+end_src |
985 | 1112 | ||
986 | *** Add a hook to tangle when quitting | 1113 | *** Add a hook to tangle when quitting |
987 | 1114 | ||
988 | #+begin_src emacs-lisp | 1115 | #+begin_src emacs-lisp |
989 | (defun acdw/refresh-emacs-no-load () | 1116 | (defun acdw/refresh-emacs-no-load () |
990 | (refresh-emacs t)) | 1117 | (refresh-emacs 'disable-load)) |
991 | 1118 | ||
992 | (add-hook 'kill-emacs-hook #'acdw/refresh-emacs-no-load) | 1119 | (add-hook 'kill-emacs-hook #'acdw/refresh-emacs-no-load) |
993 | #+end_src | 1120 | #+end_src |