summary refs log tree commit diff stats
path: root/init.el
diff options
context:
space:
mode:
Diffstat (limited to 'init.el')
-rw-r--r--init.el157
1 files changed, 100 insertions, 57 deletions
diff --git a/init.el b/init.el index 5e52215..e032819 100644 --- a/init.el +++ b/init.el
@@ -117,12 +117,18 @@
117 (add-hook 'user-save-hook #'+clean-empty-lines) 117 (add-hook 'user-save-hook #'+clean-empty-lines)
118 (user-save-global-mode +1)) 118 (user-save-global-mode +1))
119 119
120(setup (:require winner)
121 (winner-mode +1))
122
120(setup +key 123(setup +key
121 (+ensure-after-init #'+key-global-mode)) 124 (+ensure-after-init #'+key-global-mode))
122 125
123(setup abbrev 126(setup abbrev
124 (:option abbrev-file-name (sync/ "abbrev.el") 127 (:option abbrev-file-name (sync/ "abbrev.el")
125 save-abbrevs 'silent) 128 save-abbrevs 'silent)
129(with-eval-after-load 'user-save
130 (:with-mode edit-abbrevs-mode
131 (:hook #'turn-off-user-save-mode)))
126 (:hook-into text-mode 132 (:hook-into text-mode
127 circe-chat-mode)) 133 circe-chat-mode))
128 134
@@ -177,42 +183,41 @@
177 (add-to-list '+browse-url-secondary-browser-regexps 183 (add-to-list '+browse-url-secondary-browser-regexps
178 (replace-regexp-in-string "\\." "\\\\." domain))) 184 (replace-regexp-in-string "\\." "\\\\." domain)))
179 ;; Set up URL handlers. 185 ;; Set up URL handlers.
180 (with-eval-after-load 'org-contacts 186 (require 'chd)
181 (require 'chd) 187 (+browse-url-set-handlers
182 (+browse-url-set-handlers 188 (list
183 (list 189 (cons (rx ; images
184 (cons (rx ; images 190 "." (or "jpeg" "jpg" "png" "bmp") eos)
185 "." (or "jpeg" "jpg" "png" "bmp") eos) 191 (lambda (&rest args)
186 (lambda (&rest args) 192 (apply
187 (apply 193 (cond ((executable-find "mpv") #'+browse-image-with-mpv)
188 (cond ((executable-find "mpv") #'+browse-image-with-mpv) 194 (t #'eww-browse-url))
189 (t #'eww-browse-url)) 195 args)))
190 args))) 196 (cons (rx (or ;; videos
191 (cons (rx (or ;; videos 197 "youtube.com" "youtu.be" "invidious" "yewtu.be"
192 "youtube.com" "youtu.be" "invidious" "yewtu.be" 198 (seq "." (or "mp4" "gif" "mov" "MOV" "webm") eos)
193 (seq "." (or "mp4" "gif" "mov" "MOV" "webm") eos) 199 ;; music
194 ;; music 200 "soundcloud.com" "bandcamp.com"
195 "soundcloud.com" "bandcamp.com" 201 (seq "." (or "ogg" "mp3" "opus" "m4a") eos)))
196 (seq "." (or "ogg" "mp3" "opus" "m4a") eos))) 202 (lambda (&rest args)
197 (lambda (&rest args) 203 (apply (if (executable-find "mpv")
198 (apply (if (executable-find "mpv") 204 #'+browse-url-with-mpv
199 #'+browse-url-with-mpv 205 browse-url-secondary-browser-function)
200 browse-url-secondary-browser-function) 206 args)))
201 args))) 207 (cons chd/url-regexps #'browse-url-chrome)
202 (cons chd/url-regexps #'browse-url-chrome) 208 (cons (+browse-url-secondary-browser-regexps-combine) ; non-text websites
203 (cons (+browse-url-secondary-browser-regexps-combine) ; non-text websites 209 (lambda (&rest args)
204 (lambda (&rest args) 210 (apply browse-url-secondary-browser-function args)))
205 (apply browse-url-secondary-browser-function args))) 211 (cons "xkcd\\.com"
206 (cons "xkcd\\.com" 212 (lambda (&rest args)
207 (lambda (&rest args) 213 (apply (if (fboundp #'xkcd-get)
208 (apply (if (fboundp #'xkcd-get) 214 (progn (require '+xkcd)
209 (progn (require '+xkcd) 215 #'+xkcd-get-from-url)
210 #'+xkcd-get-from-url) 216 +browse-url-browser-function)
211 +browse-url-browser-function) 217 args)))
212 args))) 218 (cons "." ; everything else
213 (cons "." ; everything else 219 (lambda (&rest args)
214 (lambda (&rest args) 220 (apply +browse-url-browser-function args)))))
215 (apply +browse-url-browser-function args))))))
216 ;; Transform URLs before passing to `browse-url' 221 ;; Transform URLs before passing to `browse-url'
217 (:option +browse-url-transformations `((,(rx (or "youtube.com" 222 (:option +browse-url-transformations `((,(rx (or "youtube.com"
218 "youtu.be")) 223 "youtu.be"))
@@ -472,7 +477,8 @@
472 (:option notmuch-init-file (notmuch/ "notmuch-init.el" t) 477 (:option notmuch-init-file (notmuch/ "notmuch-init.el" t)
473 notmuch-address-save-filename (notmuch/ "addresses" t) 478 notmuch-address-save-filename (notmuch/ "addresses" t)
474 notmuch-address-use-company (featurep 'company) 479 notmuch-address-use-company (featurep 'company)
475 notmuch-search-oldest-first nil) 480 notmuch-search-oldest-first nil
481 notmuch-archive-tags '("-inbox" "-unread"))
476 ;; Composing mail 482 ;; Composing mail
477 (:option message-kill-buffer-on-exit t 483 (:option message-kill-buffer-on-exit t
478 message-auto-save-directory "~/var/mail/drafts") 484 message-auto-save-directory "~/var/mail/drafts")
@@ -554,6 +560,9 @@
554 ("+" . "-")) 560 ("+" . "-"))
555 org-log-done 'time 561 org-log-done 'time
556 org-log-into-drawer t 562 org-log-into-drawer t
563 org-num-skip-commented t
564 org-num-skip-unnumbered t
565 org-num-skip-footnotes t
557 org-outline-path-complete-in-steps nil 566 org-outline-path-complete-in-steps nil
558 org-pretty-entities t 567 org-pretty-entities t
559 org-pretty-entities-include-sub-superscripts nil 568 org-pretty-entities-include-sub-superscripts nil
@@ -573,6 +582,7 @@
573 (sequence "|" "CANCELED(k@)") 582 (sequence "|" "CANCELED(k@)")
574 (sequence "MEETING(m)") 583 (sequence "MEETING(m)")
575 (sequence "ASSIGNED(a@/!)" "REVIEW(r)" "|" "DONE(d!)")) 584 (sequence "ASSIGNED(a@/!)" "REVIEW(r)" "|" "DONE(d!)"))
585 org-use-speed-commands t
576 org-emphasis-alist '(("*" org-bold) 586 org-emphasis-alist '(("*" org-bold)
577 ("/" org-italic) 587 ("/" org-italic)
578 ("_" org-underline) 588 ("_" org-underline)
@@ -612,9 +622,9 @@
612 ;; complains about "Invalid face reference: t" in org-mode buffers, because 622 ;; complains about "Invalid face reference: t" in org-mode buffers, because
613 ;; `compose-region' returns t. 623 ;; `compose-region' returns t.
614 ("^ *\\([-]\\) " 624 ("^ *\\([-]\\) "
615 (0 (progn (compose-region (match-beginning 1) (match-end 1) "โˆ™") 'default))) 625 (0 (progn (compose-region (match-beginning 1) (match-end 1) "โ€บ") 'default)))
616 ("^ *\\([+]\\) " 626 ("^ *\\([+]\\) "
617 (0 (progn (compose-region (match-beginning 1) (match-end 1) "โ—ฆ") 'default))))) 627 (0 (progn (compose-region (match-beginning 1) (match-end 1) "ยป") 'default)))))
618 (with-eval-after-load 'form-feed 628 (with-eval-after-load 'form-feed
619 ;; Horizontal lines 629 ;; Horizontal lines
620 (font-lock-add-keywords 630 (font-lock-add-keywords
@@ -715,6 +725,13 @@
715 (with-eval-after-load 'user-save 725 (with-eval-after-load 'user-save
716 (advice-add 'org-export-dispatch :before 'user-save-run-hooks))) 726 (advice-add 'org-export-dispatch :before 'user-save-run-hooks)))
717 727
728(setup org-id
729 (:load-after org)
730 ;; https://helpdeskheadesk.net/2022-03-13/
731 (:option org-id-method 'ts
732 org-attach-id-to-path-function-list '(org-attach-id-ts-folder-format
733 org-attach-id-uuid-folder-format)))
734
718(setup password-cache 735(setup password-cache
719 (:option password-cache t 736 (:option password-cache t
720 password-cache-expiry (* 60 60))) 737 password-cache-expiry (* 60 60)))
@@ -746,8 +763,9 @@
746 tab-bar-tab-name-ellipsis truncate-string-ellipsis 763 tab-bar-tab-name-ellipsis truncate-string-ellipsis
747 tab-bar-show t 764 tab-bar-show t
748 tab-bar-close-button-show t 765 tab-bar-close-button-show t
749 +tab-bar-menu-bar-icon " โ˜ฐ " 766 tab-bar-new-button-show nil
750 tab-bar-close-button (propertize " ยฌ " 767 +tab-bar-menu-bar-icon " ; "
768 tab-bar-close-button (propertize "(x)"
751 'display t 769 'display t
752 'close-tab t) 770 'close-tab t)
753 tab-bar-new-button (propertize "+ " 'display t)) 771 tab-bar-new-button (propertize "+ " 'display t))
@@ -755,7 +773,7 @@
755 (:option display-time-format "%H:%M" 773 (:option display-time-format "%H:%M"
756 display-time-mail-file :disable 774 display-time-mail-file :disable
757 display-time-load-average-threshold 50) 775 display-time-load-average-threshold 50)
758 (:option tab-bar-format '(+tab-bar-format-menu-bar 776 (:option tab-bar-format '(;;+tab-bar-format-menu-bar
759 tab-bar-format-history 777 tab-bar-format-history
760 tab-bar-format-tabs 778 tab-bar-format-tabs
761 tab-bar-separator 779 tab-bar-separator
@@ -821,7 +839,7 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers."
821 (setq affe-regexp-compiler (defun affe-orderless-regexp-compiler (input _type) 839 (setq affe-regexp-compiler (defun affe-orderless-regexp-compiler (input _type)
822 (setq input (orderless-pattern-compiler input)) 840 (setq input (orderless-pattern-compiler input))
823 (cons input (lambda (str) (orderless--highlight input str))))) 841 (cons input (lambda (str) (orderless--highlight input str)))))
824 (with-eval-after-load 'affe 842 (+with-eval-after-loads (affe vertico-multiform)
825 (setf (alist-get 'affe-grep vertico-multiform-commands) '(buffer) 843 (setf (alist-get 'affe-grep vertico-multiform-commands) '(buffer)
826 (alist-get 'affe-find vertico-multiform-commands) '(buffer)) 844 (alist-get 'affe-find vertico-multiform-commands) '(buffer))
827 (:+key "M-s g" #'affe-grep 845 (:+key "M-s g" #'affe-grep
@@ -926,7 +944,7 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers."
926 '(cape-file 944 '(cape-file
927 cape-dabbrev 945 cape-dabbrev
928 cape-keyword 946 cape-keyword
929 cape-abbrev 947 ;;cape-abbrev
930 cape-ispell 948 cape-ispell
931 ;;cape-dict 949 ;;cape-dict
932 )) 950 ))
@@ -1100,6 +1118,11 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers."
1100 1118
1101 (:with-mode tracking-mode 1119 (:with-mode tracking-mode
1102 (:option tracking-position 'before-modes) 1120 (:option tracking-position 'before-modes)
1121 (:bind "C-c C-SPC" (lambda () (interactive)
1122 (if (and (fboundp 'org-clocking-p)
1123 (org-clocking-p))
1124 (message "Bro, get back to work!")
1125 (call-interactively #'tracking-next-buffer))))
1103 (add-to-list 'mode-line-misc-info 1126 (add-to-list 'mode-line-misc-info
1104 '(tracking-mode 1127 '(tracking-mode
1105 tracking-mode-line-buffers))) 1128 tracking-mode-line-buffers)))
@@ -1122,7 +1145,7 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers."
1122(setup (:straight clhs)) 1145(setup (:straight clhs))
1123 1146
1124(setup (:straight consult) 1147(setup (:straight consult)
1125 (:also-load +consult) 1148 (:require consult +consult)
1126 ;; from Consult wiki 1149 ;; from Consult wiki
1127 (:option register-preview-delay 0 1150 (:option register-preview-delay 0
1128 register-preview-function #'consult-register-format 1151 register-preview-function #'consult-register-format
@@ -1352,7 +1375,8 @@ See also `crux-reopen-as-root-mode'."
1352 (:with-mode elfeed-search-mode 1375 (:with-mode elfeed-search-mode
1353 (:bind "&" #'+elfeed-search-browse-generic 1376 (:bind "&" #'+elfeed-search-browse-generic
1354 "w" #'elfeed-search-yank 1377 "w" #'elfeed-search-yank
1355 "y" nil) 1378 "y" nil
1379 "a" #'+elfeed-show-mark-read-and-advance)
1356 (:hook #'hl-line-mode) 1380 (:hook #'hl-line-mode)
1357 ;; https://old.reddit.com/r/emacs/comments/rlli0u/whats_your_favorite_defadvice/hphfh4e/ 1381 ;; https://old.reddit.com/r/emacs/comments/rlli0u/whats_your_favorite_defadvice/hphfh4e/
1358 (advice-add #'elfeed-search-update--force :after #'elfeed-db-save) 1382 (advice-add #'elfeed-search-update--force :after #'elfeed-db-save)
@@ -1367,7 +1391,8 @@ See also `crux-reopen-as-root-mode'."
1367 (:hook #'reading-mode) 1391 (:hook #'reading-mode)
1368 (:option +elfeed--update-repeat (* 60 30) ; 1/2 hour 1392 (:option +elfeed--update-repeat (* 60 30) ; 1/2 hour
1369 +elfeed--update-first-time 60)) 1393 +elfeed--update-first-time 60))
1370 (+elfeed-update-async-mode +1)) 1394 (+elfeed-update-async-mode -1) ; It really messes with stuff for work
1395 )
1371 1396
1372(setup (:straight elfeed-org) 1397(setup (:straight elfeed-org)
1373 (:also-load +org-capture) 1398 (:also-load +org-capture)
@@ -1735,9 +1760,9 @@ See also `crux-reopen-as-root-mode'."
1735 (require 'modus-themes (.etc "straight/build/modus-themes/modus-themes")) 1760 (require 'modus-themes (.etc "straight/build/modus-themes/modus-themes"))
1736 (:also-load dawn) 1761 (:also-load dawn)
1737 (:option modus-themes-mixed-fonts t 1762 (:option modus-themes-mixed-fonts t
1738 modus-themes-bold-constructs t 1763 modus-themes-bold-constructs nil
1739 modus-themes-italic-constructs t 1764 modus-themes-italic-constructs t
1740 modus-themes-headings '((t . (background)))) 1765 modus-themes-headings '((t . (background regular rainbow))))
1741 (dotimes (facen-1 8) 1766 (dotimes (facen-1 8)
1742 (let ((facen (1+ facen-1))) 1767 (let ((facen (1+ facen-1)))
1743 (custom-set-faces 1768 (custom-set-faces
@@ -1746,6 +1771,8 @@ See also `crux-reopen-as-root-mode'."
1746 (,(intern (format "modus-themes-heading-%s" facen)) 1771 (,(intern (format "modus-themes-heading-%s" facen))
1747 fixed-pitch)) 1772 fixed-pitch))
1748 :now))))) 1773 :now)))))
1774 (:face modus-themes-tab-active ((t :bold nil))
1775 modus-themes-tab-inactive ((t :italic t)))
1749 (dawn-schedule #'modus-themes-load-operandi 1776 (dawn-schedule #'modus-themes-load-operandi
1750 #'modus-themes-load-vivendi)) 1777 #'modus-themes-load-vivendi))
1751 1778
@@ -1862,6 +1889,9 @@ See also `crux-reopen-as-root-mode'."
1862 lisp-interaction-mode 1889 lisp-interaction-mode
1863 scheme-mode)) 1890 scheme-mode))
1864 1891
1892(setup (:straight pdf-tools)
1893 (pdf-tools-install))
1894
1865;; (setup (:straight-when pdf-tools 1895;; (setup (:straight-when pdf-tools
1866;; ;; Ensure we can build `pdf-tools' 1896;; ;; Ensure we can build `pdf-tools'
1867;; (or (executable-find "gcc") 1897;; (or (executable-find "gcc")
@@ -1905,11 +1935,17 @@ See also `crux-reopen-as-root-mode'."
1905 :host github :repo "gexplorer/simple-modeline" 1935 :host github :repo "gexplorer/simple-modeline"
1906 :fork (:host github :repo "duckwork/simple-modeline"))) 1936 :fork (:host github :repo "duckwork/simple-modeline")))
1907 (:require +modeline) 1937 (:require +modeline)
1908 (:option +modeline-modified-icon-alist '((ephemeral . "๐Ÿฅž") 1938 (:option +modeline-modified-icon-alist '((ephemeral . "~")
1909 (special . "๐Ÿฅ") 1939 (special . "*")
1910 (readonly . "๐Ÿฆž") 1940 (readonly . "=")
1911 (modified . "๐Ÿฅช") 1941 (modified . "+")
1912 (t . "๐Ÿž")) 1942 (t . "-"))
1943 ;; '((ephemeral . "๐Ÿฅž")
1944 ;; (special . "๐Ÿฅ")
1945 ;; (readonly . "๐Ÿฆž")
1946 ;; (modified . "๐Ÿฅช")
1947 ;; (t . "๐Ÿž"))
1948
1913 +modeline-minions-icon ";" 1949 +modeline-minions-icon ";"
1914 simple-modeline-segments 1950 simple-modeline-segments
1915 `(( ; left 1951 `(( ; left
@@ -1950,10 +1986,14 @@ See also `crux-reopen-as-root-mode'."
1950 slack-buffer-emojify t 1986 slack-buffer-emojify t
1951 slack-buffer-create-on-notify t 1987 slack-buffer-create-on-notify t
1952 slack-enable-wysiwyg t 1988 slack-enable-wysiwyg t
1953 slack-file-dir "~/var/download/" 1989 slack-file-dir (xdg-user-dir "DOWNLOAD")
1954 slack-display-team-name nil) 1990 slack-display-team-name nil)
1955 (with-eval-after-load '+slack 1991 (with-eval-after-load '+slack
1956 (+slack-register-teams))) 1992 (+slack-register-teams))
1993 (with-eval-after-load 'alert
1994 ;; Don't notify for Slack messages
1995 (alert-add-rule :category "slack"
1996 :style 'ignore)))
1957 1997
1958(setup (:straight-when sly 1998(setup (:straight-when sly
1959 (defvar +lisp-bin (executable-find "sbcl"))) 1999 (defvar +lisp-bin (executable-find "sbcl")))
@@ -2055,6 +2095,9 @@ See also `crux-reopen-as-root-mode'."
2055 2095
2056(setup (:straight unfill)) 2096(setup (:straight unfill))
2057 2097
2098(setup (:straight valign)
2099 (:hook-into org-mode))
2100
2058(setup (:straight valign) (:quit "Doesn't work with narrowed tables.") 2101(setup (:straight valign) (:quit "Doesn't work with narrowed tables.")
2059 (:option valign-fancy-bar t) 2102 (:option valign-fancy-bar t)
2060 (:hook-into org-mode 2103 (:hook-into org-mode
@@ -2065,7 +2108,7 @@ See also `crux-reopen-as-root-mode'."
2065 :repo "minad/vertico" 2108 :repo "minad/vertico"
2066 :files ("*" "extensions/*" 2109 :files ("*" "extensions/*"
2067 (:exclude ".git")))) 2110 (:exclude ".git"))))
2068 (:also-load +vertico) 2111 (:require vertico +vertico)
2069 (:option resize-mini-windows 'grow-only 2112 (:option resize-mini-windows 'grow-only
2070 vertico-count-format nil 2113 vertico-count-format nil
2071 vertico-cycle t) 2114 vertico-cycle t)