about summary refs log tree commit diff stats
path: root/gnus.el
diff options
context:
space:
mode:
Diffstat (limited to 'gnus.el')
-rw-r--r--gnus.el156
1 files changed, 0 insertions, 156 deletions
diff --git a/gnus.el b/gnus.el deleted file mode 100644 index 7a2cdc7..0000000 --- a/gnus.el +++ /dev/null
@@ -1,156 +0,0 @@
1;;; gnus.el -*- lexical-binding: t; coding: utf-8-unix -*-
2
3;; Author: Case Duckworth <(rot13-string "npqj@npqj.arg")>
4;; Created: Sometime during Covid-19, 2020
5;; Keywords: configuration
6;; URL: https://tildegit.org/acdw/emacs
7
8;; This file is NOT part of GNU Emacs.
9
10;;; License:
11;; Everyone is permitted to do whatever with this software, without
12;; limitation. This software comes without any warranty whatsoever,
13;; but with two pieces of advice:
14;; - Don't hurt yourself.
15;; - Make good choices.
16
17;;; Code:
18
19;;; Private files
20(acdw/require-private)
21
22;;; Select Methods
23(setq gnus-select-method '(nnnil ""))
24
25(add-hook 'gnus-started-hook
26 (defun gnus-startup@feed-setup ()
27 (cond ((fboundp #'gnus/init-feed-list)
28 (gnus/init-feed-list))
29 ((and (fboundp #'gnus/import-feed-list)
30 (file-exists-p (expand-file-name
31 "feeds.txt" user-emacs-directory)))
32 (gnus/import-feed-list (expand-file-name
33 "feeds.txt" user-emacs-directory)))
34 (t (message "Oops, no feeds :/")))))
35
36;;; Gnus cloud
37(setq gnus-cloud-storage-method nil ; Don't always have GPG or gzip
38 gnus-cloud-covered-servers '("nntp:news.tilde.club"
39 "nntp:news.gwene.org"
40 "nntp:news.gmane.io"))
41(add-hook 'gnus-started-hook #'gnus-cloud-download-all-data)
42(add-hook 'gnus-exit-gnus-hook #'gnus-cloud-upload-all-data)
43
44;;; Gnus behavior options
45(setq gnus-gcc-mark-as-read t
46 message-signature (or (file-exists-p message-signature-file)
47 "~ acdw")
48 gnus-startup-file (expand-file-name "newsrc" gnus-home-directory)
49 gnus-save-newsrc-file nil
50 gnus-read-newsrc-file nil
51 gnus-read-active-file 'some
52 gnus-always-read-dribble-file t
53 gnus-interactive-exit nil
54 gnus-use-cache t)
55
56;; Keybindings
57(define-key gnus-group-mode-map (kbd "q")
58 (defun gnus-cloud-upload-and-bury-buffer ()
59 (interactive)
60 (gnus-cloud-upload-all-data)
61 (bury-buffer)))
62(define-key gnus-group-mode-map (kbd "Q") #'gnus-group-exit)
63(define-key gnus-group-mode-map (kbd "C-q") #'gnus-group-quit)
64
65;;; Other parameters
66(setq gnus-parameters
67 '(("fastmail.com:.*"
68 (display . 200)
69 (expiry-wait . immediate)
70 (expiry-target . "nnimap+fastmail.com:Archive"))))
71
72;;; Gnus UI options
73(setq gnus-thread-sort-functions '(gnus-thread-sort-by-most-recent-date
74 (not gnus-thread-sort-by-number))
75 gnus-use-cache t
76 gnus-summary-thread-gathering-function #'gnus-gather-threads-by-subject
77 gnus-thread-hide-subtree t
78 gnus-thread-ignore-subject t
79 gnus-html-frame-width fill-column)
80
81(when window-system
82 (setq gnus-sum-thread-tree-indent " ")
83 (setq gnus-sum-thread-tree-root "● ")
84 (setq gnus-sum-thread-tree-false-root "○ ")
85 (setq gnus-sum-thread-tree-single-indent "◎ ")
86 (setq gnus-sum-thread-tree-vertical "│")
87 (setq gnus-sum-thread-tree-leaf-with-other "├─ ")
88 (setq gnus-sum-thread-tree-single-leaf "╰─ "))
89
90(setq gnus-summary-line-format
91 (concat
92 "%0{%U%R%z%}"
93 "%3{│%}" "%1{%d%}" "%3{│%}" ; date
94 " "
95 "%4{%-20,20f%}" ; name
96 " "
97 "%3{│%}"
98 " "
99 "%1{%B%}"
100 "%s\n"))
101
102(setq gnus-summary-display-arrow t)
103
104(add-hook 'gnus-group-mode-hook #'hl-line-mode)
105(add-hook 'gnus-article-mode-hook #'acdw/reading-mode)
106
107;;; MIME types
108(setq mm-discouraged-alternatives '("text/html"
109 "text/richtext"))
110
111(with-eval-after-load 'mailcap
112 (cond ((eq system-type 'darwin))
113 ((eq system-type 'windows-nt))
114 (t (mailcap-parse-mailcaps))))
115
116;;; Composing mail
117(add-hook 'message-mode-hook
118 (defun message-mode@setup ()
119 (flyspell-mode +1)
120 (local-set-key (kbd "TAB") #'bbdb-complete-mail)))
121
122;;; Packages
123
124;; searching (?)
125(require 'nnir)
126
127;; contacts
128(setup (:straight bbdb)
129 (require 'bbdb)
130 (bbdb-initialize 'message 'gnus 'mail)
131 (bbdb-insinuate-message)
132 (add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)
133 (:option bbdb/gnus-summary-prefer-real-names t
134 bbdb/mail-auto-create-p t
135 bbdb/news-auto-create-p t
136 bbdb-use-pop-up t
137 bbdb-offer-save 1
138 bbdb-update-records-p t))
139
140;;; Functions
141;; see https://wpc.io/blog/posts/bulk-import-rss-feeds-to-gnus-via-gwene.html
142(defun gnus/slurp (file)
143 "Read FILE into a string."
144 (with-temp-buffer
145 (insert-file-contents file)
146 (buffer-substring-no-properties
147 (point-min)
148 (point-max))))
149
150(defun gnus/import-feed-list (path)
151 "Import list of NNTP feeds from file at PATH."
152 (interactive "F")
153 (let ((feeds (split-string (gnus/slurp path) "\n" t)))
154 (cl-loop for feed in feeds
155 do (with-message (format "Subscribing to %s" feed)
156 (gnus-subscribe-group feed)))))