+** Gnus
+
+#+begin_src emacs-lisp
+(setq
+ amin-gnus-init-file (no-littering-expand-etc-file-name "gnus")
+ mail-user-agent 'gnus-user-agent
+ read-mail-command 'gnus)
+
+(use-package gnus
+ :bind (("s-m" . gnus)
+ ("s-M" . gnus-unplugged))
+ :init
+ (setq
+ gnus-select-method '(nnnil "")
+ gnus-secondary-select-methods
+ '((nnimap "amin"
+ (nnimap-stream plain)
+ (nnimap-address "127.0.0.1")
+ (nnimap-server-port 143)
+ (nnimap-authenticator plain)
+ (nnimap-user "amin@aminb.org"))
+ (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+amin:Sent"
+ gnus-parameters
+ '(("gnu.*"
+ (gcc-self . t)))
+ gnus-large-newsgroup 50
+ gnus-home-directory (no-littering-expand-var-file-name "gnus/")
+ gnus-directory (concat gnus-home-directory "news/")
+ message-directory (concat gnus-home-directory "mail/")
+ nndraft-directory (concat gnus-home-directory "drafts/")
+ 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:\\|^User-Agent:")
+ gnus-sorted-header-list
+ '("^From:" "^Subject:" "^Summary:" "^Keywords:"
+ "^Followup-To:" "^To:" "^Cc:" "X-RT-Originator"
+ "^Newsgroups:" "List-Id:" "^Organization:"
+ "^User-Agent:" "^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)
+ ("M-L" . org-store-link)))
+
+(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
+ (bind-keys
+ :map gnus-summary-mode-map
+ ("r" . gnus-summary-reply-with-original)
+ ("R" . gnus-summary-wide-reply-with-original)
+ ("M-L" . org-store-link))
+ :hook (gnus-summary-mode . amin--no-mouse-autoselect-window))
+
+(use-package gnus-msg
+ :config
+ (setq gnus-posting-styles
+ '((".*"
+ (address "amin@aminb.org")
+ (body "\nBest,\namin\n")
+ (eval (setq amin--message-cite-say-hi t)))
+ ("gnu.*"
+ (address "bandali@gnu.org"))
+ ((header "subject" "ThankCRM")
+ (to "webmasters-comment@gnu.org")
+ (body "\nAdded to 2018supporters.html.\n\nMoving to campaigns.\n\n-amin\n")
+ (eval (setq amin--message-cite-say-hi nil)))
+ ("nnimap\\+uwaterloo:.*"
+ (address "abandali@uwaterloo.ca")
+ (gcc "\"nnimap+uwaterloo:Sent Items\"")))))
+
+(use-package gnus-topic
+ :hook (gnus-group-mode . gnus-topic-mode))
+
+(use-package gnus-agent
+ :config
+ (setq gnus-agent-synchronize-flags 'ask)
+ :hook (gnus-group-mode . gnus-agent-mode))
+
+(use-package gnus-group
+ :config
+ (setq gnus-permanently-visible-groups "\\((INBOX\\|gnu$\\)"))
+
+(use-package mm-decode
+ :config
+ (setq mm-discouraged-alternatives '("text/html" "text/richtext")))
+#+end_src
+