comparison shared/gnus-init.el @ 0:107d592c5f4a

DICE versions, used by pers/common, recursive, I think/hope
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Mon, 08 Feb 2021 11:44:37 +0000
parents
children 0a81352bd7d0
comparison
equal deleted inserted replaced
-1:000000000000 0:107d592c5f4a
1 ;; Last edited: Fri Sep 7 12:19:43 2018
2 ;; gnus customisation
3
4 (setq gnus-novice-user nil)
5 (setq gnus-message-archive-group
6 '((concat "general." (format-time-string
7 "%Y-%m" (current-time)))))
8
9 (setq gnus-summary-ignore-duplicates t
10 gnus-auto-select-next 'quietly
11 gnus-save-newsrc-file nil
12 gnus-read-newsrc-file nil
13 gnus-save-killed-list nil
14 gnus-summary-display-arrow nil
15 gnus-check-new-newsgroups nil
16 gnus-auto-select-subject 'unseen-or-unread
17 gnus-your-organization "HCRC, University of Edinburgh"
18 gnus-buttonized-mime-types '("multipart/signed")
19 gnus-ignored-headers
20 "^Errors-To:\\|^Precedence:\\|^UNIX-From:"
21 gnus-default-directory "/afs/inf.ed.ac.uk/user/h/ht"
22 nnmail-message-id-cache-file "/disk/scratch/gnus/.nnmail-cache"
23 mm-discouraged-alternatives '("text/html")
24 nnmail-expiry-wait 28
25 mail-sources
26 '((file :path "/disk/scratch/mail/ht_mbox"))
27 mail-source-crash-box "/tmp/crashbox" ; local disk
28 nndraft-directory "/disk/scratch/drafts/"
29 message-auto-save-directory "/disk/scratch/drafts/"
30 message-from-style 'angles
31 no-select-groups '("nnml+ht:cygwin")
32 gnus-group-line-format "%M%S%p%P%5y:%uH%(%g%)%l %O
33 ")
34
35 (setq bbdb/news-auto-create-p t)
36
37 (setq wsp-cache nil)
38
39 ;;;(setq blacklist-db (open-database "~/.blacklist"))
40
41 (require 'my-news) ; defines db functions
42
43 (open-white)
44 (open-ad)
45 (open-quaker)
46
47 (add-hook 'kill-emacs-hook
48 (lambda ()
49 (if (database-live-p whitelist-db)
50 (close-database whitelist-db))
51 (if (database-live-p quaker-db)
52 (close-database quaker-db))
53 (if (database-live-p adlist-db)
54 (close-database adlist-db))))
55
56 (add-hook 'bbdb-complete-name-hooks 'quaker-sig-if-quaker)
57 (add-hook 'gnus-message-setup-hook 'quaker-sig-if-to-quaker)
58
59 (setq nnmail-crosspost nil)
60 (setq nnmail-split-methods 'nnmail-split-fancy)
61
62 (setq white-subjects "\\b\\(phd\\|ilcc\\)\\b")
63
64 (setq white-domains (list))
65
66 (setq ad-domains (list "planetx.co.uk"))
67
68 (setq w3c-lists1
69 '((list "w3c-xml-schema-\\([a-zA-Z]+\\)\\(\\.w3\\.org\\)?" "xml-schema-\\1")
70 (list "chairs\\(\\.w3\\.org\\)?" "w3c-chairs" )
71 (to "\\(w3c\\|public\\|member\\)-xml-\\([-a-zA-Z]+\\)\\(\\.w3\\.org\\)?"
72 "xml-\\2" )
73 ;(list "w3t-\\([-a-zA-Z]+\\)\\(\\.w3\\.org\\)?" "w3t-\\1")
74 ;(list "team-\\([-a-zA-Z]+\\)\\(\\.w3\\.org\\)?" "w3-team-\\1")
75 ;(list "w3c-\\(xsl-wg\\|format\\|i18n-ig\\)\\(\\.w3\\.org\\)?" "w3c-xsl")
76 (list "w3c-\\([-a-zA-Z]+\\)\\(\\.w3\\.org\\)?" "w3c-\\1")
77 (list "member-\\(ac-uk\\|access\\)" "w3-member-\\1");[-a-zA-Z]+\\)
78 (to "public-xpointer-registry\\(-request\\)?"
79 "xpointer-registry");[-a-zA-Z]+
80 (to "public-\\([-a-zA-Z]+\\)" "w3-public-\\1")
81 (to "w3c-xml-schema-\\([a-zA-Z]+\\)" "xml-schema-\\1")
82 (to "chairs" "w3c-chairs")
83 (to "w3c-xml-\\([-a-zA-Z]+\\)" "xml-\\1" )
84 (to "www-xml-\\([-a-zA-Z]+\\)" "xml-\\1")
85 ;(list "www-\\([-a-zA-Z]+\\)" "www-\\1")
86 ;(to "w3c-\\(xsl-wg\\|format\\|i18n-ig\\)" "w3c-xsl")
87 ;(to "w3t-\\([-a-zA-Z]+\\)" "w3t-\\1")
88 ;(to "team-\\([-a-zA-Z]+\\)" "w3-team-\\1")
89 ;(to "w3c-\\([-a-zA-Z]+\\)" "w3c-\\1")
90 ;(to "xml-\\([-a-zA-Z]+\\)" "w3c-\\1")
91 ;(to "member-\\([-a-zA-Z]+\\)" "w3-member-\\1")
92 ;(to "ercim-\\([-a-zA-Z]+\\)" "ercim-\\1")
93 ;(to "w3t" "w3t")
94 ))
95
96 (setq w3c-lists2
97 '((to "w3t-archive" "w3t-archive")
98 (to "w3c-archive" "w3c-archive")))
99
100 (setq xml-lists1
101 '(;(to "xml-uri" "nsuri")
102 (to ".*editor.*" "xml-rec-comments")
103 (to "xml-dev" "xml")
104 (to "xsl-list" "xsl")
105 ;(to "[Xx]emacs[- ]beta" "xemacs")
106 (to "xmlschema-dev" "schema-dev")
107 (to "xproc-dev" "xproc-dev")
108 ;(to "xml-sig" "xml-python")
109 ;(to "xml-plenary" "xml-plenary")
110 ))
111
112 (setq xml-lists2
113 '((list "ietf-xml-mime\\.imc\\.org" "xml-mime")
114 (list "xml-mime\\.ietf\\.org" "xml-mime")))
115
116 (setq misc-list1
117 '(;(from "w3t-\\([a-zA-Z]+\\)-request" "w3t-\\1")
118 ;(from "w3c-\\([a-zA-Z]+\\)-request" "w3c-\\1")
119 ;(from "xml-\\([a-zA-Z]+\\)-request" "xml-\\1")
120 ;(from "p.woolman" "nhs-xml")
121 (from "Cron Daemon" "cron")
122 (from ".*@mail.gumtree.com" "personal")
123 (from ".*@postman.storyworth.com" "storyworth")
124 ;(from "\\(Richard\\.Kirkham\\|rachel\\.johnson\\|maria\\.papadaki\\|marisol\\.leonen\\|sangeeta\\.tewar\\|abdullah\\.alshamsi\\|.*@buid\\.ac\\.ae\\)" "buid")
125 (to "www-tag" "tag")
126 ;(to "webarch@noreply.github.com" "tag")
127 ;(to "dashboard-hackers" "beagle")
128 ;(to "pellet-users" "pellet")
129 (to "tkinter-discuss" "tkinter")
130 ;(to "sdp-students" "sdp")
131 (to "fnlp-students" "fnlp")
132 ;(from "fox@tardis\\.ed\\.ac\\.uk\\|s1505551" "fnlp")
133 (to "anlp-students" "anlp")
134 ;(from "nbnotifications" "anlp")
135 ;(: split-on-whole-field "Subject" "Re: MSc Project 18.*" "msc18")
136 (: split-on-whole-field "Subject" ".*FNLP.*" "fnlp")
137 ;(: split-on-whole-field "Subject" ".*SDP \\(MS .\\|final\\) evaluation" "sdpEval")
138 ;(: split-on-whole-field "Subject" ".*[[]SDP[]] \\(Your evaluation\\|Evaluation deadline\\).*" "sdpEval")
139 ;(: split-on-whole-field "Subject" ".*SDP.*" "sdp")
140 (: split-on-whole-field "Subject" ".*Welcome to ANLP, action needed.*" "anlp_github")
141 (: split-on-whole-field "Subject" ".*ANLP.*" "anlp")
142 (from "ANLP on Piazza" "anlp")
143 ;(from "FNLP on Piazza" "fnlp")
144 ;(from "no-reply@piazza.com" "anlp")
145 (: split-on-whole-field "Subject" ".*Personal Tutor.*" "tutees20")
146 (: split-on-whole-field "Subject" ".*Course Selection.*" "tutees20")
147 ;(: split-on-whole-field "Subject" ".*Sutton Trust.*" "inf-recruit")
148 (: split-on-whole-field "Subject" "mycron .*" "cron")
149 ;(: split-on-whole-field "Subject" "INF1-Cg experiment.*" "cgx_2013")
150 (: split-on-whole-field "Subject" ".*[[]urn[]].*" "urn")
151 (from "\\(106300.457@compuserve.com\\|elizdrummondyoung@gmail.com\\|jcdavey12@btinternet.com\\|andrewdolan@btinternet.com\\|wandbamoyes@btinternet.com\\)" "albertus")
152 (to "corpus-admin" "corpora")
153 (: split-on-whole-field "Subject" ".*Albertus.*" "albertus")
154 (: split-on-whole-field "Subject" ".*\\[corpus-admin\\].*" "corpora")
155 ;(to ".*@\\(hst\\|hthompson\\|henry\\.thompson\\)\\.name" "personal")
156 (from "mikereape@.*" "mikereape")
157 (from "\\(.*@mumble\\.net\\|jar@\\.csail\\.mit\\.edu\\)" "jar")
158 (from ".*@coulters.io" "belford")
159 (from ".*@umega.co.uk" "belford")
160 (to ".*@umega.co.uk" "belford")
161 (: split-on-whole-field "Subject" ".*belford.*" "belford")
162 ))
163
164 (setq quaker-list
165 '((to "quaker-\\(l\\|spectrum\\)" "quaker")
166 ;(to "quaker-b" "quaker-b")
167 ;(to "QuakerBYM" "quaker-b")
168 ;(from "quaker-spectrum-approval" "quaker")
169 ))
170
171 (setq sms-list
172 '((from "s1513009@.*" "ug4_18");\\|s1536017\\(s1443062\\|s1679328
173 ;(from "Y.Chen-258@.*" "msc_19")
174 (from "\\(s1795066\\|s1825415\\|A.M.Magalhaes\\|T.Makino\\|S.Li-93\\|M.Maggiolo\\|ashe\\|Y.Li-242\\|E.J.Martin\\|K.Lohse\\|D.Li-28\\|S.D.Martin-1\\|K.Chen-35\\|J.Norris-3\\|S.Li-80\\|Y.Liu-236\\|J.Chen-114\\|Q.Zeng-3\\|Y.Liu-244\\|P.Guo-1\\|s1582739\\|B.Lun\\|X.Li-143\\|F.Li-17\\|K.R.Lu\\|Z.Li-86\\)@.*" "tutees18")
175 (from "\\(s1895309\\|s1765180\\|s1764494\\|s1645474\\|s1953043\\|s1651774\\|s1732316\\|s1742667\\)@.*" "tutees20")
176 ))
177
178 (defalias 'tut20 (read-kbd-macro
179 "C-x o C-s < RET C-s @ C-b C-x C-x M-w C-x b gnus SPC RET C-s \"tutees20 RET C-r \\\\) RET \\\\| C-y C-a ESC ESC : nil RET ESC C-x M-x ht- 3*<backspace> set- ht SPC RET C-x C-s C-x b RET C-x o"))
180
181 ;;; groups only, comes _after_ split to pers-... for to: ht...
182 (setq misc-list2
183 '(;(to "cogsci.general" "junk")
184 (from "anrdaemon@yandex.ru\\|gsenopu@gmail.com\\|pradeepan88@hotmail.com" "anr-doom")
185 ;(to "bp-people" "bp-people")
186 ;(to "ppelders" "ppelders")
187 ;(to "7vtw" "7vtw")
188 (to "\\(apps-review\\|uri-review\\|apps-discuss\\|discuss\\|architecture-discuss\\|appsdir\\|art\\)@[a-z.]*\\(ietf\\|iab\\).org" "ietf")
189 (to "urn@ietf.org" "urn")
190 (to "if-people" "if-people")
191 (to "maptask" "maptask")
192 ;(to "i18n-sig" "xml-python")
193 ;(to "spec-prod" "spec-prod")
194 ;(to "markup" "markup")
195 ;(to "system-notices" "w3c-sys-notes")
196 (to "[cC]ygwin" "cygwin")
197 ;(to "jde@sunsite.dk" "jde")
198 ;(to "jdee-users@lists.sourceforge.net" "jde")
199 (to "tagsoup-friends@yahoogroups.com" "tagsoup")
200 (to "screen-users@gnu.org" "screen")
201 (from "mailinglist@edinburghrc.co.uk" "erc")
202 (to "selenium-users" "selenium")
203 ;(to "ding" "gnus")
204 ;(to "dssslist" "dsssl")
205 ;(to "TEI-L" "tei")
206 (to "\\(announcements\\|unicode\\)@unicode.org" "unicode")
207 ;(to "squid-users@lists.squid-cache.org\\|squid-users@squid-cache.org"
208 ; "squid")
209 (to "exist-open" "exist")
210 (list "ilcc-\\([a-zA-Z]+\\)" "ilcc-\\1")
211 (to "ilcc" "ilcc")
212 (to ".*lecturers@inf.ed.ac.uk" "inf-teach")
213 (to "\\(aisyllabus\\|acstaff\\)" "inf-teach")
214 (to "\\(inf\\)?\\(pg\\|msc\\|teach\\|res\\|staff\\)\@inf\\(ormatics\\)?"
215 "inf-\\2" )
216 ;(to "directors-of-studies" "inf-dos")
217 (to "common-crawl@googlegroups.com" "ccrawl")
218 ;(list "inkscape-user\\|openbox\\|ffmpeg-user" "misc-list")
219 ))
220
221 (defvar ht-compiled-split nil)
222
223 (defun set-ht-compiled-split ()
224 "update the mail splitting rules"
225 (interactive)
226 (setq ht-compiled-split
227 (let* ((month
228 (format-time-string "%Y-%m" (current-time)))
229 (now-group (concat "group-" month))
230 (now-pers (concat "pers-" month)))
231 `(|
232 (: split-on-whole-field "Subject" "testing" "junk")
233 ;;; ("Content-Type" content-spam "gnSPAM")
234 ;;; ("Content-Transfer-Encoding" encoding-spam "gnSPAM")
235 ;;; (: split-on-whole-subj 'subject-spam "gnSPAM")
236 ;; Special to people who use Yahoo
237 ;;; ("X-YahooFilteredBulk" ".*" "gnSPAM")
238 ;;; (from author-spam "gnSPAM")
239 ;; A subject with no letters is SPAM
240 ;;; (: split-on-whole-subj "^[^a-zA-Z]+$" "gnSPAM")
241 ;; It would be cool to check the
242 ;; date and toss it if it is "old"
243 (to "\\(w3[ct]\\|www\\|team\\|member\\|public\\|ercim\\)[^ ]*@.*"
244 (| ,@w3c-lists1
245 (to "ht\\|henry\\|\\(h\\.?\\)?thompson?" ,now-pers)
246 ,@w3c-lists2
247 (to "x.*@.*" (| ,@xml-lists1
248 (to "ht\\|henry\\|\\(h\\.?\\)?thompson?" ,now-pers)
249 ,@xml-lists2
250 ,now-group))))
251 (to "x.*@.*" (| ,@xml-lists1
252 (to "ht\\|henry\\|\\(h\\.?\\)?thompson?" ,now-pers)
253 ,@xml-lists2))
254 ,@misc-list1
255 (to "ht\\|henry\\|\\(h\\.?\\)?thompson?"
256 (| (from ".*@sms.ed.ac.uk" (|
257 ,@sms-list
258 ,now-pers))
259
260 ,now-pers))
261 (to "quaker.*" (|
262 ,@quaker-list
263 ,now-group))
264 ,@misc-list2
265 ,now-group
266 ))))
267
268 (set-ht-compiled-split)
269
270 (setq nnmail-split-fancy
271 '(!
272 (lambda (sres)
273 (if (or (equal (car sres) "notSPAM")
274 (equal (car sres) "waSPAM"))
275 ;; documentation is wrong, no recursion,
276 ;; so we do it ourselves :-(
277 (nnmail-split-it ht-compiled-split)
278 sres))
279 (| (: ad-spam "adverts")
280 (: white-spam "waSPAM")
281 ("X-Bogosity" "Yes.*"
282 (|
283 (From ".*ed\.ac\.uk" "edSPAM") ; NB From not from
284 ("X-Spam-Score" "0" "boSPAM")
285 "bfSPAM"))
286 (: split-on-whole-field "X-Spam-Level" "\\*\\*\\*\\*.*"
287 "saSPAM")
288 ("X-Spam-Status" "Yes.*" "saSPAM")
289 "notSPAM")))
290
291 (setq gnus-show-mime t) ; stale
292 (setq mml1991-use 'pgg
293 mml2015-use 'pgg
294 mm-verify-option 'always)
295
296 (require 'mm-decode)
297 (setq mm-automatic-display (remove "text/html" mm-automatic-display))
298
299 (custom-set-faces)
300
301 (add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
302
303 (add-hook 'gnus-summary-mode-hook 'gnus-summary-mode-fun1)
304
305 ;;; After hiding pgp, verify the message;
306 ;;; only happens if pgp signature is found.
307
308 ;(add-hook 'gnus-article-hide-pgp-hook
309 ; (lambda ()
310 ; (save-excursion
311 ; (set-buffer gnus-original-article-buffer)
312 ; (mc-verify))))
313
314
315 (add-hook 'message-mode-hook 'message-mode-fun1)
316
317 (add-hook 'gnus-group-mode-hook 'gnus-group-mode-fun1)
318 (add-hook 'gnus-select-group-hook 'no-select)
319
320 (add-hook 'gnus-parse-headers-hook
321 '(lambda ()
322 (gnus-summary-set-local-parameters gnus-newsgroup-name)))
323
324
325 ;(add-hook 'gnus-summary-mode-hook 'mc-install-read-mode)
326 ;(add-hook 'message-mode-hook 'mc-install-write-mode)
327 ;(add-hook 'news-reply-mode-hook 'mc-install-write-mode)
328
329 ;;; Jack Vinson's (partial Fancy mail rules for killing SPAM)
330 ;; Content with any of the following is probably SPAM
331
332 (require 'nnmail)
333 (if (not (assq 'list nnmail-split-abbrev-alist))
334 (setq nnmail-split-abbrev-alist
335 (cons '(list . "List-Id") nnmail-split-abbrev-alist)))
336
337 (add-hook 'nnmail-split-abbrev-alist
338 (cons 'content-spam "text/html\\|big5\\|gb2312\\|ks_c_.*\\|euc-kr"))
339
340 ;; Encoding with any of the following is probably SPAM
341 (add-hook 'nnmail-split-abbrev-alist
342 (cons 'encoding-spam "binary\\|base64"))
343
344 ;; These special subjects are SPAM:
345 ;; funny characters, whitespace followed by a string, no letters
346 ;; and any words that are always SPAM
347 (add-hook 'nnmail-split-abbrev-alist
348 (cons 'subject-spam ".*\\([\177-\277\367]\\|=\\?big5\\?\\).*"))
349
350 ;; Bad authors who still get through all of this
351 (add-hook 'nnmail-split-abbrev-alist
352 (cons 'author-spam "explicit\\|amazing"))
353
354 ;; from w/o Resent-From
355 (add-hook 'nnmail-split-abbrev-alist
356 (cons 'From "from\\|sender"))
357
358 ;; And the actual splitting rule
359 ;(setq nnmail-split-fancy
360 ; '(|
361 ; ;; Various mailing lists, match on Subject or Sender headers
362 ; (from mail "Boing")
363 ; (any "my_mailing_list@foo.com" "list_group")
364 ;
365 ; ;; SPAM, SPAM, SPAM
366 ; ("Content-Type" content-spam "gnSPAM")
367 ; ("Content-Transfer-Encoding" encoding-spam "gnSPAM")
368 ; ("Subject" subject-spam "gnSPAM")
369 ; ;; Special to people who use Yahoo
370 ; ("X-YahooFilteredBulk" ".*" "gnSPAM")
371 ; (from author-spam "gnSPAM")
372 ;; A subject with no letters is SPAM
373 ; ("Subject" "^[^a-zA-Z]+$" "gnSPAM")
374 ;; It would be cool to check the date and toss it if it is "old"
375 ;; Several spammers send mail that has ancient dates...
376
377 ;; Additional splitting rules on Subject for convenience.
378
379 ;; Everything else should be coming to me
380 ; (to "jackvinson" "misc")
381
382 ;; Else it is SPAM
383 ; "gnSPAM")
384 ; )
385
386 (add-hook 'message-sent-hook (function whiten-recip))
387
388 (add-hook 'gnus-get-new-news-hook (lambda () (setq ht-gnus-just-read nil)))
389 (add-hook 'gnus-after-getting-new-news-hook
390 (lambda () (message "%s" ht-gnus-just-read)))
391
392 (add-hook 'nnml-prepare-save-mail-hook (function ht-gnus-note-save-to-group))
393
394 (require 'gnus-art)
395
396 (nconc gnus-treatment-function-alist
397 '((gnus-treat-strip-uoe-warning gnus-article-strip-uoe-warning)))
398
399 (defun gnus-article-strip-uoe-warning (&optional interactive &rest args)
400 "redirect for stripping"
401 (interactive (list t))
402 (save-excursion
403 (set-buffer gnus-article-buffer)
404 (if interactive
405 (call-interactively 'article-strip-uoe-warning)
406 (apply 'article-strip-uoe-warning args))))
407
408 (defun article-strip-uoe-warning ()
409 "strip the stupid uoe warning"
410 (interactive)
411 (save-excursion
412 (article-goto-body)
413 (let ((case-fold-search t))
414 (when
415 (looking-at "This email was sent to you by someone outside the University.")
416 (gnus-delete-line))
417 (when
418 (looking-at "You should only click on links or attachments if you are certain that the email is genuine and the content is safe.")
419 (gnus-delete-line))
420 )))
421
422 (setq gnus-treat-strip-uoe-warning t)