summary refs log tree commit diff stats
path: root/init.el
diff options
context:
space:
mode:
authorCase Duckworth2022-02-18 18:25:27 -0600
committerCase Duckworth2022-02-18 18:25:27 -0600
commit5b35d5c91beed4ff568256807d0d3c8d10247068 (patch)
treeb3e1633f283bf1eeec1a373c695949cdbb5d14ae /init.el
parentAdd diff-hl (diff)
downloademacs-5b35d5c91beed4ff568256807d0d3c8d10247068.tar.gz
emacs-5b35d5c91beed4ff568256807d0d3c8d10247068.zip
Changes
Diffstat (limited to 'init.el')
-rw-r--r--init.el202
1 files changed, 100 insertions, 102 deletions
diff --git a/init.el b/init.el index 5c0c13a..8d17de2 100644 --- a/init.el +++ b/init.el
@@ -93,19 +93,6 @@
93 (:with-mode Custom-mode 93 (:with-mode Custom-mode
94 (:local-set imenu-generic-expression +cus-edit-imenu-generic-expression))) 94 (:local-set imenu-generic-expression +cus-edit-imenu-generic-expression)))
95 95
96(setup (:require ecomplete)
97 (:also-load +ecomplete)
98 (:option message-mail-alias-type 'ecomplete
99 message-self-insert-commands nil
100 message-expand-name-standard-ui t)
101 (with-eval-after-load 'ecomplete
102 (:option completion-category-defaults nil)
103 (with-eval-after-load 'embark
104 (:bind-into embark-email-map
105 "+" #'+ecomplete-add-email
106 "\\" #'+ecomplete-remove-email)))
107 (add-hook 'message-sent-hook #'message-put-addresses-in-ecomplete))
108
109(setup (:require goto-addr) 96(setup (:require goto-addr)
110 (if (fboundp #'global-goto-address-mode) 97 (if (fboundp #'global-goto-address-mode)
111 (global-goto-address-mode) 98 (global-goto-address-mode)
@@ -189,41 +176,42 @@
189 (add-to-list '+browse-url-secondary-browser-regexps 176 (add-to-list '+browse-url-secondary-browser-regexps
190 (replace-regexp-in-string "\\." "\\\\." domain))) 177 (replace-regexp-in-string "\\." "\\\\." domain)))
191 ;; Set up URL handlers. 178 ;; Set up URL handlers.
192 (require 'chd) 179 (with-eval-after-load 'org-contacts
193 (+browse-url-set-handlers 180 (require 'chd)
194 (list 181 (+browse-url-set-handlers
195 (cons (rx ; images 182 (list
196 "." (or "jpeg" "jpg" "png" "bmp") eos) 183 (cons (rx ; images
197 (lambda (&rest args) 184 "." (or "jpeg" "jpg" "png" "bmp") eos)
198 (apply 185 (lambda (&rest args)
199 (cond ((executable-find "mpv") #'+browse-image-with-mpv) 186 (apply
200 (t #'eww-browse-url)) 187 (cond ((executable-find "mpv") #'+browse-image-with-mpv)
201 args))) 188 (t #'eww-browse-url))
202 (cons (rx (or ;; videos 189 args)))
203 "youtube.com" "youtu.be" "invidious" "yewtu.be" 190 (cons (rx (or ;; videos
204 (seq "." (or "mp4" "gif" "mov" "MOV" "webm") eos) 191 "youtube.com" "youtu.be" "invidious" "yewtu.be"
205 ;; music 192 (seq "." (or "mp4" "gif" "mov" "MOV" "webm") eos)
206 "soundcloud.com" "bandcamp.com" 193 ;; music
207 (seq "." (or "ogg" "mp3" "opus" "m4a") eos))) 194 "soundcloud.com" "bandcamp.com"
208 (lambda (&rest args) 195 (seq "." (or "ogg" "mp3" "opus" "m4a") eos)))
209 (apply (if (executable-find "mpv") 196 (lambda (&rest args)
210 #'+browse-url-with-mpv 197 (apply (if (executable-find "mpv")
211 browse-url-secondary-browser-function) 198 #'+browse-url-with-mpv
212 args))) 199 browse-url-secondary-browser-function)
213 (cons chd/url-regexps #'browse-url-chrome) 200 args)))
214 (cons (+browse-url-secondary-browser-regexps-combine) ; non-text websites 201 (cons chd/url-regexps #'browse-url-chrome)
215 (lambda (&rest args) 202 (cons (+browse-url-secondary-browser-regexps-combine) ; non-text websites
216 (apply browse-url-secondary-browser-function args))) 203 (lambda (&rest args)
217 (cons "xkcd\\.com" 204 (apply browse-url-secondary-browser-function args)))
218 (lambda (&rest args) 205 (cons "xkcd\\.com"
219 (apply (if (fboundp #'xkcd-get) 206 (lambda (&rest args)
220 (progn (require '+xkcd) 207 (apply (if (fboundp #'xkcd-get)
221 #'+xkcd-get-from-url) 208 (progn (require '+xkcd)
222 +browse-url-browser-function) 209 #'+xkcd-get-from-url)
223 args))) 210 +browse-url-browser-function)
224 (cons "." ; everything else 211 args)))
225 (lambda (&rest args) 212 (cons "." ; everything else
226 (apply +browse-url-browser-function args))))) 213 (lambda (&rest args)
214 (apply +browse-url-browser-function args))))))
227 ;; Transform URLs before passing to `browse-url' 215 ;; Transform URLs before passing to `browse-url'
228 (:option +browse-url-transformations `((,(rx (or "youtube.com" 216 (:option +browse-url-transformations `((,(rx (or "youtube.com"
229 "youtu.be")) 217 "youtu.be"))
@@ -236,15 +224,14 @@
236 "old.reddit.com")) 224 "old.reddit.com"))
237 . "teddit.net") 225 . "teddit.net")
238 ("medium\\.com" 226 ("medium\\.com"
239 . "scribe.rip"))) 227 . "scribe.rip")
228 ("www\\.npr\\.org"
229 . "text.npr.org")))
240 (+browse-url-transform-url-global-mode +1)) 230 (+browse-url-transform-url-global-mode +1))
241 231
242(setup calendar 232(setup calendar
243 (require '_location) 233 (require '_location)
244 (:option calendar-location-name _location-name 234 (:option diary-file (private/ "diary")))
245 calendar-latitude _location-latitude
246 calendar-longitude _location-longitude
247 diary-file (private/ "diary")))
248 235
249(setup compile 236(setup compile
250 (:option compilation-always-kill t 237 (:option compilation-always-kill t
@@ -282,6 +269,20 @@
282 (with-eval-after-load 'frowny 269 (with-eval-after-load 'frowny
283 (add-to-list 'frowny-inhibit-modes #'dired-mode))) 270 (add-to-list 'frowny-inhibit-modes #'dired-mode)))
284 271
272(setup ecomplete (:quit)
273 (:load-after org-contacts)
274 (:also-load +ecomplete)
275 (:option message-mail-alias-type 'ecomplete
276 message-self-insert-commands nil
277 message-expand-name-standard-ui t)
278 (with-eval-after-load 'ecomplete
279 (:option completion-category-defaults nil)
280 (with-eval-after-load 'embark
281 (:bind-into embark-email-map
282 "+" #'+ecomplete-add-email
283 "\\" #'+ecomplete-remove-email)))
284 (add-hook 'message-sent-hook #'message-put-addresses-in-ecomplete))
285
285(setup ehelp 286(setup ehelp
286 ;; Trying this instead of `helpful' 287 ;; Trying this instead of `helpful'
287 (:global [help] 'ehelp-command 288 (:global [help] 'ehelp-command
@@ -462,39 +463,15 @@
462 )) 463 ))
463 464
464(setup notmuch 465(setup notmuch
465 (add-to-list 'load-path 466 (:load-from "~/usr/share/emacs/site-lisp/")
466 (car (file-expand-wildcards "/usr/share/emacs/site-lisp/elpa-src/notmuch*"))) 467 ;;(:load-after org-contacts)
467 (require 'notmuch) 468 (:also-load +notmuch)
468 (require '+notmuch) 469 (+define-dir notmuch/ (sync/ "emacs/notmuch")
469 (+define-dir notmuch/ (private/ "notmuch")
470 "Notmuch configuration and data.") 470 "Notmuch configuration and data.")
471 (:option notmuch-init-file (notmuch/ "init.el" t) 471 (:option notmuch-init-file (notmuch/ "notmuch-init.el" t)
472 notmuch-address-save-filename (notmuch/ "addresses" t) 472 notmuch-address-save-filename (notmuch/ "addresses" t)
473 notmuch-address-use-company (featurep 'company) 473 notmuch-address-use-company (featurep 'company)
474 notmuch-search-oldest-first nil 474 notmuch-search-oldest-first nil)
475 notmuch-saved-searches (list
476 (list :name "next"
477 :query (+notmuch-query-concat "tag:inbox"
478 "NOT tag:/List/")
479 :key "n")
480 (list :name "lists"
481 :query (+notmuch-query-concat "tag:/List/")
482 :key "l")
483 ;; original
484 (list :name "inbox"
485 :query (+notmuch-query-concat "tag:inbox"
486 "NOT tag:Spam")
487 :key "i")
488 (list :name "unread"
489 :query (+notmuch-query-concat "tag:unread"
490 "NOT tag:Spam")
491 :key "u")
492 (list :name "flagged" :query "tag:flagged" :key "f")
493 (list :name "sent" :query "tag:sent" :key "t")
494 (list :name "drafts" :query "tag:draft" :key "d")
495 (list :name "all mail" :query "*" :key "a")))
496 ;; I don't know why or how this isn't properly loaded, but here we are.
497 (with-eval-after-load 'notmuch (load notmuch-init-file :noerror))
498 ;; Composing mail 475 ;; Composing mail
499 (:option message-kill-buffer-on-exit t) 476 (:option message-kill-buffer-on-exit t)
500 ;; Sending mail 477 ;; Sending mail
@@ -503,12 +480,31 @@
503 message-sendmail-envelope-from 'header 480 message-sendmail-envelope-from 'header
504 mail-envelope-from 'header) 481 mail-envelope-from 'header)
505 ;; Extras and fixes 482 ;; Extras and fixes
506 ;; +send-mail-dispatch is defined in notmuch/init.el 483 (with-eval-after-load 'notmuch
507 (add-hook 'notmuch-show-mode-hook #'visual-fill-column-mode) 484 (load notmuch-init-file :noerror)
508 (add-hook 'message-send-hook #'+send-mail-dispatch) 485 ;;(add-hook 'notmuch-show-mode-hook #'visual-fill-column-mode)
509 (advice-add 'notmuch-tag :filter-args #'+notmuch-correct-tags) 486 (add-hook 'message-send-hook #'+send-mail-dispatch)
510 (:+leader "m" #'+notmuch-goto 487 (advice-add 'notmuch-tag :filter-args #'+notmuch-correct-tags)
511 "C-m" #'+notmuch-goto)) 488 (:option notmuch-saved-searches (list
489 (list :name "lists"
490 :query (+notmuch-query-concat "tag:/List/"
491 "tag:unread")
492 :key "l")
493 ;; original
494 (list :name "inbox"
495 :query (+notmuch-query-concat "tag:inbox"
496 "NOT tag:Spam")
497 :key "i")
498 (list :name "unread"
499 :query (+notmuch-query-concat "tag:unread"
500 "NOT tag:Spam")
501 :key "u")
502 (list :name "flagged" :query "tag:flagged" :key "f")
503 (list :name "sent" :query "tag:sent" :key "t")
504 (list :name "drafts" :query "tag:draft" :key "d")
505 (list :name "all mail" :query "*" :key "a"))))
506 (:+leader "m" #'+notmuch-goto "C-m" #'+notmuch-goto
507 "n" #'notmuch "C-n" #'notmuch))
512 508
513(setup org 509(setup org
514 ;; Plain org with the `setup' form for sorting, but I install with straight. 510 ;; Plain org with the `setup' form for sorting, but I install with straight.
@@ -649,7 +645,8 @@
649(setup org-attach 645(setup org-attach
650 (:also-load +org-attach) 646 (:also-load +org-attach)
651 (:option org-attach-method 'lns) 647 (:option org-attach-method 'lns)
652 (+org-attach-fix-args-mode +1)) 648 (with-eval-after-load '+org-attach
649 (+org-attach-fix-args-mode +1)))
653 650
654(setup org-capture 651(setup org-capture
655 (:require +org-capture) 652 (:require +org-capture)
@@ -698,6 +695,7 @@
698 (+org-capture-sort)) 695 (+org-capture-sort))
699 696
700(setup org-contacts 697(setup org-contacts
698 (:load-after org)
701 (:also-straight org-vcard) ; for importing Vcard files 699 (:also-straight org-vcard) ; for importing Vcard files
702 (:option org-contacts-matcher "contact") ; Contacts are tagged "contact" 700 (:option org-contacts-matcher "contact") ; Contacts are tagged "contact"
703 ) 701 )
@@ -1130,7 +1128,7 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers."
1130 ("C-M-#" . consult-register) 1128 ("C-M-#" . consult-register)
1131 ;; Other custom bindings 1129 ;; Other custom bindings
1132 ("M-y" . consult-yank-pop) 1130 ("M-y" . consult-yank-pop)
1133 ("<f1> a" . consult-apropos) 1131 ;;("<f1> a" . consult-apropos)
1134 ;; M-g bindings (goto-map) 1132 ;; M-g bindings (goto-map)
1135 ("M-g e" . consult-compile-error) 1133 ("M-g e" . consult-compile-error)
1136 ("M-g f" . consult-flymake) ; or consult-flycheck 1134 ("M-g f" . consult-flymake) ; or consult-flycheck
@@ -1163,9 +1161,9 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers."
1163 (define-key isearch-mode-map (car binding) (cdr binding)))) 1161 (define-key isearch-mode-map (car binding) (cdr binding))))
1164 (:+menu "b" #'consult-buffer 1162 (:+menu "b" #'consult-buffer
1165 "f" #'find-file) 1163 "f" #'find-file)
1166 (with-eval-after-load 'org-mode 1164 (:bind-into org
1167 (define-key org-mode-map "M-g o" 'consult-org-heading)) 1165 "M-g o" #'consult-org-heading)
1168 (advice-add 'consult-yank-pop :after '+yank@indent) 1166 (advice-add 'consult-yank-pop :after #'+yank@indent)
1169 (:when-loaded 1167 (:when-loaded
1170 (:option consult-narrow-key "<" 1168 (:option consult-narrow-key "<"
1171 consult-project-root-function '+consult-project-root) 1169 consult-project-root-function '+consult-project-root)
@@ -1211,8 +1209,6 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers."
1211 1209
1212(setup (:straight consult-notmuch) 1210(setup (:straight consult-notmuch)
1213 (:load-after consult notmuch) 1211 (:load-after consult notmuch)
1214 (with-eval-after-load 'consult
1215 (add-to-list 'consult-buffer-sources 'consult-notmuch-buffer-source))
1216 (with-eval-after-load 'vertico-multiform 1212 (with-eval-after-load 'vertico-multiform
1217 (setf (alist-get 'consult-notmuch vertico-multiform-commands) '(buffer) 1213 (setf (alist-get 'consult-notmuch vertico-multiform-commands) '(buffer)
1218 (alist-get 'consult-notmuch-tree vertico-multiform-commands) '(buffer)))) 1214 (alist-get 'consult-notmuch-tree vertico-multiform-commands) '(buffer))))
@@ -1679,10 +1675,11 @@ See also `crux-reopen-as-root-mode'."
1679 (file-exists-p i)) 1675 (file-exists-p i))
1680 i)) 1676 i))
1681 auth-sources) 1677 auth-sources)
1682 mastodon-tl--enable-proportional-fonts t 1678 mastodon-tl--show-avatars t
1683 mastodon-tl--show-avatars t) 1679 mastodon-tl--enable-proportional-fonts nil)
1684 (:hook #'mastodon-async-mode 1680 (:hook #'mastodon-async-mode
1685 #'reading-mode 1681 #'visual-fill-column-mode
1682 #'variable-pitch-mode
1686 #'hl-line-mode 1683 #'hl-line-mode
1687 #'lin-mode)) 1684 #'lin-mode))
1688 1685
@@ -1732,8 +1729,8 @@ See also `crux-reopen-as-root-mode'."
1732 eshell-mode 1729 eshell-mode
1733 vterm-mode 1730 vterm-mode
1734 crossword-mode)) 1731 crossword-mode))
1735 (:+key "C-a" #'+mwim-beginning-maybe 1732 (:global "C-a" #'+mwim-beginning-maybe
1736 "C-e" #'+mwim-end-maybe)) 1733 "C-e" #'+mwim-end-maybe))
1737 1734
1738(setup (:straight notmuch-bookmarks) 1735(setup (:straight notmuch-bookmarks)
1739 (:load-after notmuch) 1736 (:load-after notmuch)
@@ -2056,7 +2053,8 @@ See also `crux-reopen-as-root-mode'."
2056 (append reading-modes) '(visual-fill-column-mode . +1)) 2053 (append reading-modes) '(visual-fill-column-mode . +1))
2057 (:hook #'visual-line-mode) 2054 (:hook #'visual-line-mode)
2058 (:hook-into org-mode) 2055 (:hook-into org-mode)
2059 (advice-add #'text-scale-adjust :after #'visual-fill-column-adjust)) 2056 (advice-add #'text-scale-adjust :after #'visual-fill-column-adjust)
2057 (:global [f12] #'visual-fill-column-mode))
2060 2058
2061(setup (:straight vlf) 2059(setup (:straight vlf)
2062 (:require vlf-setup)) 2060 (:require vlf-setup))