From 5b35d5c91beed4ff568256807d0d3c8d10247068 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 18 Feb 2022 18:25:27 -0600 Subject: [PATCH] Changes --- init.el | 202 ++++++++++++++++++++++++++++---------------------------- 1 file 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 @@ (:with-mode Custom-mode (:local-set imenu-generic-expression +cus-edit-imenu-generic-expression))) -(setup (:require ecomplete) - (:also-load +ecomplete) - (:option message-mail-alias-type 'ecomplete - message-self-insert-commands nil - message-expand-name-standard-ui t) - (with-eval-after-load 'ecomplete - (:option completion-category-defaults nil) - (with-eval-after-load 'embark - (:bind-into embark-email-map - "+" #'+ecomplete-add-email - "\\" #'+ecomplete-remove-email))) - (add-hook 'message-sent-hook #'message-put-addresses-in-ecomplete)) - (setup (:require goto-addr) (if (fboundp #'global-goto-address-mode) (global-goto-address-mode) @@ -189,41 +176,42 @@ (add-to-list '+browse-url-secondary-browser-regexps (replace-regexp-in-string "\\." "\\\\." domain))) ;; Set up URL handlers. - (require 'chd) - (+browse-url-set-handlers - (list - (cons (rx ; images - "." (or "jpeg" "jpg" "png" "bmp") eos) - (lambda (&rest args) - (apply - (cond ((executable-find "mpv") #'+browse-image-with-mpv) - (t #'eww-browse-url)) - args))) - (cons (rx (or ;; videos - "youtube.com" "youtu.be" "invidious" "yewtu.be" - (seq "." (or "mp4" "gif" "mov" "MOV" "webm") eos) - ;; music - "soundcloud.com" "bandcamp.com" - (seq "." (or "ogg" "mp3" "opus" "m4a") eos))) - (lambda (&rest args) - (apply (if (executable-find "mpv") - #'+browse-url-with-mpv - browse-url-secondary-browser-function) - args))) - (cons chd/url-regexps #'browse-url-chrome) - (cons (+browse-url-secondary-browser-regexps-combine) ; non-text websites - (lambda (&rest args) - (apply browse-url-secondary-browser-function args))) - (cons "xkcd\\.com" - (lambda (&rest args) - (apply (if (fboundp #'xkcd-get) - (progn (require '+xkcd) - #'+xkcd-get-from-url) - +browse-url-browser-function) - args))) - (cons "." ; everything else - (lambda (&rest args) - (apply +browse-url-browser-function args))))) + (with-eval-after-load 'org-contacts + (require 'chd) + (+browse-url-set-handlers + (list + (cons (rx ; images + "." (or "jpeg" "jpg" "png" "bmp") eos) + (lambda (&rest args) + (apply + (cond ((executable-find "mpv") #'+browse-image-with-mpv) + (t #'eww-browse-url)) + args))) + (cons (rx (or ;; videos + "youtube.com" "youtu.be" "invidious" "yewtu.be" + (seq "." (or "mp4" "gif" "mov" "MOV" "webm") eos) + ;; music + "soundcloud.com" "bandcamp.com" + (seq "." (or "ogg" "mp3" "opus" "m4a") eos))) + (lambda (&rest args) + (apply (if (executable-find "mpv") + #'+browse-url-with-mpv + browse-url-secondary-browser-function) + args))) + (cons chd/url-regexps #'browse-url-chrome) + (cons (+browse-url-secondary-browser-regexps-combine) ; non-text websites + (lambda (&rest args) + (apply browse-url-secondary-browser-function args))) + (cons "xkcd\\.com" + (lambda (&rest args) + (apply (if (fboundp #'xkcd-get) + (progn (require '+xkcd) + #'+xkcd-get-from-url) + +browse-url-browser-function) + args))) + (cons "." ; everything else + (lambda (&rest args) + (apply +browse-url-browser-function args)))))) ;; Transform URLs before passing to `browse-url' (:option +browse-url-transformations `((,(rx (or "youtube.com" "youtu.be")) @@ -236,15 +224,14 @@ "old.reddit.com")) . "teddit.net") ("medium\\.com" - . "scribe.rip"))) + . "scribe.rip") + ("www\\.npr\\.org" + . "text.npr.org"))) (+browse-url-transform-url-global-mode +1)) (setup calendar (require '_location) - (:option calendar-location-name _location-name - calendar-latitude _location-latitude - calendar-longitude _location-longitude - diary-file (private/ "diary"))) + (:option diary-file (private/ "diary"))) (setup compile (:option compilation-always-kill t @@ -282,6 +269,20 @@ (with-eval-after-load 'frowny (add-to-list 'frowny-inhibit-modes #'dired-mode))) +(setup ecomplete (:quit) + (:load-after org-contacts) + (:also-load +ecomplete) + (:option message-mail-alias-type 'ecomplete + message-self-insert-commands nil + message-expand-name-standard-ui t) + (with-eval-after-load 'ecomplete + (:option completion-category-defaults nil) + (with-eval-after-load 'embark + (:bind-into embark-email-map + "+" #'+ecomplete-add-email + "\\" #'+ecomplete-remove-email))) + (add-hook 'message-sent-hook #'message-put-addresses-in-ecomplete)) + (setup ehelp ;; Trying this instead of `helpful' (:global [help] 'ehelp-command @@ -462,39 +463,15 @@ )) (setup notmuch - (add-to-list 'load-path - (car (file-expand-wildcards "/usr/share/emacs/site-lisp/elpa-src/notmuch*"))) - (require 'notmuch) - (require '+notmuch) - (+define-dir notmuch/ (private/ "notmuch") + (:load-from "~/usr/share/emacs/site-lisp/") + ;;(:load-after org-contacts) + (:also-load +notmuch) + (+define-dir notmuch/ (sync/ "emacs/notmuch") "Notmuch configuration and data.") - (:option notmuch-init-file (notmuch/ "init.el" t) + (:option notmuch-init-file (notmuch/ "notmuch-init.el" t) notmuch-address-save-filename (notmuch/ "addresses" t) notmuch-address-use-company (featurep 'company) - notmuch-search-oldest-first nil - notmuch-saved-searches (list - (list :name "next" - :query (+notmuch-query-concat "tag:inbox" - "NOT tag:/List/") - :key "n") - (list :name "lists" - :query (+notmuch-query-concat "tag:/List/") - :key "l") - ;; original - (list :name "inbox" - :query (+notmuch-query-concat "tag:inbox" - "NOT tag:Spam") - :key "i") - (list :name "unread" - :query (+notmuch-query-concat "tag:unread" - "NOT tag:Spam") - :key "u") - (list :name "flagged" :query "tag:flagged" :key "f") - (list :name "sent" :query "tag:sent" :key "t") - (list :name "drafts" :query "tag:draft" :key "d") - (list :name "all mail" :query "*" :key "a"))) - ;; I don't know why or how this isn't properly loaded, but here we are. - (with-eval-after-load 'notmuch (load notmuch-init-file :noerror)) + notmuch-search-oldest-first nil) ;; Composing mail (:option message-kill-buffer-on-exit t) ;; Sending mail @@ -503,12 +480,31 @@ message-sendmail-envelope-from 'header mail-envelope-from 'header) ;; Extras and fixes - ;; +send-mail-dispatch is defined in notmuch/init.el - (add-hook 'notmuch-show-mode-hook #'visual-fill-column-mode) - (add-hook 'message-send-hook #'+send-mail-dispatch) - (advice-add 'notmuch-tag :filter-args #'+notmuch-correct-tags) - (:+leader "m" #'+notmuch-goto - "C-m" #'+notmuch-goto)) + (with-eval-after-load 'notmuch + (load notmuch-init-file :noerror) + ;;(add-hook 'notmuch-show-mode-hook #'visual-fill-column-mode) + (add-hook 'message-send-hook #'+send-mail-dispatch) + (advice-add 'notmuch-tag :filter-args #'+notmuch-correct-tags) + (:option notmuch-saved-searches (list + (list :name "lists" + :query (+notmuch-query-concat "tag:/List/" + "tag:unread") + :key "l") + ;; original + (list :name "inbox" + :query (+notmuch-query-concat "tag:inbox" + "NOT tag:Spam") + :key "i") + (list :name "unread" + :query (+notmuch-query-concat "tag:unread" + "NOT tag:Spam") + :key "u") + (list :name "flagged" :query "tag:flagged" :key "f") + (list :name "sent" :query "tag:sent" :key "t") + (list :name "drafts" :query "tag:draft" :key "d") + (list :name "all mail" :query "*" :key "a")))) + (:+leader "m" #'+notmuch-goto "C-m" #'+notmuch-goto + "n" #'notmuch "C-n" #'notmuch)) (setup org ;; Plain org with the `setup' form for sorting, but I install with straight. @@ -649,7 +645,8 @@ (setup org-attach (:also-load +org-attach) (:option org-attach-method 'lns) - (+org-attach-fix-args-mode +1)) + (with-eval-after-load '+org-attach + (+org-attach-fix-args-mode +1))) (setup org-capture (:require +org-capture) @@ -698,6 +695,7 @@ (+org-capture-sort)) (setup org-contacts + (:load-after org) (:also-straight org-vcard) ; for importing Vcard files (:option org-contacts-matcher "contact") ; Contacts are tagged "contact" ) @@ -1130,7 +1128,7 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." ("C-M-#" . consult-register) ;; Other custom bindings ("M-y" . consult-yank-pop) - (" a" . consult-apropos) + ;;(" a" . consult-apropos) ;; M-g bindings (goto-map) ("M-g e" . consult-compile-error) ("M-g f" . consult-flymake) ; or consult-flycheck @@ -1163,9 +1161,9 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." (define-key isearch-mode-map (car binding) (cdr binding)))) (:+menu "b" #'consult-buffer "f" #'find-file) - (with-eval-after-load 'org-mode - (define-key org-mode-map "M-g o" 'consult-org-heading)) - (advice-add 'consult-yank-pop :after '+yank@indent) + (:bind-into org + "M-g o" #'consult-org-heading) + (advice-add 'consult-yank-pop :after #'+yank@indent) (:when-loaded (:option consult-narrow-key "<" consult-project-root-function '+consult-project-root) @@ -1211,8 +1209,6 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." (setup (:straight consult-notmuch) (:load-after consult notmuch) - (with-eval-after-load 'consult - (add-to-list 'consult-buffer-sources 'consult-notmuch-buffer-source)) (with-eval-after-load 'vertico-multiform (setf (alist-get 'consult-notmuch vertico-multiform-commands) '(buffer) (alist-get 'consult-notmuch-tree vertico-multiform-commands) '(buffer)))) @@ -1679,10 +1675,11 @@ See also `crux-reopen-as-root-mode'." (file-exists-p i)) i)) auth-sources) - mastodon-tl--enable-proportional-fonts t - mastodon-tl--show-avatars t) + mastodon-tl--show-avatars t + mastodon-tl--enable-proportional-fonts nil) (:hook #'mastodon-async-mode - #'reading-mode + #'visual-fill-column-mode + #'variable-pitch-mode #'hl-line-mode #'lin-mode)) @@ -1732,8 +1729,8 @@ See also `crux-reopen-as-root-mode'." eshell-mode vterm-mode crossword-mode)) - (:+key "C-a" #'+mwim-beginning-maybe - "C-e" #'+mwim-end-maybe)) + (:global "C-a" #'+mwim-beginning-maybe + "C-e" #'+mwim-end-maybe)) (setup (:straight notmuch-bookmarks) (:load-after notmuch) @@ -2056,7 +2053,8 @@ See also `crux-reopen-as-root-mode'." (append reading-modes) '(visual-fill-column-mode . +1)) (:hook #'visual-line-mode) (:hook-into org-mode) - (advice-add #'text-scale-adjust :after #'visual-fill-column-adjust)) + (advice-add #'text-scale-adjust :after #'visual-fill-column-adjust) + (:global [f12] #'visual-fill-column-mode)) (setup (:straight vlf) (:require vlf-setup))