+** COMMENT gnus-alias :ARCHIVE:
+
+#+begin_src emacs-lisp
+(use-package gnus-alias
+ :commands (gnus-alias-determine-identity
+ gnus-alias-select-identity)
+ :bind (:map message-mode-map
+ ("s-i" . gnus-alias-select-identity))
+ :config
+ (setq
+ gnus-alias-default-identity "amin"
+ gnus-alias-identity-alist
+ '(("amin"
+ nil ;; Does not refer to any other identity
+ "Amin Bandali <amin@aminb.org>"
+ nil ;; Organization
+ nil ;; extra headers
+ nil ;; extra body text
+ nil) ;; signature file
+ ("gnu"
+ nil
+ "Amin Bandali <bandali@gnu.org>"
+ nil
+ nil
+ nil
+ nil)
+ ("uw"
+ nil
+ "Amin Bandali <abandali@uwaterloo.ca>"
+ nil
+ (("Gcc" . "\"nnimap+uwaterloo:Sent Items\""))
+ nil
+ nil))
+ gnus-alias-identity-rules
+ '(("amin" ("Delivered-To" "<amin\\@aminb\\.org" both) "amin")
+ ("gnu" ("Delivered-To" "<gnu\\@aminb\\.org" both) "gnu")
+ ("uw" ("any" "<\\(.+\\)\\@uwaterloo\\.ca" both) "uw"))
+ gnus-alias-override-user-mail-address t)
+ :hook (message-setup . gnus-alias-determine-identity))
+#+end_src
+
+** COMMENT [[https://notmuchmail.org][notmuch]] :ARCHIVE:
+
+See [[notmuch:id:87muuqsvci.fsf@fencepost.gnu.org][bug follow-up]].
+
+#+begin_src emacs-lisp
+(defun amin/notmuch ()
+ "Delete other windows, then launch `notmuch'."
+ (interactive
+ (when (equal current-prefix-arg nil)
+ (delete-other-windows)))
+ (notmuch))
+
+(use-package notmuch
+ :commands notmuch
+ :bind ("C-c n" . amin/notmuch)
+ :custom (notmuch-always-prompt-for-sender t)
+ :config
+ (setq notmuch-hello-sections
+ '(notmuch-hello-insert-header
+ notmuch-hello-insert-saved-searches
+ ;; notmuch-hello-insert-search
+ notmuch-hello-insert-alltags)
+ notmuch-search-oldest-first nil
+ notmuch-show-all-tags-list t
+ notmuch-message-headers ; see bug follow-up above
+ '("Subject" "To" "Cc" "Date" "List-Id" "X-RT-Originator")
+ notmuch-hello-thousands-separator ","
+ notmuch-fcc-dirs
+ '(("amin@aminb.org" . "amin/Sent")
+ ("bandali@gnu.org" . "gnu/Sent")
+ ("abandali@uwaterloo.ca" . "\"uwaterloo/Sent Items\"")
+ ("mab@gnu.org" . "gnu/Sent")
+ ("amin@gnu.org" . "gnu/Sent")
+ ("aminb@gnu.org" . "gnu/Sent")
+ (".*" . "sent"))
+ notmuch-search-result-format
+ '(("date" . "%12s ")
+ ("count" . "%-7s ")
+ ("authors" . "%-40s ")
+ ("subject" . "%s ")
+ ("tags" . "(%s)"))
+ notmuch-saved-searches
+ '((:name "inbox" :query "tag:inbox" :key "i")
+ (:name "unread" :query "tag:unread" :key "u")
+ (:name "latest" :query "tag:latest" :key "l")
+ (:name "encrypted" :query "tag:encrypted" :key "e")
+ (:name "flagged" :query "tag:flagged" :key "f")
+ (:name "sent" :query "tag:sent" :key "s")
+ (:name "drafts" :query "tag:draft" :key "d")
+ (:name "all mail" :query "*" :key "a")))
+ ;; (add-hook 'visual-fill-column-mode-hook
+ ;; (lambda ()
+ ;; (when (string= major-mode 'notmuch-message-mode)
+ ;; (setq visual-fill-column-width 70))))
+ ;; (set! :evil-state 'notmuch-message-mode 'insert)
+ ;; (advice-add #'notmuch-bury-or-kill-this-buffer
+ ;; :override #'kill-this-buffer)
+ :hook (notmuch-message-mode . doom-modeline-set-special-modeline)
+ :bind
+ (:map notmuch-hello-mode-map
+ ("u" . (lambda ()
+ "Search for `unread'-tagged messages"
+ (interactive)
+ (notmuch-hello-search "tag:unread")))
+ ("i" . (lambda ()
+ "Search for `inbox'-tagged messages"
+ (interactive)
+ (notmuch-hello-search "tag:inbox")))
+ ("l" . (lambda ()
+ "Search for `latest'-tagged messages"
+ (interactive)
+ (notmuch-hello-search "tag:latest")))
+ ("e" . (lambda ()
+ "Search for `encrypted'-tagged messages"
+ (interactive)
+ (notmuch-hello-search "tag:encrypted"))))
+ (:map notmuch-search-mode-map
+ ("k" . (lambda ()
+ "Mark message read"
+ (interactive)
+ (notmuch-search-tag '("-unread"))
+ ;; (notmuch-search-archive-thread)
+ (notmuch-search-next-thread)))
+ ("u" . (lambda ()
+ "Mark message unread"
+ (interactive)
+ (notmuch-search-tag '("+unread"))
+ (notmuch-search-next-thread)))
+ ("K" . (lambda ()
+ "Mark message deleted"
+ (interactive)
+ (notmuch-search-tag '("-unread" "-inbox" "+deleted"))
+ (notmuch-search-next-thread)))
+ ("S" . (lambda ()
+ "Mark message as spam"
+ (interactive)
+ (notmuch-search-tag '("-unread" "-inbox" "-webmasters" "+spam"))
+ (notmuch-search-next-thread))))
+ (:map notmuch-tree-mode-map
+ ("k" . (lambda ()
+ "Mark message read"
+ (interactive)
+ (notmuch-tree-tag '("-unread"))
+ ;; (notmuch-tree-archive-thread)
+ (notmuch-tree-next-message)))
+ ("u" . (lambda ()
+ "Mark message unread"
+ (interactive)
+ (notmuch-tree-tag '("+unread"))
+ (notmuch-tree-next-message)))
+ ("K" . (lambda ()
+ "Mark message deleted"
+ (interactive)
+ (notmuch-tree-tag '("-unread" "-inbox" "+deleted"))
+ (notmuch-tree-next-message)))
+ ("S" . (lambda ()
+ "Mark message as spam"
+ (interactive)
+ (notmuch-tree-tag '("-unread" "-inbox" "-webmasters" "+spam"))
+ (notmuch-tree-next-message))))
+ :custom-face
+ (notmuch-search-unread-face ((t (:weight semi-bold))))
+ (notmuch-tag-face ((t (:foreground "navy blue" :weight semi-bold)))))
+
+(use-package counsel-notmuch
+ :bind ("C-c s m" . counsel-notmuch))
+
+(after! notmuch-crypto
+ (setq notmuch-crypto-process-mime t))
+
+(use-package org-notmuch
+ :after (:any org notmuch))
+#+end_src
+