Skip to content

Instantly share code, notes, and snippets.

@jackbaty
Created July 31, 2025 21:21
Show Gist options
  • Save jackbaty/283dea1794b49b2d782172c7f05a2cf4 to your computer and use it in GitHub Desktop.
Save jackbaty/283dea1794b49b2d782172c7f05a2cf4 to your computer and use it in GitHub Desktop.
My .gnus.el
(use-package gnus
:bind
(("C-c o g" . gnus)
(:map gnus-group-mode-map
("o" . my/gnus-group-list-subscribed-groups))
(:map gnus-summary-mode-map
("Y" . my/gnus-summary-archive)
("#" . my/gnus-summary-delete)))
;;:hook
;;(gnus-group-mode-hook . gnus-topic-mode)
:init
;; Keep Gnus files somewhere that's not ~/
(setq gnus-home-directory "~/.gnus.d/"
gnus-directory "~/.gnus.d/Mail/"
gnus-default-directory "~/.gnus.d"
nndraft-directory "~/.gnus.d/News/drafts/"
nnmh-directory "~/.gnus.d/News/drafts/"
nnfolder-directory "~/.gnus.d/Mail/archive"
nnml-directory "~/.gnus.d/Mail/"
nnrss-directory "~/.gnus.d/News/rss/"
message-directory "~/.gnus.d/Mail/"
gnus-article-save-directory "~/.gnus.d/Mail/"
gnus-refer-thread-use-search t
gnus-read-newsrc-file nil
gnus-save-newsrc-file nil
;; Do we need this, though?
gnus-startup-file "~/.gnus.d/.newsrc"
gnus-dribble-directory "~/.gnus.d/"
gnus-use-dribble-file nil
gnus-always-read-dribble-file nil)
:custom
;; Archive outgoing email in Sent Items folder, mark it as read
;; UPDATE: Do I need this? Fastmail saves Sent items via SMTP
;; (gnus-message-archive-method '(nnimap "personal"))
;; (gnus-message-archive-group "Sent Items")
(gnus-message-archive-group (format-time-string "sent.%Y"))
(gnus-gcc-mark-as-read t)
(gnus-search-use-parsed-queries t)
(gnus-auto-select-next nil)
(gnus-paging-select-next nil)
(gnus-summary-stop-at-end-of-message t)
(gnus-mime-display-multipart-related-as-mixed t)
(gnus-auto-select-first nil)
(gnus-summary-display-arrow nil)
(gnus-thread-sort-functions
'(gnus-thread-sort-by-most-recent-date
(not gnus-thread-sort-by-number)))
(gnus-show-threads t)
(gnus-sum-thread-tree-false-root nil) ;; use subject
(gnus-sum-thread-tree-root nil)
(gnus-sum-thread-tree-indent " ")
(gnus-sum-thread-tree-vertical "│")
(gnus-sum-thread-tree-leaf-with-other "├─► ")
(gnus-sum-thread-tree-single-leaf "╰─► ")
(gnus-summary-line-format (concat
"%0{%U%R%z%}"
"%3{│%}%1{%&user-date;%}%3{│%}" ;; date
"%ub:" ;; indicate (+) if known (bbdb)
"%4{%-20,20f%}" ;; name
" "
"%3{│%}"
" "
"%1{%B%}"
"%s\n"))
(gnus-user-date-format-alist '((t . "%Y-%m-%d (%a)")
gnus-thread-sort-functions '(gnus-thread-sort-by-date)))
:config
(setq gnus-check-new-newsgroups nil) ; speeds up launch, now that I'm reading feeds ,too
(setq gnus-select-method '(nnnil ""))
(setq gnus-use-full-window nil)
(setq gnus-secondary-select-methods '((nnimap "personal"
(nnimap-address "imap.fastmail.com")
(nnimap-server-port 993)
(nnimap-stream ssl)
(nnmail-expiry-target "nnimap+personal:Trash")))))
;; Note, expiry-wait is set to "immediate" via Customize
;; Send email via Fastmail's SMTP:
(use-package smtpmail
:custom
(send-mail-function 'smtpmail-send-it)
(smtpmail-default-smtp-server "smtp.fastmail.com")
(smtpmail-stream-type 'ssl)
(smtpmail-smtp-service 465))
;; ---- some helpers
(defun my/gnus-group-list-subscribed-groups ()
"List all subscribed groups with or without un-read messages"
(interactive)
(gnus-group-list-all-groups 5))
(defun my/gnus-summary-archive ()
"Mark current or marked mails as read and move to the Archive in Fastmail."
(interactive)
(gnus-summary-put-mark-as-read 0)
(gnus-summary-move-article nil "nnimap+personal:Archive")
(gnus-summary-next-article))
(defun my/gnus-summary-delete ()
"Mark the current article as read and move to Trash in Fastmail."
(interactive)
(gnus-summary-put-mark-as-read 0)
(gnus-summary-move-article nil "nnimap+personal:Trash")
(gnus-summary-next-article))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment