# HG changeset patch # User Henry S. Thompson # Date 1663408900 -3600 # Node ID 0a81352bd7d0d56084c33ac27295154e6176bbeb # Parent dd557432d84681b808c5870aa4b6efcc9b2adf3c catch up diff -r dd557432d846 -r 0a81352bd7d0 lucid/my-news.el --- a/lucid/my-news.el Mon Feb 08 12:29:18 2021 +0000 +++ b/lucid/my-news.el Sat Sep 17 11:01:40 2022 +0100 @@ -129,7 +129,7 @@ (search-backward "\n-- \n") (when (looking-at "\n-- \n Henry") (forward-char 5) - (kill-entire-line 5) + (kill-entire-line 6) (insert-file "/afs/inf.ed.ac.uk/user/h/ht/.quaker-sig")))) (defun kill-white () diff -r dd557432d846 -r 0a81352bd7d0 shared/common-init.el Binary file shared/common-init.el has changed diff -r dd557432d846 -r 0a81352bd7d0 shared/diary.el --- a/shared/diary.el Mon Feb 08 12:29:18 2021 +0000 +++ b/shared/diary.el Sat Sep 17 11:01:40 2022 +0100 @@ -208,7 +208,9 @@ (defun gnus-edit-and-move-to-diary (&optional no-delete) "try to add a date to subject field, move to diary on exit" (interactive "P") - (when (gnus-group-read-only-p) + (let ((flush-shell nil)) + (when (and (not (and no-delete (cdr no-delete))) + (gnus-group-read-only-p)) (error "The current newsgroup does not support article editing")) ;; Select article if needed. (unless (eq (gnus-summary-article-number) @@ -223,24 +225,44 @@ (forward-char 4) (insert "htcalendar@markup.co.uk") (search-forward "------ Start of forwarded") + (save-excursion + (when (and (bufferp (get-buffer "*Shell Command Output*")) + (not (re-search-forward + "^--0000.*[[:space:]]*Content-Type: text/plain" nil t nil + (get-buffer " *Original Article*"))) + (search-forward "[[:space:]]*") + (exchange-point-and-mark) + (use-text-not-html t) + (let ((pos (point))) + (when (search-backward "type=text/html" nil t) + (replace-match "type=text/plain") + (goto-char (+ pos 1)))) + (setq flush-shell t) + )) (let (sublp) (save-excursion - (let ((try-date - (and - (or (re-search-forward "^\r?$" nil 1) t) - (re-search-forward - "[0-9][-0-9 ]*[- ][jfmasondJFMASOND][a-zA-Z]*[- 0-9]*" - (save-excursion (search-forward "\n--\n" nil t)) - t) - (buffer-substring (match-beginning 0)(match-end 0))))) - (goto-char (point-min)) - (setq sublp (search-forward "Subject: " nil t)) - (delete-region (point)(progn (search-forward "] " nil t))) - (message (format "date: |%s| %s" try-date sublp)) - (if (and sublp - try-date) - (progn (set-mark (point)) - (insert try-date))))) + (goto-char (point-min)) + (setq sublp (search-forward "Subject: " nil t)) + (delete-region (point)(progn (search-forward "] " nil t))) + (if (not + (looking-at "[123]?[0-9] [JFMASOND][a-z][a-z] (20)?[2-9][0-9] ")) + (save-excursion + (let ((try-date + (and + (or (re-search-forward "^\r?$" nil 1) t) + (re-search-forward + "[0-9][-0-9 ]*[- ][jfmasondJFMASOND][a-zA-Z]*[- 0-9]*" + (save-excursion (search-forward "\n--\n" nil t)) + t) + (buffer-substring (match-beginning 0)(match-end 0))))) + (message (format "date: |%s| %s" try-date sublp)) + (if (and sublp + try-date) + (progn (set-mark (point)) + (insert try-date))))))) (make-local-hook 'message-send-hook) (if (and no-delete (equal (car no-delete) 16)) (let ((hook '(lambda () @@ -249,11 +271,14 @@ (add-hook 'message-send-hook hook nil t) (message-send-and-exit) - (if (not (gnus-summary-next-unread-article)) - (gnus-summary-exit))) + (if (cdr no-delete) + ;; called directly from splitting an ht+d message... + "_doom" + (if (not (gnus-summary-next-unread-article)) + (gnus-summary-exit)))) (add-hook 'message-send-hook `(lambda () - (ht-gnus-cease-edit ',no-delete) + (ht-gnus-cease-edit ',no-delete ',flush-shell) ; (gnus-summary-edit-article-done ; ,(or (mail-header-references gnus-current-headers) "") ; ,(gnus-group-read-only-p) ,gnus-summary-buffer nil) @@ -262,15 +287,16 @@ ; (search-forward "\nSubject: " nil t)) ) nil t) - (split-window-vertically 6) + (split-window-vertically 6) (other-window 1) (search-forward "\n\n" nil t) (other-window 1) (goto-char sublp) (message "Exiting to buffer, we hope"))) + ) ) -(defun ht-gnus-cease-edit (&optional no-delete) +(defun ht-gnus-cease-edit (&optional no-delete flush-shell) "check if diary edit, move if so" (interactive "P") (message "ceasing. . .") @@ -280,13 +306,17 @@ ) (unless no-delete (with-current-buffer gnus-summary-buffer - (gnus-summary-delete-article))) + (gnus-summary-move-article 1 "nnml+ht:_doom"))) (if (get-buffer "diary.babyl-summary") (kill-buffer "diary.babyl-summary")) (with-current-buffer "diary.babyl" (rmail-mode) (save-buffer) (ht-rmail-summarise)) + (if flush-shell + (let ((sb (get-buffer "*Shell Command Output*"))) + (if (bufferp sb) + (kill-buffer sb)))) (message "ceased")) (defun ht-gnus-summary-save-in-diary (&optional filename) diff -r dd557432d846 -r 0a81352bd7d0 shared/gnus-init.el --- a/shared/gnus-init.el Mon Feb 08 12:29:18 2021 +0000 +++ b/shared/gnus-init.el Sat Sep 17 11:01:40 2022 +0100 @@ -130,17 +130,18 @@ ;(to "sdp-students" "sdp") (to "fnlp-students" "fnlp") ;(from "fox@tardis\\.ed\\.ac\\.uk\\|s1505551" "fnlp") - (to "anlp-students" "anlp") + ;(to "anlp-students" "anlp") ;(from "nbnotifications" "anlp") ;(: split-on-whole-field "Subject" "Re: MSc Project 18.*" "msc18") - (: split-on-whole-field "Subject" ".*FNLP.*" "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" ".*Welcome to ANLP, action needed.*" "anlp_github") + ;(: split-on-whole-field "Subject" ".*ANLP.*" "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") @@ -169,9 +170,9 @@ )) (setq sms-list - '((from "s1513009@.*" "ug4_18");\\|s1536017\\(s1443062\\|s1679328 + '(;(from "s1513009@.*" "ug4_18");\\|s1536017\\(s1443062\\|s1679328 ;(from "Y.Chen-258@.*" "msc_19") - (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") + ;(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") (from "\\(s1895309\\|s1765180\\|s1764494\\|s1645474\\|s1953043\\|s1651774\\|s1732316\\|s1742667\\)@.*" "tutees20") )) @@ -203,7 +204,7 @@ ;(to "ding" "gnus") ;(to "dssslist" "dsssl") ;(to "TEI-L" "tei") - (to "\\(announcements\\|unicode\\)@unicode.org" "unicode") + (to "\\(announcements\\|unicode\\)@.*[.]unicode[.]org" "unicode") ;(to "squid-users@lists.squid-cache.org\\|squid-users@squid-cache.org" ; "squid") (to "exist-open" "exist") @@ -272,21 +273,23 @@ (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)) - (| (: ad-spam "adverts") - (: white-spam "waSPAM") - ("X-Bogosity" "Yes.*" - (| + ;; 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.*=[A-F][0-9]=.*\\?=.*" "slSPAM") + (: white-spam "waSPAM") + ("X-Bogosity" "Yes.*" + (| (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"))) + (: split-on-whole-field "X-Spam-Level" "\\*\\*\\*\\*.*" + "saSPAM") + ("X-Spam-Status" "Yes.*" "saSPAM") + "notSPAM"))) (setq gnus-show-mime t) ; stale (setq mml1991-use 'pgg @@ -298,6 +301,19 @@ (custom-set-faces) +(defun straight-to-diary () + (save-excursion + (gnus-group-goto-group "nnml+ht:_diary") + (gnus-group-select-group) + (while (gnus-summary-first-unread-article) + (let ((sco (get-buffer "*Shell Command Output*"))) + (if sco + (kill-buffer sco))) + (gnus-edit-and-move-to-diary '(16 . t))) + (gnus-summary-exit) + ) + ) + (add-hook 'gnus-group-mode-hook 'gnus-topic-mode) (add-hook 'gnus-summary-mode-hook 'gnus-summary-mode-fun1) @@ -387,7 +403,10 @@ (add-hook 'gnus-get-new-news-hook (lambda () (setq ht-gnus-just-read nil))) (add-hook 'gnus-after-getting-new-news-hook - (lambda () (message "%s" ht-gnus-just-read))) + (lambda () (progn + (message "%s" ht-gnus-just-read) + (if (member "_diary" ht-gnus-just-read) + (straight-to-diary))))) (add-hook 'nnml-prepare-save-mail-hook (function ht-gnus-note-save-to-group)) diff -r dd557432d846 -r 0a81352bd7d0 shared/mail-extras.el --- a/shared/mail-extras.el Mon Feb 08 12:29:18 2021 +0000 +++ b/shared/mail-extras.el Sat Sep 17 11:01:40 2022 +0100 @@ -450,6 +450,7 @@ ;; see message-citation-line-function in message.el (defun safe-citation () + (use-text-not-html) (when message-reply-headers (let ((from (mail-header-from message-reply-headers))) (cond ((string-match "^\"?\\([^\"]*\\)\"? <.*>$" from) @@ -459,6 +460,19 @@ (t (insert "[anon] writes:\n\n")))))) +(defun use-text-not-html (&optional clear) + (when (and (if clear (looking-at "