+** Gnus
+
+#+begin_src emacs-lisp
+(setq amin-gnus-init-file (no-littering-expand-etc-file-name "gnus"))
+
+(use-package gnus
+ :bind ("s-m" . gnus)
+ :init
+ (setq
+ gnus-select-method
+ '(nnimap "amin"
+ (nnimap-stream plain)
+ (nnimap-address "127.0.0.1")
+ (nnimap-server-port 143)
+ (nnimap-authenticator plain)
+ (nnimap-user "amin@aminb.org"))
+ gnus-secondary-select-methods
+ '((nnimap "uwaterloo"
+ (nnimap-stream plain)
+ (nnimap-address "127.0.0.1")
+ (nnimap-server-port 143)
+ (nnimap-authenticator plain)
+ (nnimap-user "abandali@uwaterloo.ca")))
+ gnus-message-archive-group "nnimap:Sent"
+ gnus-parameters
+ '(("amin"
+ (display . 20))
+ ("uwaterloo"
+ (display . 20)))
+ gnus-home-directory (no-littering-expand-var-file-name "gnus/")
+ gnus-directory (no-littering-expand-var-file-name "gnus/News/")
+ message-directory amin-maildir
+ gnus-save-newsrc-file nil
+ gnus-read-newsrc-file nil
+ gnus-interactive-exit nil
+ gnus-gcc-mark-as-read t))
+
+(use-package gnus-art
+ :config
+ (setq
+ gnus-visible-headers
+ (concat gnus-visible-headers "\\|^List-Id:\\|^X-RT-Originator:")
+ gnus-sorted-header-list
+ '("^From:" "^Subject:" "^Summary:" "^Keywords:"
+ "^Followup-To:" "^To:" "^Cc:" "X-RT-Originator"
+ "^Newsgroups:" "List-Id:" "^Organization:"
+ "^Date:")
+ ;; local-lapsed article dates
+ ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11
+ gnus-article-date-headers '(user-defined)
+ gnus-article-time-format
+ (lambda (time)
+ (let* ((date (format-time-string "%a, %d %b %Y %T %z" time))
+ (local (article-make-date-line date 'local))
+ (combined-lapsed (article-make-date-line date
+ 'combined-lapsed))
+ (lapsed (progn
+ (string-match " (.+" combined-lapsed)
+ (match-string 0 combined-lapsed))))
+ (concat local lapsed))))
+ (bind-keys
+ :map gnus-article-mode-map
+ ("r" . gnus-article-reply-with-original)
+ ("R" . gnus-article-wide-reply-with-original)))
+
+(use-package gnus-sum
+ :bind (:map gnus-summary-mode-map
+ :prefix-map amin--gnus-summary-prefix-map
+ :prefix "v"
+ ("r" . gnus-summary-reply)
+ ("w" . gnus-summary-wide-reply)
+ ("v" . gnus-summary-show-raw-article))
+ :config
+ (setq gnus-extra-headers (append gnus-extra-headers
+ '(List-Id X-RT-Originator)))
+ (bind-keys
+ :map gnus-summary-mode-map
+ ("r" . gnus-summary-reply-with-original)
+ ("R" . gnus-summary-wide-reply-with-original)))
+
+(use-package nnmail
+ :config
+ (setq nnmail-extra-headers (append nnmail-extra-headers
+ '(List-Id X-RT-Originator))))
+
+(use-package gnus-group
+ :hook (gnus-group-mode . gnus-topic-mode))
+
+(use-package mm-decode
+ :config
+ (setq mm-discouraged-alternatives '("text/html" "text/richtext")))
+#+end_src
+
+** gnus-alias
+
+#+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
+