comparison mail-from-inf.el @ 39:f593eacb57b0

needed now
author Henry S Thompson <ht@inf.ed.ac.uk>
date Tue, 12 Dec 2023 10:28:33 +0000
parents
children eee08de75336
comparison
equal deleted inserted replaced
38:38d8baf64ac5 39:f593eacb57b0
1 (setq my-mail-dir "/disk/scratch/mail"
2 gnus-your-organization "HCRC, University of Edinburgh"
3 gnus-default-directory "/afs/inf.ed.ac.uk/user/h/ht"
4 nnmail-message-id-cache-file "/disk/scratch/gnus/.nnmail-cache"
5 mail-sources
6 '((file :path "/disk/scratch/mail/ht_mbox"))
7 mail-source-crash-box "/tmp/crashbox" ; local disk
8 nndraft-directory "/disk/scratch/drafts/"
9 message-auto-save-directory "/disk/scratch/drafts/"
10 )
11
12 (setq white-subjects "\\b\\(phd\\|ilcc\\)\\b")
13
14 (setq w3c-lists1
15 '((list "w3c-xml-schema-\\([a-zA-Z]+\\)\\(\\.w3\\.org\\)?" "xml-schema-\\1")
16 (list "chairs\\(\\.w3\\.org\\)?" "w3c-chairs" )
17 (to "\\(w3c\\|public\\|member\\)-xml-\\([-a-zA-Z]+\\)\\(\\.w3\\.org\\)?"
18 "xml-\\2" )
19 ;(list "w3t-\\([-a-zA-Z]+\\)\\(\\.w3\\.org\\)?" "w3t-\\1")
20 ;(list "team-\\([-a-zA-Z]+\\)\\(\\.w3\\.org\\)?" "w3-team-\\1")
21 ;(list "w3c-\\(xsl-wg\\|format\\|i18n-ig\\)\\(\\.w3\\.org\\)?" "w3c-xsl")
22 (list "w3c-\\([-a-zA-Z]+\\)\\(\\.w3\\.org\\)?" "w3c-\\1")
23 (list "member-\\(ac-uk\\|access\\)" "w3-member-\\1");[-a-zA-Z]+\\)
24 (to "public-xpointer-registry\\(-request\\)?"
25 "xpointer-registry");[-a-zA-Z]+
26 (to "public-\\([-a-zA-Z]+\\)" "w3-public-\\1")
27 (to "w3c-xml-schema-\\([a-zA-Z]+\\)" "xml-schema-\\1")
28 (to "chairs" "w3c-chairs")
29 (to "w3c-xml-\\([-a-zA-Z]+\\)" "xml-\\1" )
30 (to "www-xml-\\([-a-zA-Z]+\\)" "xml-\\1")
31 ;(list "www-\\([-a-zA-Z]+\\)" "www-\\1")
32 ;(to "w3c-\\(xsl-wg\\|format\\|i18n-ig\\)" "w3c-xsl")
33 ;(to "w3t-\\([-a-zA-Z]+\\)" "w3t-\\1")
34 ;(to "team-\\([-a-zA-Z]+\\)" "w3-team-\\1")
35 ;(to "w3c-\\([-a-zA-Z]+\\)" "w3c-\\1")
36 ;(to "xml-\\([-a-zA-Z]+\\)" "w3c-\\1")
37 ;(to "member-\\([-a-zA-Z]+\\)" "w3-member-\\1")
38 ;(to "ercim-\\([-a-zA-Z]+\\)" "ercim-\\1")
39 ;(to "w3t" "w3t")
40 ))
41
42 (setq w3c-lists2
43 '((to "w3t-archive" "w3t-archive")
44 (to "w3c-archive" "w3c-archive")))
45
46 (setq xml-lists1
47 '(;(to "xml-uri" "nsuri")
48 (to ".*editor.*" "xml-rec-comments")
49 (to "xml-dev" "xml")
50 (to "xsl-list" "xsl")
51 ;(to "[Xx]emacs[- ]beta" "xemacs")
52 (to "xmlschema-dev" "schema-dev")
53 (to "xproc-dev" "xproc-dev")
54 ;(to "xml-sig" "xml-python")
55 ;(to "xml-plenary" "xml-plenary")
56 ))
57
58 (setq xml-lists2
59 '((list "ietf-xml-mime\\.imc\\.org" "xml-mime")
60 (list "xml-mime\\.ietf\\.org" "xml-mime")))
61
62 (setq misc-list1
63 '(;(from "w3t-\\([a-zA-Z]+\\)-request" "w3t-\\1")
64 ;(from "w3c-\\([a-zA-Z]+\\)-request" "w3c-\\1")
65 ;(from "xml-\\([a-zA-Z]+\\)-request" "xml-\\1")
66 ;(from "p.woolman" "nhs-xml")
67 (from "Cron Daemon" "cron")
68 (from ".*@mail.gumtree.com" "personal")
69 (from ".*@postman.storyworth.com" "storyworth")
70 ;(from "\\(Richard\\.Kirkham\\|rachel\\.johnson\\|maria\\.papadaki\\|marisol\\.leonen\\|sangeeta\\.tewar\\|abdullah\\.alshamsi\\|.*@buid\\.ac\\.ae\\)" "buid")
71 (to "www-tag" "tag")
72 ;(to "webarch@noreply.github.com" "tag")
73 ;(to "dashboard-hackers" "beagle")
74 ;(to "pellet-users" "pellet")
75 (to "tkinter-discuss" "tkinter")
76 ;(to "sdp-students" "sdp")
77 (to "fnlp-students" "fnlp")
78 ;(from "fox@tardis\\.ed\\.ac\\.uk\\|s1505551" "fnlp")
79 ;(to "anlp-students" "anlp")
80 ;(from "nbnotifications" "anlp")
81 ;(: split-on-whole-field "Subject" "Re: MSc Project 18.*" "msc18")
82 ;(: split-on-whole-field "Subject" ".*\\(FNLP\\|100782021\\).*" "fnlp")
83 ;(: split-on-whole-field "Subject" ".*SDP \\(MS .\\|final\\) evaluation" "sdpEval")
84 ;(: split-on-whole-field "Subject" ".*[[]SDP[]] \\(Your evaluation\\|Evaluation deadline\\).*" "sdpEval")
85 ;(: split-on-whole-field "Subject" ".*SDP.*" "sdp")
86 ;(: split-on-whole-field "Subject" ".*Welcome to ANLP, action needed.*" "anlp_github")
87 (: split-on-whole-field "Subject" ".*\\(ANLP\\|Accelerated Natural Language Processing\\).*" "anlp")
88 (from "ANLP on Piazza" "anlp")
89 ;(from "FNLP on Piazza" "fnlp")
90 (from "alopez\\|learn\\|scohen\\|eponti" "anlp")
91 (from "080202022-3SV1SEM2" "inf1-cg")
92 (from "INFR111252023-4SV1SEM1" "anlp")
93 (from "no-reply@piazza.com" "anlp")
94 (: split-on-whole-field "Subject" ".*Personal Tutor.*" "tutees22")
95 (: split-on-whole-field "Subject" ".*Course Selection.*" "tutees22")
96 ;(: split-on-whole-field "Subject" ".*Sutton Trust.*" "inf-recruit")
97 (: split-on-whole-field "Subject" "mycron .*" "cron")
98 ;(: split-on-whole-field "Subject" "INF1-Cg experiment.*" "cgx_2013")
99 (: split-on-whole-field "Subject" ".*[[]urn[]].*" "urn")
100 (from "\\(106300.457@compuserve.com\\|elizdrummondyoung@gmail.com\\|jcdavey12@btinternet.com\\|andrewdolan@btinternet.com\\|wandbamoyes@btinternet.com\\)" "albertus")
101 (to "corpus-admin" "corpora")
102 (: split-on-whole-field "Subject" ".*Albertus.*" "albertus")
103 (: split-on-whole-field "Subject" ".*\\[corpus-admin\\].*" "corpora")
104 ;(to ".*@\\(hst\\|hthompson\\|henry\\.thompson\\)\\.name" "personal")
105 (from "mikereape@.*" "mikereape")
106 (from "\\(.*@mumble\\.net\\|jar@\\.csail\\.mit\\.edu\\)" "jar")
107 (from ".*@coulters.io" "belford")
108 (from ".*@umega.co.uk" "belford")
109 (to ".*@umega.co.uk" "belford")
110 (: split-on-whole-field "Subject" ".*belford.*" "belford")
111 ))
112
113 (setq quaker-list
114 '((to "quaker-\\(l\\|spectrum\\)" "quaker")
115 ;(to "quaker-b" "quaker-b")
116 ;(to "QuakerBYM" "quaker-b")
117 ;(from "quaker-spectrum-approval" "quaker")
118 ))
119
120 (setq sms-list
121 '(;(from "s1513009@.*" "ug4_18");\\|s1536017\\(s1443062\\|s1679328
122 ;(from "Y.Chen-258@.*" "msc_19")
123 ;(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")
124 (from "\\(s1895309\\|s1765180\\|s1764494\\|s1645474\\|s1953043\\|s1651774\\|s1732316\\|s1742667\\)@.*" "tutees20")
125 ))
126
127 (defalias 'tut20 (read-kbd-macro
128 "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"))
129
130 ;;; groups only, comes _after_ split to pers-... for to: ht...
131 (setq misc-list2
132 '(;(to "cogsci.general" "junk")
133 (from "anrdaemon@yandex.ru\\|gsenopu@gmail.com\\|pradeepan88@hotmail.com" "anr-doom")
134 ;(to "bp-people" "bp-people")
135 ;(to "ppelders" "ppelders")
136 ;(to "7vtw" "7vtw")
137 (to "\\(apps-review\\|uri-review\\|apps-discuss\\|discuss\\|architecture-discuss\\|appsdir\\|art\\)@[a-z.]*\\(ietf\\|iab\\).org" "ietf")
138 (to "urn@ietf.org" "urn")
139 (to "if-people" "if-people")
140 (to "maptask" "maptask")
141 ;(to "i18n-sig" "xml-python")
142 ;(to "spec-prod" "spec-prod")
143 ;(to "markup" "markup")
144 ;(to "system-notices" "w3c-sys-notes")
145 (to "[cC]ygwin" "cygwin")
146 ;(to "jde@sunsite.dk" "jde")
147 ;(to "jdee-users@lists.sourceforge.net" "jde")
148 (to "tagsoup-friends@yahoogroups.com" "tagsoup")
149 (to "screen-users@gnu.org" "screen")
150 (from "mailinglist@edinburghrc.co.uk" "erc")
151 (to "selenium-users" "selenium")
152 (to "python-list@python.org" "python")
153 ;(to "ding" "gnus")
154 ;(to "dssslist" "dsssl")
155 ;(to "TEI-L" "tei")
156 (to "\\(announcements\\|unicode\\)@.*[.]unicode[.]org" "unicode")
157 ;(to "squid-users@lists.squid-cache.org\\|squid-users@squid-cache.org"
158 ; "squid")
159 (to "exist-open" "exist")
160 (list "ilcc-\\([a-zA-Z]+\\)" "ilcc-\\1")
161 (to "ilcc" "ilcc")
162 (to ".*lecturers@inf.ed.ac.uk" "inf-teach")
163 (to "\\(aisyllabus\\|acstaff\\)" "inf-teach")
164 (to "\\(inf\\)?\\(pg\\|msc\\|teach\\|res\\|staff\\)\@inf\\(ormatics\\)?"
165 "inf-\\2" )
166 ;(to "directors-of-studies" "inf-dos")
167 (to "common-crawl@googlegroups.com" "ccrawl")
168 ;(list "inkscape-user\\|openbox\\|ffmpeg-user" "misc-list")
169 ))
170
171 (defconst ht-spam-res '("bfSPAM" "boSPAM" "edSPAM" "saSPAM" "slSPAM"))
172
173 (setq nnmail-split-fancy
174 '(|
175 (to "ht\\+d@inf\\.ed\\.ac\\.uk" "_diary")
176 (!
177 (lambda (sres)
178 (cond
179 ((or (equal (car sres) "notSPAM")
180 (white-spam t))
181 ;; documentation is wrong, no recursion,
182 ;; so we do it ourselves :-(
183 (message "was %s, trying further" sres)
184 (setq sres (nnmail-split-it ht-compiled-split))
185 (log-good-sender sres)
186 sres)
187 ((member (car sres) ht-spam-res)
188 sres)
189 (t ; shouldn't happen!
190 (message "Shouldn't happen in nnmail-split-fancy %s" sres)
191 sres))
192 )
193 (| (: split-on-whole-field "Subject" ".*=\\?UTF-8\\(\\?B\\\?\\|.*=[A-F][0-9]=\\).*\\?=.*" "slSPAM")
194 ("X-Bogosity" "Yes.*"
195 (|
196 (From ".*@.*ed\.ac\.uk" "edSPAM") ; NB From not from
197 ("X-Spam-Score" "0" "boSPAM")
198 "bfSPAM"))
199 (: split-on-whole-field "X-Spam-Level" "\\*\\*\\*\\*.*"
200 "saSPAM")
201 ("X-Spam-Status" "Yes.*" "saSPAM")
202 "notSPAM"))))
203
204 (defun set-ht-compiled-split ()
205 "update the mail splitting rules"
206 (interactive)
207 (setq ht-compiled-split
208 (let* ((month
209 (format-time-string "%Y-%m" (current-time)))
210 (now-group (concat "group-" month))
211 (now-pers (concat "pers-" month)))
212 `(|
213 (: split-on-whole-field "Subject" "testing" "junk")
214 (: ad-spam "adverts")
215 ;;; ("Content-Type" content-spam "gnSPAM")
216 ;;; ("Content-Transfer-Encoding" encoding-spam "gnSPAM")
217 ;;; (: split-on-whole-subj 'subject-spam "gnSPAM")
218 ;; Special to people who use Yahoo
219 ;;; ("X-YahooFilteredBulk" ".*" "gnSPAM")
220 ;;; (from author-spam "gnSPAM")
221 ;; A subject with no letters is SPAM
222 ;;; (: split-on-whole-subj "^[^a-zA-Z]+$" "gnSPAM")
223 ;; It would be cool to check the
224 ;; date and toss it if it is "old"
225 (to "\\(w3[ct]\\|www\\|team\\|member\\|public\\|ercim\\)[^ ]*@.*"
226 (| ,@w3c-lists1
227 (to "ht\\|henry\\|\\(h\\.?\\)?thompson?" ,now-pers)
228 ,@w3c-lists2
229 (to "x.*@.*" (| ,@xml-lists1
230 (to "ht\\|henry\\|\\(h\\.?\\)?thompson?" ,now-pers)
231 ,@xml-lists2
232 ,now-group))))
233 (to "x.*@.*" (| ,@xml-lists1
234 (to "ht\\|henry\\|\\(h\\.?\\)?thompson?" ,now-pers)
235 ,@xml-lists2))
236 ,@misc-list1
237 (to "ht\\|henry\\|\\(h\\.?\\)?thompson?"
238 (| (from ".*@sms.ed.ac.uk" (|
239 ,@sms-list
240 ,now-pers))
241
242 ,now-pers))
243 (to "quaker.*" (|
244 ,@quaker-list
245 ,now-group))
246 ,@misc-list2
247 ,now-group
248 ))))
249
250 (defun quaker-sig-maybe ()
251 (save-excursion
252 (goto-char (point-max))
253 (search-backward "\n-- \n")
254 (when (looking-at "\n-- \n Henry")
255 (forward-char 5)
256 (kill-entire-line 6)
257 (insert-file "/afs/inf.ed.ac.uk/user/h/ht/.quaker-sig"))))
258
259 (defun straight-to-diary ()
260 (save-excursion
261 (gnus-group-jump-to-group "nnml+ht:_diary")
262 (message "s1 %s" (get-text-property (point) 'gnus-group))
263 (gnus-group-select-group)
264 (while (gnus-summary-first-unread-article)
265 (let ((sco (get-buffer "*Shell Command Output*")))
266 (if sco
267 (kill-buffer sco)))
268 (gnus-edit-and-move-to-diary '(16 . t)))
269 (gnus-summary-exit)
270 )
271 )