diff options
-rw-r--r-- | README.md | 201 | ||||
-rw-r--r-- | config.org | 217 |
2 files changed, 342 insertions, 76 deletions
diff --git a/README.md b/README.md index 39430ab..1347bdc 100644 --- a/README.md +++ b/README.md | |||
@@ -29,6 +29,8 @@ Let’s configure Emacs using Org mode, they said. It’ll be fun, they said. | |||
29 | 29 | ||
30 | ### Straight.el | 30 | ### Straight.el |
31 | 31 | ||
32 | This still doesn’t work under Windows – I have to manually download the [repo archive](https://github.com/raxod502/straight.el/archive/master.zip) and unzip it. Not the biggest burden, I suppose. | ||
33 | |||
32 | (defvar bootstrap-version) | 34 | (defvar bootstrap-version) |
33 | (let ((bootstrap-file | 35 | (let ((bootstrap-file |
34 | (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) | 36 | (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) |
@@ -100,7 +102,7 @@ Let’s configure Emacs using Org mode, they said. It’ll be fun, they said. | |||
100 | "autosaves" | 102 | "autosaves" |
101 | "undos" | 103 | "undos" |
102 | "elpher-certificates")) | 104 | "elpher-certificates")) |
103 | (make-directory (no-littering-expand-var-file-name dir) t)) | 105 | (make-directory (no-littering-expand-var-file-name dir) 'parents)) |
104 | 106 | ||
105 | 107 | ||
106 | ## About me | 108 | ## About me |
@@ -247,7 +249,8 @@ Let’s configure Emacs using Org mode, they said. It’ll be fun, they said. | |||
247 | (modus-themes-diffs nil) | 249 | (modus-themes-diffs nil) |
248 | (modus-themes-org-blocks 'grayscale) | 250 | (modus-themes-org-blocks 'grayscale) |
249 | (modus-themes-headings | 251 | (modus-themes-headings |
250 | '()) | 252 | '((1 . line) |
253 | (t . t))) | ||
251 | (modus-themes-variable-pitch-headings t) | 254 | (modus-themes-variable-pitch-headings t) |
252 | (modus-themes-scale-headings t) | 255 | (modus-themes-scale-headings t) |
253 | (modus-themes-scale-1 1.1) | 256 | (modus-themes-scale-1 1.1) |
@@ -262,6 +265,27 @@ Let’s configure Emacs using Org mode, they said. It’ll be fun, they said. | |||
262 | (load-theme 'modus-operandi t)) | 265 | (load-theme 'modus-operandi t)) |
263 | 266 | ||
264 | 267 | ||
268 | ### Change theme based on time of day | ||
269 | |||
270 | (cuss calendar-latitude 30.4515) | ||
271 | (cuss calendar-longitude -91.1871) | ||
272 | |||
273 | (use-package circadian | ||
274 | :after solar | ||
275 | :custom | ||
276 | (circadian-themes '((:sunrise . modus-operandi) | ||
277 | (:sunset . modus-vivendi))) | ||
278 | :config | ||
279 | (circadian-setup)) | ||
280 | |||
281 | |||
282 | ### Modeline | ||
283 | |||
284 | (use-package mood-line | ||
285 | :config | ||
286 | (mood-line-mode +1)) | ||
287 | |||
288 | |||
265 | ### Fonts | 289 | ### Fonts |
266 | 290 | ||
267 | 1. Define fonts | 291 | 1. Define fonts |
@@ -301,9 +325,9 @@ Let’s configure Emacs using Org mode, they said. It’ll be fun, they said. | |||
301 | "Linux Libertine O-12" | 325 | "Linux Libertine O-12" |
302 | "Georgia-11")) | 326 | "Georgia-11")) |
303 | 327 | ||
304 | (remove-hook 'after-init-hook #'acdw/setup-fonts))) | 328 | (remove-function after-focus-change-function #'acdw/setup-fonts))) |
305 | 329 | ||
306 | (add-hook 'after-init-hook #'acdw/setup-fonts) | 330 | (add-function :before after-focus-change-function #'acdw/setup-fonts) |
307 | 331 | ||
308 | 2. Variable-pitch in text modes | 332 | 2. Variable-pitch in text modes |
309 | 333 | ||
@@ -618,6 +642,41 @@ I add it to the `find-file-hook` *and* `before-save-hook` because I don't want t | |||
618 | (global-aggressive-indent-mode +1)) | 642 | (global-aggressive-indent-mode +1)) |
619 | 643 | ||
620 | 644 | ||
645 | ## Completion | ||
646 | |||
647 | (use-package company | ||
648 | :custom | ||
649 | (company-idle-delay 0.1) | ||
650 | |||
651 | :init | ||
652 | (defun acdw/company-complete-common-or-cycle+1 () | ||
653 | (interactive) | ||
654 | (company-complete-common-or-cycle +1)) | ||
655 | |||
656 | (defun acdw/company-complete-common-or-cycle-1 () | ||
657 | (interactive) | ||
658 | (company-complete-common-or-cycle -1)) | ||
659 | |||
660 | :bind | ||
661 | (:map company-active-map | ||
662 | ("C-n" . acdw/company-complete-common-or-cycle+1) | ||
663 | ("C-p" . acdw/company-complete-common-or-cycle-1)) | ||
664 | |||
665 | :hook | ||
666 | (prog-mode-hook . company-mode)) | ||
667 | |||
668 | (use-package company-prescient | ||
669 | :hook | ||
670 | (company-mode-hook . company-prescient-mode)) | ||
671 | |||
672 | ;; this comes with company-quickhelp, so.... | ||
673 | |||
674 | (use-package company-posframe | ||
675 | :after (company) | ||
676 | :config | ||
677 | (company-posframe-mode +1)) | ||
678 | |||
679 | |||
621 | # Writing | 680 | # Writing |
622 | 681 | ||
623 | 682 | ||
@@ -774,8 +833,9 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#ensure-blank-lin | |||
774 | (interactive "P") | 833 | (interactive "P") |
775 | (org-map-entries (lambda () | 834 | (org-map-entries (lambda () |
776 | (org-with-wide-buffer | 835 | (org-with-wide-buffer |
777 | ;; `org-map-entries' narrows the buffer, which prevents us from seeing | 836 | ;; `org-map-entries' narrows the buffer, which prevents us |
778 | ;; newlines before the current heading, so we do this part widened. | 837 | ;; from seeing newlines before the current heading, so we |
838 | ;; do this part widened. | ||
779 | (while (not (looking-back "\n\n" nil)) | 839 | (while (not (looking-back "\n\n" nil)) |
780 | ;; Insert blank lines before heading. | 840 | ;; Insert blank lines before heading. |
781 | (insert "\n"))) | 841 | (insert "\n"))) |
@@ -787,9 +847,10 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#ensure-blank-lin | |||
787 | ;; Skip planning lines | 847 | ;; Skip planning lines |
788 | (forward-line)) | 848 | (forward-line)) |
789 | (while (re-search-forward org-drawer-regexp end t) | 849 | (while (re-search-forward org-drawer-regexp end t) |
790 | ;; Skip drawers. You might think that `org-at-drawer-p' would suffice, but | 850 | ;; Skip drawers. You might think that `org-at-drawer-p' |
791 | ;; for some reason it doesn't work correctly when operating on hidden text. | 851 | ;; would suffice, but for some reason it doesn't work |
792 | ;; This works, taken from `org-agenda-get-some-entry-text'. | 852 | ;; correctly when operating on hidden text. This |
853 | ;; works, taken from `org-agenda-get-some-entry-text'. | ||
793 | (re-search-forward "^[ \t]*:END:.*\n?" end t) | 854 | (re-search-forward "^[ \t]*:END:.*\n?" end t) |
794 | (goto-char (match-end 0))) | 855 | (goto-char (match-end 0))) |
795 | (unless (or (= (point) (point-max)) | 856 | (unless (or (= (point) (point-max)) |
@@ -810,6 +871,82 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#ensure-blank-lin | |||
810 | (add-hook 'before-save-hook #'cribbed/org-mode-fix-blank-lines) | 871 | (add-hook 'before-save-hook #'cribbed/org-mode-fix-blank-lines) |
811 | 872 | ||
812 | 873 | ||
874 | ## Elpher | ||
875 | |||
876 | (use-package elpher | ||
877 | :straight (elpher | ||
878 | :repo "git://thelambdalab.xyz/elpher.git" | ||
879 | :branch "patch_multiple_buffers") | ||
880 | |||
881 | :custom | ||
882 | (elpher-ipv4-always t) | ||
883 | |||
884 | :custom-face | ||
885 | (elpher-gemini-heading1 | ||
886 | ((t (:inherit (modus-theme-heading-1))))) | ||
887 | (elpher-gemini-heading2 | ||
888 | ((t (:inherit (modus-theme-heading-2))))) | ||
889 | (elpher-gemini-heading3 | ||
890 | ((t (:inherit (modus-theme-heading-3))))) | ||
891 | |||
892 | :config | ||
893 | (defun elpher:eww-browse-url (original url &optional new-window) | ||
894 | "Handle gemini/gopher links with eww." | ||
895 | (cond ((string-match-p "\\`\\(gemini\\|gopher\\)://" url) | ||
896 | (require 'elpher) | ||
897 | (elpher-go url)) | ||
898 | (t (funcall original url new-window)))) | ||
899 | (advice-add 'eww-browse-url :around 'elpher:eww-browse-url) | ||
900 | |||
901 | :bind (:map elpher-mode-map | ||
902 | ("n" . elpher-next-link) | ||
903 | ("p" . elpher-prev-link) | ||
904 | ("o" . elpher-follow-current-link) | ||
905 | ("G" . elpher-go-current)) | ||
906 | |||
907 | :hook | ||
908 | (elpher-mode-hook . visual-fill-column-mode)) | ||
909 | |||
910 | |||
911 | ### Gemini mode | ||
912 | |||
913 | (use-package gemini-mode | ||
914 | :straight (gemini-mode | ||
915 | :repo "https://git.carcosa.net/jmcbray/gemini.el.git") | ||
916 | |||
917 | :mode "\\.\\(gemini|gmi\\)\\'" | ||
918 | |||
919 | :custom-face | ||
920 | (gemini-heading-face-1 | ||
921 | ((t (:inherit (elpher-gemini-heading1))))) | ||
922 | (gemini-heading-face2 | ||
923 | ((t (:inherit (elpher-gemini-heading2))))) | ||
924 | (gemini-heading-face3 | ||
925 | ((t (:inherit (elpher-gemini-heading3))))) | ||
926 | |||
927 | :init | ||
928 | (defun acdw/setup-gemini-mode () | ||
929 | (visual-fill-column-mode 1) | ||
930 | (variable-pitch-mode -1)) | ||
931 | |||
932 | :hook | ||
933 | (gemini-mode-hook . acdw/setup-gemini-mode)) | ||
934 | |||
935 | |||
936 | ### Gemini write | ||
937 | |||
938 | (use-package gemini-write | ||
939 | :straight (gemini-write | ||
940 | :repo "https://alexschroeder.ch/cgit/gemini-write")) | ||
941 | |||
942 | |||
943 | ## Pastebin | ||
944 | |||
945 | (use-package 0x0 | ||
946 | :custom | ||
947 | (0x0-default-service 'ttm)) | ||
948 | |||
949 | |||
813 | # Appendices | 950 | # Appendices |
814 | 951 | ||
815 | 952 | ||
@@ -822,17 +959,13 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#ensure-blank-lin | |||
822 | 959 | ||
823 | 1. Load config | 960 | 1. Load config |
824 | 961 | ||
825 | from [Protesilaos Stavrou](https://protesilaos.com/dotemacs/#h:584c3604-55a1-49d0-9c31-abe46cb1f028). | 962 | inspired by [Protesilaos Stavrou](https://protesilaos.com/dotemacs/#h:584c3604-55a1-49d0-9c31-abe46cb1f028). |
826 | 963 | ||
827 | (let* ((conf (expand-file-name "config" | 964 | (let ((conf (expand-file-name "config" |
828 | user-emacs-directory)) | 965 | user-emacs-directory))) |
829 | (elc (concat conf ".elc")) | 966 | (unless (load conf 'no-error) |
830 | (el (concat conf ".el")) | 967 | (require 'org) |
831 | (org (concat conf ".org"))) | 968 | (org-babel-load-file (concat conf ".org")))) |
832 | (cond ((file-exists-p elc) (load-file elc)) | ||
833 | ((file-exists-p el) (load-file el)) | ||
834 | (t (require 'org) | ||
835 | (org-babel-load-file org)))) | ||
836 | 969 | ||
837 | 970 | ||
838 | ### early-init.el | 971 | ### early-init.el |
@@ -852,23 +985,29 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#ensure-blank-lin | |||
852 | (let ((config (expand-file-name "config.org" user-emacs-directory))) | 985 | (let ((config (expand-file-name "config.org" user-emacs-directory))) |
853 | (save-mark-and-excursion | 986 | (save-mark-and-excursion |
854 | (with-current-buffer (find-file config) | 987 | (with-current-buffer (find-file config) |
855 | (let ((prog-mode-hook nil)) | 988 | (let ((prog-mode-hook nil)) |
856 | ;; generate the readme | 989 | ;; generate the readme |
857 | (require 'ox-md) | 990 | (when (file-newer-than-file-p config (expand-file-name |
858 | (org-md-export-to-markdown) | 991 | "README.md" |
859 | ;; tangle config.org | 992 | user-emacs-directory)) |
860 | (require 'org) | 993 | (require 'ox-md) |
861 | (let ((inits (org-babel-tangle))) | 994 | (org-md-export-to-markdown)) |
862 | ;; byte-compile resulting files | 995 | ;; tangle config.org |
863 | (dolist (f inits) | 996 | (when (file-newer-than-file-p config (expand-file-name |
864 | (when (string-match "\\.el\\'" f) | 997 | "config.el" |
865 | (byte-compile-file f (not disable-load)))))))))) | 998 | user-emacs-directory)) |
999 | (require 'org) | ||
1000 | (let ((inits (org-babel-tangle))) | ||
1001 | ;; byte-compile resulting files | ||
1002 | (dolist (f inits) | ||
1003 | (when (string-match "\\.el\\'" f) | ||
1004 | (byte-compile-file f (not disable-load))))))))))) | ||
866 | 1005 | ||
867 | 1006 | ||
868 | ### Add a hook to tangle when quitting | 1007 | ### Add a hook to tangle when quitting |
869 | 1008 | ||
870 | (defun acdw/refresh-emacs-no-load () | 1009 | (defun acdw/refresh-emacs-no-load () |
871 | (refresh-emacs t)) | 1010 | (refresh-emacs 'disable-load)) |
872 | 1011 | ||
873 | (add-hook 'kill-emacs-hook #'acdw/refresh-emacs-no-load) | 1012 | (add-hook 'kill-emacs-hook #'acdw/refresh-emacs-no-load) |
874 | 1013 | ||
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 |