diff options
author | Case Duckworth | 2022-02-06 22:17:56 -0600 |
---|---|---|
committer | Case Duckworth | 2022-02-06 22:18:36 -0600 |
commit | b0abd8aca60912f283bf43df651d14a36dbc9f6a (patch) | |
tree | 16462ce783bb68f8fd267dbf06e9408a16c7298b | |
parent | Add other link types (diff) | |
download | emacs-b0abd8aca60912f283bf43df651d14a36dbc9f6a.tar.gz emacs-b0abd8aca60912f283bf43df651d14a36dbc9f6a.zip |
Meh
-rw-r--r-- | init.el | 308 | ||||
-rw-r--r-- | lisp/+xkcd.el | 16 |
2 files changed, 180 insertions, 144 deletions
diff --git a/init.el b/init.el index 86617d5..635bfe5 100644 --- a/init.el +++ b/init.el | |||
@@ -15,6 +15,7 @@ | |||
15 | ;; - Make good choices. | 15 | ;; - Make good choices. |
16 | 16 | ||
17 | ;;; Code: | 17 | ;;; Code: |
18 | |||
18 | (let ((early-features `((early-init . ,(locate-user-emacs-file "early-init")) | 19 | (let ((early-features `((early-init . ,(locate-user-emacs-file "early-init")) |
19 | acdw private +key))) | 20 | acdw private +key))) |
20 | (dolist (feature early-features) | 21 | (dolist (feature early-features) |
@@ -63,10 +64,16 @@ | |||
63 | 64 | ||
64 | (setup (:require auth-source) | 65 | (setup (:require auth-source) |
65 | (:option auth-sources (list 'default | 66 | (:option auth-sources (list 'default |
67 | "secrets:passwords" | ||
66 | (private/ "authinfo"))) | 68 | (private/ "authinfo"))) |
67 | (:with-mode authinfo-mode | 69 | (:with-mode authinfo-mode |
68 | (:local-set truncate-lines t))) | 70 | (:local-set truncate-lines t))) |
69 | 71 | ||
72 | (setup (:require autoinsert) | ||
73 | (setf (alist-get "\\.scm" auto-insert-alist nil nil #'equal) | ||
74 | '(insert "#!/bin/sh\n#| -*- scheme -*-\nexec csi -s $0 \"$@\"\n|#\n")) | ||
75 | (auto-insert-mode +1)) | ||
76 | |||
70 | (setup (:require cus-edit) | 77 | (setup (:require cus-edit) |
71 | ;; I don't use Custom to actually /make/ any customizations, but it's handy to | 78 | ;; I don't use Custom to actually /make/ any customizations, but it's handy to |
72 | ;; (A) see what options are available and (B) persist some changes across | 79 | ;; (A) see what options are available and (B) persist some changes across |
@@ -193,6 +200,10 @@ | |||
193 | args))) | 200 | args))) |
194 | (cons (+browse-url-secondary-browser-regexps-combine) ; non-text websites | 201 | (cons (+browse-url-secondary-browser-regexps-combine) ; non-text websites |
195 | browse-url-secondary-browser-function) | 202 | browse-url-secondary-browser-function) |
203 | (cons "xkcd\\.com" | ||
204 | (if (fboundp 'xkcd-get) | ||
205 | #'+xkcd-get-from-url | ||
206 | +browse-url-browser-function)) | ||
196 | (cons "." ; everything else | 207 | (cons "." ; everything else |
197 | +browse-url-browser-function))) | 208 | +browse-url-browser-function))) |
198 | ;; Transform URLs before passing to `browse-url' | 209 | ;; Transform URLs before passing to `browse-url' |
@@ -254,6 +265,8 @@ | |||
254 | #'dired-hide-details-mode | 265 | #'dired-hide-details-mode |
255 | #'hl-line-mode) | 266 | #'hl-line-mode) |
256 | (:+key "C-x C-j" #'dired-jump) | 267 | (:+key "C-x C-j" #'dired-jump) |
268 | (dolist (refresh-after-func '(dired-do-flagged-delete)) | ||
269 | (advice-add refresh-after-func :after #'revert-buffer)) | ||
257 | (with-eval-after-load 'dired | 270 | (with-eval-after-load 'dired |
258 | (cl-case system-type | 271 | (cl-case system-type |
259 | ((windows-nt ms-dos) | 272 | ((windows-nt ms-dos) |
@@ -552,7 +565,7 @@ | |||
552 | org-agenda-templates)) | 565 | org-agenda-templates)) |
553 | (add-to-list '+custom-variable-allowlist var)) | 566 | (add-to-list '+custom-variable-allowlist var)) |
554 | (with-eval-after-load 'org | 567 | (with-eval-after-load 'org |
555 | (add-to-list 'org-agenda-files (sync/ "org/" t))) | 568 | (add-to-list 'org-agenda-files (sync/ "org/" t))) |
556 | (:+leader "a" #'org-agenda "C-a" #'org-agenda) | 569 | (:+leader "a" #'org-agenda "C-a" #'org-agenda) |
557 | (:hook #'hl-line-mode) | 570 | (:hook #'hl-line-mode) |
558 | (add-hook 'org-agenda-after-show-hook 'org-narrow-to-subtree)) | 571 | (add-hook 'org-agenda-after-show-hook 'org-narrow-to-subtree)) |
@@ -657,57 +670,26 @@ | |||
657 | 'display t | 670 | 'display t |
658 | 'close-tab t) | 671 | 'close-tab t) |
659 | tab-bar-new-button (propertize "+ " 'display t)) | 672 | tab-bar-new-button (propertize "+ " 'display t)) |
673 | ;; I need to set these here so that they take effect /before/ `display-time-mode' | ||
674 | (:option display-time-format "%H:%M" | ||
675 | display-time-mail-file :disable | ||
676 | display-time-load-average-threshold 50) | ||
677 | (:option tab-bar-format '(+tab-bar-format-menu-bar | ||
678 | tab-bar-format-history | ||
679 | tab-bar-format-tabs | ||
680 | tab-bar-separator | ||
681 | tab-bar-format-add-tab | ||
682 | tab-bar-format-align-right | ||
683 | ;;+tab-bar-misc-info | ||
684 | tab-bar-separator | ||
685 | +tab-bar-tracking-mode | ||
686 | +tab-bar-date)) | ||
660 | (tab-bar-mode +1) | 687 | (tab-bar-mode +1) |
661 | (if (version< emacs-version "28.0") | 688 | (display-time-mode +1)) |
662 | (+tab-bar-misc-info-mode +1) | ||
663 | (:option tab-bar-format '(+tab-bar-format-menu-bar | ||
664 | tab-bar-format-history | ||
665 | tab-bar-format-tabs | ||
666 | tab-bar-separator | ||
667 | tab-bar-format-add-tab | ||
668 | tab-bar-format-align-right | ||
669 | +tab-bar-misc-info | ||
670 | tab-bar-separator | ||
671 | )))) | ||
672 | 689 | ||
673 | (setup text | 690 | (setup text |
674 | (:hook #'turn-on-auto-fill)) | 691 | (:hook #'turn-on-auto-fill)) |
675 | 692 | ||
676 | (setup time | ||
677 | ;; TODO: +display-time-mode with MOAR customizations | ||
678 | (:option display-time-default-load-average nil | ||
679 | display-time-mail-file :disable) | ||
680 | (:require discord +tab-bar) ; Require instead of eval after load | ||
681 | (:option display-time-string-forms | ||
682 | '((propertize (format-time-string "%H:%M %a %e" now) | ||
683 | 'face '+tab-bar-extra | ||
684 | 'help-echo (discord-date-string)) | ||
685 | load | ||
686 | (if mail | ||
687 | (concat " " | ||
688 | (propertize | ||
689 | display-time-mail-string | ||
690 | 'display `(when (and display-time-use-mail-icon | ||
691 | (display-graphic-p)) | ||
692 | ,@display-time-mail-icon | ||
693 | ,@(when (and | ||
694 | display-time-mail-face | ||
695 | (memq | ||
696 | (plist-get | ||
697 | (cdr display-time-mail-icon) | ||
698 | :type) | ||
699 | '(pbm xbm))) | ||
700 | (let ((bg (face-attribute | ||
701 | display-time-mail-face | ||
702 | :background))) | ||
703 | (when (stringp bg) | ||
704 | (list :background bg))))) | ||
705 | 'face display-time-mail-face)) | ||
706 | "") | ||
707 | " ")) | ||
708 | |||
709 | (display-time-mode +1)) | ||
710 | |||
711 | (setup tramp | 693 | (setup tramp |
712 | (el-patch-feature tramp) | 694 | (el-patch-feature tramp) |
713 | (with-eval-after-load 'tramp | 695 | (with-eval-after-load 'tramp |
@@ -717,8 +699,8 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." | |||
717 | (with-current-buffer buffer | 699 | (with-current-buffer buffer |
718 | (el-patch-wrap 2 | 700 | (el-patch-wrap 2 |
719 | (save-restriction | 701 | (save-restriction |
720 | (widen) | 702 | (widen) |
721 | (string-equal (buffer-substring 1 10) ";; Emacs:"))))))) | 703 | (string-equal (buffer-substring 1 10) ";; Emacs:"))))))) |
722 | 704 | ||
723 | (setup (:straight 0x0) | 705 | (setup (:straight 0x0) |
724 | (:option 0x0-default-server 'ttm) | 706 | (:option 0x0-default-server 'ttm) |
@@ -743,6 +725,19 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." | |||
743 | (:with-mode adaptive-wrap-prefix-mode | 725 | (:with-mode adaptive-wrap-prefix-mode |
744 | (:hook-into visual-column-mode))) | 726 | (:hook-into visual-column-mode))) |
745 | 727 | ||
728 | (setup (:straight-when affe | ||
729 | (or (executable-find "rg") | ||
730 | (and (executable-find "find") | ||
731 | (executable-find "grep")))) | ||
732 | (:load-after consult orderless vertico) | ||
733 | (setq affe-regexp-compiler (defun affe-orderless-regexp-compiler (input _type) | ||
734 | (setq input (orderless-pattern-compiler input)) | ||
735 | (cons input (lambda (str) (orderless--highlight input str))))) | ||
736 | (with-eval-after-load 'affe | ||
737 | (setf (alist-get 'affe-grep vertico-multiform-commands) '(buffer) | ||
738 | (alist-get 'affe-find vertico-multiform-commands) nil) | ||
739 | (:global "M-s g" #'affe-grep))) | ||
740 | |||
746 | (setup (:straight alert) | 741 | (setup (:straight alert) |
747 | (:option alert-default-style 'libnotify)) | 742 | (:option alert-default-style 'libnotify)) |
748 | 743 | ||
@@ -755,15 +750,6 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." | |||
755 | [remap isearch-query-replace] #'anzu-isearch-query-replace | 750 | [remap isearch-query-replace] #'anzu-isearch-query-replace |
756 | [remap isearch-query-replace-regexp] #'anzu-isearch-query-replace-regexp)) | 751 | [remap isearch-query-replace-regexp] #'anzu-isearch-query-replace-regexp)) |
757 | 752 | ||
758 | (setup (:straight-when (apheleia | ||
759 | :host github :repo "raxod502/apheleia") | ||
760 | (eq system-type 'gnu/linux)) | ||
761 | (:require apheleia | ||
762 | +apheleia) | ||
763 | ;; (setf (alist-get 'prettier apheleia-formatters) | ||
764 | ;; '("npx" "prettier" "--stdin-filepath" filepath)) | ||
765 | (apheleia-global-mode +1)) | ||
766 | |||
767 | (setup (:straight avy) | 753 | (setup (:straight avy) |
768 | (:require avy +avy) | 754 | (:require avy +avy) |
769 | (:option avy-background t | 755 | (:option avy-background t |
@@ -927,7 +913,7 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." | |||
927 | (with-temp-buffer | 913 | (with-temp-buffer |
928 | (insert string) | 914 | (insert string) |
929 | (0x0-upload-text (0x0--choose-server))) | 915 | (0x0-upload-text (0x0--choose-server))) |
930 | (current-kill 0))) | 916 | (current-kill 0))) |
931 | (add-to-list '+pulse-location-commands #'lui-track-jump-to-indicator) | 917 | (add-to-list '+pulse-location-commands #'lui-track-jump-to-indicator) |
932 | (:face lui-track-bar ((t (:height 10 | 918 | (:face lui-track-bar ((t (:height 10 |
933 | :underline (:color foreground-color | 919 | :underline (:color foreground-color |
@@ -1037,17 +1023,16 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." | |||
1037 | (with-eval-after-load 'org-mode | 1023 | (with-eval-after-load 'org-mode |
1038 | (define-key org-mode-map "M-g o" 'consult-org-heading)) | 1024 | (define-key org-mode-map "M-g o" 'consult-org-heading)) |
1039 | (advice-add 'consult-yank-pop :after '+yank@indent) | 1025 | (advice-add 'consult-yank-pop :after '+yank@indent) |
1040 | (with-eval-after-load 'consult | 1026 | (:when-loaded |
1041 | (:option consult-narrow-key "<" | 1027 | (:option consult-narrow-key "<" |
1042 | consult-project-root-function '+consult-project-root) | 1028 | consult-project-root-function '+consult-project-root) |
1043 | (consult-customize | 1029 | (consult-customize consult-theme |
1044 | consult-theme | 1030 | :preview-key '(:debounce 0.2 any)) |
1045 | :preview-key '(:debounce 0.2 any) | 1031 | (consult-customize consult-ripgrep consult-git-grep consult-grep |
1046 | consult-ripgrep consult-git-grep consult-grep | 1032 | consult-bookmark consult-recent-file consult-xref |
1047 | consult-bookmark consult-recent-file consult-xref | 1033 | consult--source-file consult--source-project-file |
1048 | consult--source-file consult--source-project-file | 1034 | consult--source-bookmark consult-buffer |
1049 | consult--source-bookmark | 1035 | :preview-key (kbd "M-,")) |
1050 | :preview-key (kbd "M-.")) | ||
1051 | (consult-history-to-modes ((minibuffer-local-map . nil) | 1036 | (consult-history-to-modes ((minibuffer-local-map . nil) |
1052 | (shell-mode-map . shell-mode-hook) | 1037 | (shell-mode-map . shell-mode-hook) |
1053 | (term-mode-map . term-mode-hook) | 1038 | (term-mode-map . term-mode-hook) |
@@ -1055,7 +1040,24 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." | |||
1055 | (comint-mode-map . comint-mode-hook) | 1040 | (comint-mode-map . comint-mode-hook) |
1056 | (sly-mrepl-mode-map . sly-mrepl-hook))) | 1041 | (sly-mrepl-mode-map . sly-mrepl-hook))) |
1057 | (with-eval-after-load 'orderless | 1042 | (with-eval-after-load 'orderless |
1058 | (:option consult--regexp-compiler #'consult--orderless-regexp-compiler)))) | 1043 | (:option consult--regexp-compiler #'consult--orderless-regexp-compiler)) |
1044 | (with-eval-after-load 'vertico-multiform | ||
1045 | (setf (alist-get 'consult-buffer vertico-multiform-commands) '(flat)) | ||
1046 | (dolist (buf-cmd '(consult-find | ||
1047 | consult-yank-pop | ||
1048 | consult-locate | ||
1049 | consult-grep | ||
1050 | consult-git-grep | ||
1051 | consult-ripgrep | ||
1052 | consult-line | ||
1053 | consult-line-multi | ||
1054 | consult-multi-occur | ||
1055 | consult-keep-lines | ||
1056 | consult-focus-lines | ||
1057 | consult-imenu | ||
1058 | consult-imenu-multi | ||
1059 | consult-outline)) | ||
1060 | (setf (alist-get buf-cmd vertico-multiform-commands) '(buffer)))))) | ||
1059 | 1061 | ||
1060 | (setup (:straight consult-dir) | 1062 | (setup (:straight consult-dir) |
1061 | (:+key "C-x C-d" #'consult-dir) | 1063 | (:+key "C-x C-d" #'consult-dir) |
@@ -1063,6 +1065,16 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." | |||
1063 | (:bind "C-x C-d" #'consult-dir | 1065 | (:bind "C-x C-d" #'consult-dir |
1064 | "C-x C-j" #'consult-dir-jump-file))) | 1066 | "C-x C-j" #'consult-dir-jump-file))) |
1065 | 1067 | ||
1068 | (setup (:straight crossword) | ||
1069 | ;; This isn't the perfect Emacs crossword puzzle, but it's the only one I | ||
1070 | ;; know. | ||
1071 | (:hook #'turn-off-+key-mode) | ||
1072 | (:option crossword-save-path (sync/ "emacs/crosswords/" t) | ||
1073 | crossword-empty-position-char "=") | ||
1074 | (:face crossword-grid-face ((t :inherit 'font-lock-string-face)) | ||
1075 | crossword-current-face ((t :inherit 'highlight)) | ||
1076 | crossword-other-dir-face ((t :inherit 'font-lock-keyword-face)))) | ||
1077 | |||
1066 | (setup (:straight crux) | 1078 | (setup (:straight crux) |
1067 | ;; yes it's silly I have an addon to this addon. | 1079 | ;; yes it's silly I have an addon to this addon. |
1068 | (:require crux +crux) | 1080 | (:require crux +crux) |
@@ -1113,6 +1125,14 @@ See also `crux-reopen-as-root-mode'." | |||
1113 | (:option ebuku-display-on-startup 'recent | 1125 | (:option ebuku-display-on-startup 'recent |
1114 | ebuku-recent-count 100)) | 1126 | ebuku-recent-count 100)) |
1115 | 1127 | ||
1128 | (setup (:straight edit-server) | ||
1129 | (:option edit-server-url-major-mode-alist `(("github\\.com" . ,(if (fboundp 'gfm-mode) | ||
1130 | #'gfm-mode | ||
1131 | #'markdown-mode)))) | ||
1132 | (add-hook 'edit-server-done-hook (lambda () (unfill-region (point-min) (point-max)))) | ||
1133 | (+with-ensure-after-init | ||
1134 | (edit-server-start))) | ||
1135 | |||
1116 | (setup (:straight electric-cursor) | 1136 | (setup (:straight electric-cursor) |
1117 | (:option electric-cursor-alist '((overwrite-mode . hbar) | 1137 | (:option electric-cursor-alist '((overwrite-mode . hbar) |
1118 | (god-local-mode . box) | 1138 | (god-local-mode . box) |
@@ -1147,14 +1167,13 @@ See also `crux-reopen-as-root-mode'." | |||
1147 | (advice-add #'elfeed :before #'elfeed-db-load)) | 1167 | (advice-add #'elfeed :before #'elfeed-db-load)) |
1148 | (:with-mode elfeed-show-mode | 1168 | (:with-mode elfeed-show-mode |
1149 | (:bind "SPC" #'+elfeed-scroll-up-command | 1169 | (:bind "SPC" #'+elfeed-scroll-up-command |
1150 | "S-SPC" #'+elfeed-scroll-down-command | 1170 | "S-SPC" #'+elfeed-scroll-down-command |
1151 | "&" #'+elfeed-show-browse-generic | 1171 | "&" #'+elfeed-show-browse-generic |
1152 | "RET" #'shr-browse-url) | 1172 | "RET" #'shr-browse-url) |
1153 | (:hook #'reading-mode) | 1173 | (:hook #'reading-mode) |
1154 | (:option +elfeed--update-repeat (* 60 60) ; 1 hour | 1174 | (:option +elfeed--update-repeat (* 60 60) ; 1 hour |
1155 | +elfeed--update-first-time 60) | 1175 | +elfeed--update-first-time 60) |
1156 | ;; (+elfeed-update-async-mode +1) | 1176 | (+elfeed-update-async-mode +1))) |
1157 | )) | ||
1158 | 1177 | ||
1159 | (setup (:straight elfeed-org) | 1178 | (setup (:straight elfeed-org) |
1160 | (:also-load +org-capture) | 1179 | (:also-load +org-capture) |
@@ -1273,7 +1292,7 @@ See also `crux-reopen-as-root-mode'." | |||
1273 | (:bind-into flyspell | 1292 | (:bind-into flyspell |
1274 | "C-;" #'flyspell-correct-wrapper | 1293 | "C-;" #'flyspell-correct-wrapper |
1275 | "<f7>" #'+flyspell-correct-buffer) | 1294 | "<f7>" #'+flyspell-correct-buffer) |
1276 | (+with-ensure-after-init ; vertico-multiform | 1295 | (with-eval-after-load 'vertico-multiform |
1277 | (setf (alist-get 'flyspell vertico-multiform-categories) nil))) | 1296 | (setf (alist-get 'flyspell vertico-multiform-categories) nil))) |
1278 | 1297 | ||
1279 | (setup (:straight-when (forge | 1298 | (setup (:straight-when (forge |
@@ -1296,32 +1315,12 @@ See also `crux-reopen-as-root-mode'." | |||
1296 | (:option gcmh-idle-delay 'auto) | 1315 | (:option gcmh-idle-delay 'auto) |
1297 | (gcmh-mode +1)) | 1316 | (gcmh-mode +1)) |
1298 | 1317 | ||
1299 | (setup (:straight-when (geiser | 1318 | (setup (:straight geiser |
1300 | :host gitlab :repo "acdw/geiser" | 1319 | geiser-chicken |
1301 | :files (:defaults "doc/*") | 1320 | macrostep-geiser |
1302 | ;; XXX: This seems to trigger a build on every start of Emacs.... | 1321 | scheme-complete) |
1303 | :pre-build ("make" "-Cdoc" "geiser.info")) | 1322 | (setf (alist-get "\\.scm\\'" auto-mode-alist nil nil #'string=) |
1304 | (progn | 1323 | 'scheme-mode)) |
1305 | (defvar +schemes | ||
1306 | (let (schemes) | ||
1307 | (dolist (scheme '(("scheme" . geiser-chez) ; chez | ||
1308 | ("petite" . geiser-chez) ; petite | ||
1309 | ("csi" . geiser-chicken) ; chicken | ||
1310 | ("gsi" . geiser-gambit) | ||
1311 | ("gosh" . geiser-gauche) | ||
1312 | ("guile" . geiser-guile) | ||
1313 | ("kawa" . geiser-kawa) | ||
1314 | ("mit-scheme" . geiser-mit) | ||
1315 | ("racket" . geiser-racket) | ||
1316 | ("stklos" . geiser-stklos))) | ||
1317 | (when-let (binary (executable-find (car scheme))) | ||
1318 | (push binary schemes) | ||
1319 | ;; and install the proper helper package | ||
1320 | (straight-use-package (cdr scheme)))) | ||
1321 | (nreverse schemes))) | ||
1322 | +schemes)) | ||
1323 | (:file-match (rx ".rkt" eos) | ||
1324 | (rx ".scm" eos))) | ||
1325 | 1324 | ||
1326 | (setup (:straight (git-modes | 1325 | (setup (:straight (git-modes |
1327 | :host github :repo "magit/git-modes")) | 1326 | :host github :repo "magit/git-modes")) |
@@ -1337,12 +1336,16 @@ See also `crux-reopen-as-root-mode'." | |||
1337 | ;; "a" nil))) | 1336 | ;; "a" nil))) |
1338 | 1337 | ||
1339 | (setup (:straight helpful) | 1338 | (setup (:straight helpful) |
1340 | (run-with-idle-timer 0.5 nil | ||
1341 | 'require 'helpful) | ||
1342 | (:+key "<f1> f" #'helpful-callable | 1339 | (:+key "<f1> f" #'helpful-callable |
1343 | "<f1> v" #'helpful-variable | 1340 | "<f1> v" #'helpful-variable |
1344 | "<f1> k" #'helpful-key | 1341 | "<f1> k" #'helpful-key |
1345 | "<f1> ." #'helpful-at-point)) | 1342 | "<f1> ." #'helpful-at-point) |
1343 | (with-eval-after-load 'vertico-multiform | ||
1344 | (dolist (cmd '(describe-symbol ; describe-* included here for completeness | ||
1345 | describe-function describe-variable | ||
1346 | helpful-function helpful-macro helpful-callable | ||
1347 | helpful-variable)) | ||
1348 | (setf (alist-get cmd vertico-multiform-commands) nil)))) | ||
1346 | 1349 | ||
1347 | (setup (:straight (hippie-completing-read | 1350 | (setup (:straight (hippie-completing-read |
1348 | :host github | 1351 | :host github |
@@ -1376,7 +1379,8 @@ See also `crux-reopen-as-root-mode'." | |||
1376 | ;; This complicatedness is an attempt to make it easier to add and | 1379 | ;; This complicatedness is an attempt to make it easier to add and |
1377 | ;; subtract `isearch-mb' bindings using the suggestions in the | 1380 | ;; subtract `isearch-mb' bindings using the suggestions in the |
1378 | ;; project's README. | 1381 | ;; project's README. |
1379 | (with-eval-after-load 'isearch-mb | 1382 | (:load-after consult anzu) |
1383 | (:when-loaded | ||
1380 | (dolist (spec '((isearch-mb--with-buffer | 1384 | (dolist (spec '((isearch-mb--with-buffer |
1381 | ("M-e" . consult-isearch) | 1385 | ("M-e" . consult-isearch) |
1382 | ("C-o" . loccur-isearch)) | 1386 | ("C-o" . loccur-isearch)) |
@@ -1444,21 +1448,36 @@ See also `crux-reopen-as-root-mode'." | |||
1444 | 1448 | ||
1445 | (setup (:straight link-hint) | 1449 | (setup (:straight link-hint) |
1446 | (:require +link-hint) | 1450 | (:require +link-hint) |
1447 | (+link-hint-setup-open-secondary) | 1451 | (+link-hint-open-secondary-setup) |
1448 | (:option link-hint-avy-style 'at-full) | 1452 | (:option link-hint-avy-style 'at-full) |
1449 | (:+key "M-l" +link-hint-map) | 1453 | (:+key "M-l" +link-hint-map) |
1450 | (:with-map +link-hint-map | 1454 | (:with-map +link-hint-map |
1451 | (:bind "M-l" #'+link-hint-open-link "l" #'+link-hint-open-link | 1455 | (:bind "M-l" #'+link-hint-open-link "l" #'+link-hint-open-link |
1452 | "M-m" #'link-hint-open-multiple-links | 1456 | "M-o" #'+link-hint-open-secondary "o" #'+link-hint-open-secondary |
1453 | "m" #'link-hint-open-multiple-links | 1457 | "M-m" #'link-hint-open-multiple-links "m" #'link-hint-open-multiple-links |
1454 | "M-c" #'link-hint-copy-link "c" #'link-hint-copy-link))) | 1458 | "M-c" #'link-hint-copy-link "c" #'link-hint-copy-link))) |
1455 | 1459 | ||
1456 | (setup (:straight (machine | 1460 | (setup (:straight (machine |
1457 | :host github :repo "duckwork/machine.el")) | 1461 | :host github :repo "duckwork/machine.el")) |
1458 | (:option machine-default-font "DejaVu Sans Mono" | ||
1459 | machine-variable-pitch-font "DejaVu Sans") | ||
1460 | (+with-ensure-after-init ; So that they override anything here. | 1462 | (+with-ensure-after-init ; So that they override anything here. |
1461 | (machine-settings-load))) | 1463 | ;; Emoji fonts |
1464 | (let ((ffl (font-family-list)) | ||
1465 | (emoji-fonts '("Noto Color Emoji" | ||
1466 | "Noto Emoji" | ||
1467 | "Segoe UI Emoji" | ||
1468 | "Apple Color Emoji" | ||
1469 | "FreeSans" | ||
1470 | "FreeMono" | ||
1471 | "FreeSerif" | ||
1472 | "Unifont" | ||
1473 | "Symbola")) | ||
1474 | found) | ||
1475 | (dolist (font emoji-fonts) | ||
1476 | (when (member font ffl) | ||
1477 | (push font found) | ||
1478 | (set-fontset-font t 'symbol (font-spec :family font) nil :append))) | ||
1479 | (nreverse found)) | ||
1480 | (machine-settings-load))) | ||
1462 | 1481 | ||
1463 | (setup (:straight macrostep) | 1482 | (setup (:straight macrostep) |
1464 | (:require macrostep) | 1483 | (:require macrostep) |
@@ -1485,7 +1504,11 @@ See also `crux-reopen-as-root-mode'." | |||
1485 | (setup (:straight mastodon) | 1504 | (setup (:straight mastodon) |
1486 | (:option mastodon-instance-url "https://tiny.tilde.website" | 1505 | (:option mastodon-instance-url "https://tiny.tilde.website" |
1487 | mastodon-client--token-file (.etc "mastodon.plstore") | 1506 | mastodon-client--token-file (.etc "mastodon.plstore") |
1488 | mastodon-auth-source-file (car auth-sources) | 1507 | mastodon-auth-source-file (seq-some (lambda (i) |
1508 | (when (and (stringp i) | ||
1509 | (file-exists-p i)) | ||
1510 | i)) | ||
1511 | auth-sources) | ||
1489 | mastodon-tl--enable-proportional-fonts t | 1512 | mastodon-tl--enable-proportional-fonts t |
1490 | mastodon-tl--show-avatars t) | 1513 | mastodon-tl--show-avatars t) |
1491 | (:hook #'mastodon-async-mode | 1514 | (:hook #'mastodon-async-mode |
@@ -1508,6 +1531,7 @@ See also `crux-reopen-as-root-mode'." | |||
1508 | :host github :repo "purcell/mode-line-bell" | 1531 | :host github :repo "purcell/mode-line-bell" |
1509 | :fork (:host github :repo "duckwork/mode-line-bell" | 1532 | :fork (:host github :repo "duckwork/mode-line-bell" |
1510 | :branch "remap-face"))) | 1533 | :branch "remap-face"))) |
1534 | ;; This is still, annoyingly, not quite working right. | ||
1511 | (:face mode-line-bell ((t (:inherit mode-line-highlight)))) | 1535 | (:face mode-line-bell ((t (:inherit mode-line-highlight)))) |
1512 | (:option mode-line-bell-flash-time 0.1) | 1536 | (:option mode-line-bell-flash-time 0.1) |
1513 | (mode-line-bell-mode +1)) | 1537 | (mode-line-bell-mode +1)) |
@@ -1536,7 +1560,8 @@ See also `crux-reopen-as-root-mode'." | |||
1536 | (:require +mwim) | 1560 | (:require +mwim) |
1537 | (:option +mwim-passthrough-modes '(comint-mode | 1561 | (:option +mwim-passthrough-modes '(comint-mode |
1538 | eshell-mode | 1562 | eshell-mode |
1539 | vterm-mode)) | 1563 | vterm-mode |
1564 | crossword-mode)) | ||
1540 | (:+key "C-a" #'+mwim-beginning-maybe | 1565 | (:+key "C-a" #'+mwim-beginning-maybe |
1541 | "C-e" #'+mwim-end-maybe)) | 1566 | "C-e" #'+mwim-end-maybe)) |
1542 | 1567 | ||
@@ -1626,6 +1651,19 @@ See also `crux-reopen-as-root-mode'." | |||
1626 | :repo "duckwork/plancat.el")) | 1651 | :repo "duckwork/plancat.el")) |
1627 | (:option plancat-user "acdw")) | 1652 | (:option plancat-user "acdw")) |
1628 | 1653 | ||
1654 | (setup (:straight pocket-reader) | ||
1655 | (:option pocket-reader-open-url-default-function #'browse-url) | ||
1656 | (dolist (mode '((eww-mode-map . eww) | ||
1657 | (w3m-mode-map . w3m) | ||
1658 | (elfeed-search-mode-map . elfeed-search) | ||
1659 | (elfeed-show-mode-map . elfeed-show))) | ||
1660 | (with-eval-after-load (cdr mode) | ||
1661 | (define-key (symbol-value (car mode)) "\"" #'pocket-reader-add-link)) | ||
1662 | (with-eval-after-load '+link-hint | ||
1663 | (+link-hint-pocket-add-setup) | ||
1664 | (define-key +link-hint-map "M-\"" #'+link-hint-pocket-add) | ||
1665 | (define-key +link-hint-map "\"" #'+link-hint-pocket-add)))) | ||
1666 | |||
1629 | (setup (:straight (shell-command+ | 1667 | (setup (:straight (shell-command+ |
1630 | :host nil | 1668 | :host nil |
1631 | :repo "https://git.sr.ht/~pkal/shell-command-plus")) | 1669 | :repo "https://git.sr.ht/~pkal/shell-command-plus")) |
@@ -1777,6 +1815,8 @@ See also `crux-reopen-as-root-mode'." | |||
1777 | undo-fu-session-compression (executable-find "gzip")) | 1815 | undo-fu-session-compression (executable-find "gzip")) |
1778 | (global-undo-fu-session-mode +1)) | 1816 | (global-undo-fu-session-mode +1)) |
1779 | 1817 | ||
1818 | (setup (:straight unfill)) | ||
1819 | |||
1780 | ;; (setup (:straight valign) | 1820 | ;; (setup (:straight valign) |
1781 | ;; (:option valign-fancy-bar t) | 1821 | ;; (:option valign-fancy-bar t) |
1782 | ;; (:hook-into org-mode | 1822 | ;; (:hook-into org-mode |
@@ -1803,39 +1843,15 @@ See also `crux-reopen-as-root-mode'." | |||
1803 | vertico-quick) | 1843 | vertico-quick) |
1804 | (vertico-mouse-mode +1) | 1844 | (vertico-mouse-mode +1) |
1805 | (vertico-multiform-mode +1) | 1845 | (vertico-multiform-mode +1) |
1806 | (:option vertico-multiform-commands '((execute-extended-command flat) | 1846 | ;; I `setf' these so they don't override the other setfs elsewhere in init.el. |
1807 | (helpful-function) | 1847 | (setf (alist-get 'execute-extended-command vertico-multiform-commands) '(flat)) |
1808 | (helpful-macro) | 1848 | (setf (alist-get 'completion-at-point vertico-multiform-commands) '(flat)) |
1809 | (helpful-callable) | 1849 | (setf (alist-get 'indent-for-tab-command vertico-multiform-commands) '(flat)) |
1810 | (helpful-variable) | 1850 | (setf (alist-get 'insert-char vertico-multiform-commands) nil) |
1811 | (describe-symbol) | 1851 | (setf (alist-get 'file vertico-multiform-categories) '(buffer)) |
1812 | (completion-at-point flat) | 1852 | (setf (alist-get 'bookmark vertico-multiform-categories) nil) |
1813 | (indent-for-tab-command flat) | 1853 | ;; Default. Needs to be `add-to-list' so that it appears at the end. |
1814 | (consult-buffer flat) | 1854 | (add-to-list 'vertico-multiform-categories '(t flat) :append) |
1815 | (insert-char) | ||
1816 | (flyspell-correct-wrapper) | ||
1817 | (+flyspell-correct-buffer) | ||
1818 | (flyspell-correct-move)) | ||
1819 | ;; This is applied /after/ the above, so default is at the end of | ||
1820 | ;; this alist. | ||
1821 | vertico-multiform-categories '((file buffer grid) | ||
1822 | (bookmark) | ||
1823 | (flyspell) | ||
1824 | (t flat))) | ||
1825 | (dolist (buf-cmd '(consult-find | ||
1826 | consult-yank-pop | ||
1827 | consult-locate | ||
1828 | consult-grep | ||
1829 | consult-git-grep | ||
1830 | consult-ripgrep | ||
1831 | consult-line | ||
1832 | consult-line-multi | ||
1833 | consult-multi-occur | ||
1834 | consult-keep-lines | ||
1835 | consult-focus-lines | ||
1836 | consult-imenu | ||
1837 | consult-outline)) | ||
1838 | (setf (alist-get buf-cmd vertico-multiform-commands) '(buffer))) | ||
1839 | (:with-map vertico-map | 1855 | (:with-map vertico-map |
1840 | (:bind "RET" #'vertico-directory-enter | 1856 | (:bind "RET" #'vertico-directory-enter |
1841 | "DEL" #'vertico-directory-delete-char | 1857 | "DEL" #'vertico-directory-delete-char |
@@ -1894,6 +1910,10 @@ See also `crux-reopen-as-root-mode'." | |||
1894 | (:hook-into org-mode | 1910 | (:hook-into org-mode |
1895 | latex-mode)) | 1911 | latex-mode)) |
1896 | 1912 | ||
1913 | (setup (:straight xkcd) | ||
1914 | (:also-load +xkcd) | ||
1915 | (:hook #'visual-fill-column-mode)) | ||
1916 | |||
1897 | (setup (:straight yasnippet) | 1917 | (setup (:straight yasnippet) |
1898 | (:option yas-snippet-dirs (list | 1918 | (:option yas-snippet-dirs (list |
1899 | (expand-file-name "snippets" user-emacs-directory) | 1919 | (expand-file-name "snippets" user-emacs-directory) |
diff --git a/lisp/+xkcd.el b/lisp/+xkcd.el new file mode 100644 index 0000000..6780b90 --- /dev/null +++ b/lisp/+xkcd.el | |||
@@ -0,0 +1,16 @@ | |||
1 | ;;; +xkcd.el -*- lexical-binding: t; -*- | ||
2 | |||
3 | ;;; Commentary: | ||
4 | |||
5 | ;;; Code: | ||
6 | |||
7 | (require 'xkcd) | ||
8 | |||
9 | (defun +xkcd-get-from-url (url &rest _) | ||
10 | "Open XKCD from URL." | ||
11 | (if (string-match "xkcd\\.com/\\([0-9]+\\)" url) | ||
12 | (xkcd-get (string-to-number (match-string 1 url))) | ||
13 | (funcall +browse-url-browser-function url))) | ||
14 | |||
15 | (provide '+xkcd) | ||
16 | ;;; +xkcd.el ends here | ||