2021-04-19 13:24:46 +00:00
|
|
|
;;; gnus.el -*- lexical-binding: t; coding: utf-8-unix -*-
|
|
|
|
|
|
|
|
;; Author: Case Duckworth <acdw@acdw.net>
|
|
|
|
;; Created: Sometime during Covid-19, 2020
|
|
|
|
;; Keywords: configuration
|
|
|
|
;; URL: https://tildegit.org/acdw/emacs
|
|
|
|
|
|
|
|
;; This file is NOT part of GNU Emacs.
|
|
|
|
|
|
|
|
;;; License:
|
|
|
|
;; Everyone is permitted to do whatever with this software, without
|
|
|
|
;; limitation. This software comes without any warranty whatsoever,
|
|
|
|
;; but with two pieces of advice:
|
|
|
|
;; - Don't hurt yourself.
|
|
|
|
;; - Make good choices.
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2021-04-21 22:22:23 +00:00
|
|
|
;;; Select Methods
|
|
|
|
(setq gnus-select-method '(nnnil ""))
|
2021-04-19 13:24:46 +00:00
|
|
|
|
2021-04-21 22:22:23 +00:00
|
|
|
(setq gnus-secondary-select-methods
|
2021-04-22 16:51:54 +00:00
|
|
|
'((nnimap "fastmail.com"
|
2021-04-21 22:22:23 +00:00
|
|
|
(nnimap-address "imap.fastmail.com")
|
|
|
|
(nnimap-server-port 993)
|
|
|
|
(nnimap-stream ssl)
|
|
|
|
(nnir-search-engine imap))
|
2021-05-03 20:10:45 +00:00
|
|
|
(nntp "news.tilde.club")
|
|
|
|
(nntp "news.gwene.org")))
|
2021-04-19 13:24:46 +00:00
|
|
|
|
2021-05-01 20:23:49 +00:00
|
|
|
;;; Gnus cloud
|
|
|
|
(setq gnus-cloud-method "nnimap:fastmail.com"
|
2021-05-05 22:55:55 +00:00
|
|
|
gnus-cloud-storage-method nil ; Don't always have GPG or gzip
|
2021-05-06 22:45:57 +00:00
|
|
|
gnus-cloud-covered-servers '("nntp:news.tilde.club"
|
|
|
|
"nntp:news.gwene.org"))
|
2021-05-03 22:11:59 +00:00
|
|
|
(add-hook 'gnus-started-hook #'gnus-cloud-download-all-data)
|
|
|
|
(add-hook 'gnus-exit-gnus-hook #'gnus-cloud-upload-all-data)
|
2021-05-01 20:23:49 +00:00
|
|
|
|
2021-04-27 16:34:29 +00:00
|
|
|
;;; Gnus behavior options
|
|
|
|
(setq gnus-gcc-mark-as-read t
|
|
|
|
message-signature (or (file-exists-p message-signature-file)
|
2021-04-27 22:30:06 +00:00
|
|
|
"~ acdw")
|
2021-05-05 22:55:35 +00:00
|
|
|
gnus-startup-file (expand-file-name "newsrc" gnus-home-directory)
|
2021-04-27 22:30:06 +00:00
|
|
|
gnus-save-newsrc-file nil
|
2021-05-03 22:12:53 +00:00
|
|
|
gnus-read-newsrc-file nil
|
2021-05-05 22:55:35 +00:00
|
|
|
gnus-read-active-file 'some
|
|
|
|
gnus-always-read-dribble-file t
|
2021-05-05 00:58:05 +00:00
|
|
|
gnus-interactive-exit nil
|
2021-05-05 22:55:35 +00:00
|
|
|
gnus-use-cache t)
|
2021-04-27 16:34:29 +00:00
|
|
|
|
2021-05-04 14:54:59 +00:00
|
|
|
;; Keybindings
|
2021-05-04 17:55:12 +00:00
|
|
|
(define-key gnus-group-mode-map (kbd "q")
|
|
|
|
(defun gnus-cloud-upload-and-bury-buffer ()
|
|
|
|
(interactive)
|
|
|
|
(gnus-cloud-upload-all-data)
|
|
|
|
(bury-buffer)))
|
2021-05-04 14:54:59 +00:00
|
|
|
(define-key gnus-group-mode-map (kbd "Q") #'gnus-group-exit)
|
|
|
|
(define-key gnus-group-mode-map (kbd "C-q") #'gnus-group-quit)
|
|
|
|
|
2021-04-28 21:51:04 +00:00
|
|
|
;;; Other parameters
|
|
|
|
(setq gnus-parameters
|
2021-05-05 22:22:02 +00:00
|
|
|
'(("nnimap\\+fastmail.com:.*"
|
|
|
|
(display . 200)
|
|
|
|
(expiry-wait . immediate)
|
|
|
|
(expiry-target . "nnimap+fastmail.com:Archive"))))
|
2021-04-28 21:51:04 +00:00
|
|
|
|
2021-04-21 22:22:23 +00:00
|
|
|
;;; Gnus UI options
|
2021-04-19 13:24:46 +00:00
|
|
|
(setq gnus-thread-sort-functions '(gnus-thread-sort-by-most-recent-date
|
|
|
|
(not gnus-thread-sort-by-number))
|
|
|
|
gnus-use-cache t
|
|
|
|
gnus-summary-thread-gathering-function #'gnus-gather-threads-by-subject
|
|
|
|
gnus-thread-hide-subtree t
|
2021-04-30 22:37:51 +00:00
|
|
|
gnus-thread-ignore-subject t
|
|
|
|
gnus-html-frame-width fill-column)
|
2021-04-21 22:22:23 +00:00
|
|
|
|
|
|
|
(when window-system
|
|
|
|
(setq gnus-sum-thread-tree-indent " ")
|
|
|
|
(setq gnus-sum-thread-tree-root "● ")
|
|
|
|
(setq gnus-sum-thread-tree-false-root "○ ")
|
|
|
|
(setq gnus-sum-thread-tree-single-indent "◎ ")
|
|
|
|
(setq gnus-sum-thread-tree-vertical "│")
|
|
|
|
(setq gnus-sum-thread-tree-leaf-with-other "├─ ")
|
|
|
|
(setq gnus-sum-thread-tree-single-leaf "╰─ "))
|
|
|
|
|
|
|
|
(setq gnus-summary-line-format
|
|
|
|
(concat
|
|
|
|
"%0{%U%R%z%}"
|
2021-04-27 16:33:48 +00:00
|
|
|
"%3{│%}" "%1{%d%}" "%3{│%}" ; date
|
2021-04-21 22:22:23 +00:00
|
|
|
" "
|
2021-04-27 16:33:48 +00:00
|
|
|
"%4{%-20,20f%}" ; name
|
2021-04-21 22:22:23 +00:00
|
|
|
" "
|
|
|
|
"%3{│%}"
|
|
|
|
" "
|
|
|
|
"%1{%B%}"
|
|
|
|
"%s\n"))
|
|
|
|
|
|
|
|
(setq gnus-summary-display-arrow t)
|
|
|
|
|
|
|
|
(add-hook 'gnus-group-mode-hook #'hl-line-mode)
|
2021-04-27 16:34:04 +00:00
|
|
|
(add-hook 'gnus-article-mode-hook #'acdw/reading-mode)
|
2021-04-21 22:22:23 +00:00
|
|
|
|
2021-04-30 22:37:51 +00:00
|
|
|
;;; MIME types
|
|
|
|
(setq mm-discouraged-alternatives '("text/html"
|
|
|
|
"text/richtext"))
|
|
|
|
|
2021-05-05 00:57:48 +00:00
|
|
|
(with-eval-after-load 'mailcap
|
|
|
|
(cond ((eq system-type 'darwin))
|
|
|
|
((eq system-type 'windows-nt))
|
|
|
|
(t (mailcap-parse-mailcaps))))
|
|
|
|
|
2021-05-03 22:12:24 +00:00
|
|
|
;;; Composing mail
|
|
|
|
(hook-defun setup-message-mode message-mode-hook
|
|
|
|
(flyspell-mode +1)
|
|
|
|
(local-set-key (kbd "TAB") #'bbdb-complete-mail))
|
|
|
|
|
2021-04-21 22:22:23 +00:00
|
|
|
;;; Sending mail
|
|
|
|
(setq send-mail-function #'smtpmail-send-it
|
|
|
|
message-send-mail-function #'smtpmail-send-it
|
|
|
|
smtpmail-smtp-server "smtp.fastmail.com"
|
|
|
|
smtpmail-default-smtp-server "smtp.fastmail.com"
|
|
|
|
smtpmail-smtp-service 465
|
|
|
|
smtpmail-stream-type 'ssl
|
|
|
|
smtpmail-smtp-user "acdw@fastmail.com"
|
|
|
|
message-kill-buffer-on-exit t)
|
|
|
|
|
|
|
|
;;; Packages
|
|
|
|
|
|
|
|
;; searching (?)
|
|
|
|
(require 'nnir)
|
|
|
|
|
|
|
|
;; contacts
|
|
|
|
(setup (:straight bbdb)
|
|
|
|
(require 'bbdb)
|
|
|
|
(bbdb-initialize 'message 'gnus 'mail)
|
|
|
|
(bbdb-insinuate-message)
|
|
|
|
(add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)
|
|
|
|
(:option bbdb/gnus-summary-prefer-real-names t
|
|
|
|
bbdb/mail-auto-create-p t
|
|
|
|
bbdb/news-auto-create-p t
|
|
|
|
bbdb-use-pop-up t
|
|
|
|
bbdb-offer-save 1
|
|
|
|
bbdb-update-records-p t))
|
2021-05-05 00:58:05 +00:00
|
|
|
|
2021-05-06 14:55:54 +00:00
|
|
|
;;; Functions
|
|
|
|
;; see https://wpc.io/blog/posts/bulk-import-rss-feeds-to-gnus-via-gwene.html
|
|
|
|
(defun gnus/slurp (file)
|
|
|
|
"Read FILE into a string."
|
|
|
|
(with-temp-buffer
|
|
|
|
(insert-file-contents file)
|
|
|
|
(buffer-substring-no-properties
|
|
|
|
(point-min)
|
|
|
|
(point-max))))
|
|
|
|
|
|
|
|
(defun gnus/import-feed-list (path)
|
|
|
|
"Import list of NNTP feeds from file at PATH."
|
|
|
|
(interactive "F")
|
|
|
|
(let ((feeds (split-string (gnus/slurp path) "\n" t)))
|
|
|
|
(cl-loop for feed in feeds
|
|
|
|
do (with-message (format "Subscribing to %s" feed)
|
|
|
|
(gnus-subscribe-group feed)))))
|