changeset 5:8e0e16f4763c

tweaks, over quite a stretch of time ...
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Fri, 06 Oct 2023 19:01:47 +0100
parents 18db20bcc65b
children 129123962e51
files shared/common-init.el shared/diary.el shared/gnus-init.el
diffstat 3 files changed, 41 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
Binary file shared/common-init.el has changed
--- a/shared/diary.el	Sat Sep 17 11:17:31 2022 +0100
+++ b/shared/diary.el	Fri Oct 06 19:01:47 2023 +0100
@@ -221,8 +221,8 @@
     (gnus-summary-mail-forward 1)
     (message "Begin forward. . .")
     (goto-char (point-min))
-    (search-forward "^To: " nil t)
-    (forward-char 4)
+    (re-search-forward "^To: " nil t)
+    ;(forward-char 4)
     (insert "htcalendar@markup.co.uk")
     (search-forward "------ Start of forwarded")
     (save-excursion
--- a/shared/gnus-init.el	Sat Sep 17 11:17:31 2022 +0100
+++ b/shared/gnus-init.el	Fri Oct 06 19:01:47 2023 +0100
@@ -133,18 +133,20 @@
 	;(to "anlp-students" "anlp")
 	;(from "nbnotifications" "anlp")
 	;(: split-on-whole-field "Subject" "Re: MSc Project 18.*" "msc18")
-	(: split-on-whole-field "Subject" ".*\\(FNLP\\|100782021\\).*" "fnlp")
+	;(: split-on-whole-field "Subject" ".*\\(FNLP\\|100782021\\).*" "fnlp")
 	;(: split-on-whole-field "Subject" ".*SDP \\(MS .\\|final\\) evaluation" "sdpEval")
 	;(: split-on-whole-field "Subject" ".*[[]SDP[]] \\(Your evaluation\\|Evaluation deadline\\).*" "sdpEval")
 	;(: split-on-whole-field "Subject" ".*SDP.*" "sdp")
 	;(: split-on-whole-field "Subject" ".*Welcome to ANLP, action needed.*" "anlp_github")
-	;(: split-on-whole-field "Subject" ".*ANLP.*" "anlp")
-	;(from "ANLP on Piazza" "anlp")
+	(: split-on-whole-field "Subject" ".*\\(ANLP\\|Accelerated Natural Language Processing\\).*" "anlp")
+	(from "ANLP on Piazza" "anlp")
 	;(from "FNLP on Piazza" "fnlp")
-	(from "ititov\\|v.dankers\\|m.m.lindemann" "fnlp")
-	;(from "no-reply@piazza.com" "anlp")
-	(: split-on-whole-field "Subject" ".*Personal Tutor.*" "tutees20")
-	(: split-on-whole-field "Subject" ".*Course Selection.*" "tutees20")
+	(from "alopez\\|learn\\|scohen\\|eponti" "anlp")
+	(from "080202022-3SV1SEM2" "inf1-cg")
+	(from "INFR111252023-4SV1SEM1" "anlp")
+	(from "no-reply@piazza.com" "anlp")
+	(: split-on-whole-field "Subject" ".*Personal Tutor.*" "tutees22")
+	(: split-on-whole-field "Subject" ".*Course Selection.*" "tutees22")
 	;(: split-on-whole-field "Subject" ".*Sutton Trust.*" "inf-recruit")
 	(: split-on-whole-field "Subject" "mycron .*" "cron")
 	;(: split-on-whole-field "Subject" "INF1-Cg experiment.*" "cgx_2013")
@@ -201,6 +203,7 @@
 	(to "screen-users@gnu.org" "screen")
 	(from "mailinglist@edinburghrc.co.uk" "erc")
 	(to "selenium-users" "selenium")
+	(to "python-list@python.org" "python")
 	;(to "ding" "gnus")
 	;(to "dssslist" "dsssl")
 	;(to "TEI-L" "tei")
@@ -231,6 +234,7 @@
 	     (now-pers (concat "pers-" month)))
 	`(|
 	  (: split-on-whole-field "Subject" "testing" "junk")
+	  (: ad-spam "adverts")
 ;;;	  ("Content-Type" content-spam "gnSPAM")
 ;;;	  ("Content-Transfer-Encoding" encoding-spam "gnSPAM")
 ;;;	  (: split-on-whole-subj 'subject-spam "gnSPAM")
@@ -268,28 +272,41 @@
 
 (set-ht-compiled-split)
 
+(defconst ht-spam-res '("bfSPAM" "boSPAM" "edSPAM" "saSPAM" "slSPAM"))
+
 (setq nnmail-split-fancy
-      '(!
+      '(|
+	(to "ht\\+d@inf\\.ed\\.ac\\.uk" "_diary")
+        (!
 	(lambda (sres)
-	  (if (or (equal (car sres) "notSPAM")
-		  (equal (car sres) "waSPAM"))
-		;; documentation is wrong, no recursion,
-		;; so we do it ourselves :-(
-		(nnmail-split-it ht-compiled-split)
-	      sres))
-	(| (to "ht\\+d@inf\\.ed\\.ac\\.uk" "_diary")
-	     (: ad-spam "adverts")
-	     (: split-on-whole-field "Subject" ".*=\\?UTF-8\\(\\?B\\\?\\|.*=[A-F][0-9]=\\).*\\?=.*" "slSPAM")
-	     (: white-spam "waSPAM")
+	  (cond
+	   ((or (equal (car sres) "notSPAM")
+		(white-spam t))
+	    ;; documentation is wrong, no recursion,
+	    ;; so we do it ourselves :-(
+	    (message "was %s, trying further" sres)
+	    (setq sres (nnmail-split-it ht-compiled-split))
+	    (log-good-sender sres)
+	    sres)
+	   ((member (car sres) ht-spam-res)
+	    sres)
+	   (t ; shouldn't happen!
+	    (message "Shouldn't happen in nnmail-split-fancy %s" sres)
+	    sres))
+	  )
+	(| (: split-on-whole-field "Subject" ".*=\\?UTF-8\\(\\?B\\\?\\|.*=[A-F][0-9]=\\).*\\?=.*" "slSPAM")
 	     ("X-Bogosity" "Yes.*"
 	      (| 
-	       (From ".*ed\.ac\.uk" "edSPAM") ; NB From not from
+	       (From ".*@.*ed\.ac\.uk" "edSPAM") ; NB From not from
 	       ("X-Spam-Score" "0" "boSPAM")
 	       "bfSPAM"))  
 	     (: split-on-whole-field "X-Spam-Level" "\\*\\*\\*\\*.*"
 		"saSPAM")
 	     ("X-Spam-Status" "Yes.*" "saSPAM")
-	     "notSPAM")))
+	     "notSPAM"))))
+
+(defun log-good-sender (sres)
+  (message "good sender %s with result %s" (get-from-gnus-addr) sres))
 
 (setq gnus-show-mime t) ; stale
 (setq mml1991-use 'pgg
@@ -303,7 +320,8 @@
 
 (defun straight-to-diary ()
   (save-excursion
-    (gnus-group-goto-group "nnml+ht:_diary")
+    (gnus-group-jump-to-group "nnml+ht:_diary")
+    (message "s1 %s" (get-text-property (point) 'gnus-group))
     (gnus-group-select-group)
     (while (gnus-summary-first-unread-article)
       (let ((sco (get-buffer "*Shell Command Output*")))