Mercurial > hg > xemacs
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/shared/gnus-init.el Mon Feb 08 11:44:37 2021 +0000 @@ -0,0 +1,422 @@ +;; Last edited: Fri Sep 7 12:19:43 2018 +;; gnus customisation + +(setq gnus-novice-user nil) +(setq gnus-message-archive-group + '((concat "general." (format-time-string + "%Y-%m" (current-time))))) + +(setq gnus-summary-ignore-duplicates t + gnus-auto-select-next 'quietly + gnus-save-newsrc-file nil + gnus-read-newsrc-file nil + gnus-save-killed-list nil + gnus-summary-display-arrow nil + gnus-check-new-newsgroups nil + gnus-auto-select-subject 'unseen-or-unread + gnus-your-organization "HCRC, University of Edinburgh" + gnus-buttonized-mime-types '("multipart/signed") + gnus-ignored-headers + "^Errors-To:\\|^Precedence:\\|^UNIX-From:" + gnus-default-directory "/afs/inf.ed.ac.uk/user/h/ht" + nnmail-message-id-cache-file "/disk/scratch/gnus/.nnmail-cache" + mm-discouraged-alternatives '("text/html") + nnmail-expiry-wait 28 + mail-sources + '((file :path "/disk/scratch/mail/ht_mbox")) + mail-source-crash-box "/tmp/crashbox" ; local disk + nndraft-directory "/disk/scratch/drafts/" + message-auto-save-directory "/disk/scratch/drafts/" + message-from-style 'angles + no-select-groups '("nnml+ht:cygwin") + gnus-group-line-format "%M%S%p%P%5y:%uH%(%g%)%l %O +") + +(setq bbdb/news-auto-create-p t) + +(setq wsp-cache nil) + +;;;(setq blacklist-db (open-database "~/.blacklist")) + +(require 'my-news) ; defines db functions + +(open-white) +(open-ad) +(open-quaker) + +(add-hook 'kill-emacs-hook + (lambda () + (if (database-live-p whitelist-db) + (close-database whitelist-db)) + (if (database-live-p quaker-db) + (close-database quaker-db)) + (if (database-live-p adlist-db) + (close-database adlist-db)))) + +(add-hook 'bbdb-complete-name-hooks 'quaker-sig-if-quaker) +(add-hook 'gnus-message-setup-hook 'quaker-sig-if-to-quaker) + +(setq nnmail-crosspost nil) +(setq nnmail-split-methods 'nnmail-split-fancy) + +(setq white-subjects "\\b\\(phd\\|ilcc\\)\\b") + +(setq white-domains (list)) + +(setq ad-domains (list "planetx.co.uk")) + +(setq w3c-lists1 + '((list "w3c-xml-schema-\\([a-zA-Z]+\\)\\(\\.w3\\.org\\)?" "xml-schema-\\1") + (list "chairs\\(\\.w3\\.org\\)?" "w3c-chairs" ) + (to "\\(w3c\\|public\\|member\\)-xml-\\([-a-zA-Z]+\\)\\(\\.w3\\.org\\)?" + "xml-\\2" ) + ;(list "w3t-\\([-a-zA-Z]+\\)\\(\\.w3\\.org\\)?" "w3t-\\1") + ;(list "team-\\([-a-zA-Z]+\\)\\(\\.w3\\.org\\)?" "w3-team-\\1") + ;(list "w3c-\\(xsl-wg\\|format\\|i18n-ig\\)\\(\\.w3\\.org\\)?" "w3c-xsl") + (list "w3c-\\([-a-zA-Z]+\\)\\(\\.w3\\.org\\)?" "w3c-\\1") + (list "member-\\(ac-uk\\|access\\)" "w3-member-\\1");[-a-zA-Z]+\\) + (to "public-xpointer-registry\\(-request\\)?" + "xpointer-registry");[-a-zA-Z]+ + (to "public-\\([-a-zA-Z]+\\)" "w3-public-\\1") + (to "w3c-xml-schema-\\([a-zA-Z]+\\)" "xml-schema-\\1") + (to "chairs" "w3c-chairs") + (to "w3c-xml-\\([-a-zA-Z]+\\)" "xml-\\1" ) + (to "www-xml-\\([-a-zA-Z]+\\)" "xml-\\1") + ;(list "www-\\([-a-zA-Z]+\\)" "www-\\1") + ;(to "w3c-\\(xsl-wg\\|format\\|i18n-ig\\)" "w3c-xsl") + ;(to "w3t-\\([-a-zA-Z]+\\)" "w3t-\\1") + ;(to "team-\\([-a-zA-Z]+\\)" "w3-team-\\1") + ;(to "w3c-\\([-a-zA-Z]+\\)" "w3c-\\1") + ;(to "xml-\\([-a-zA-Z]+\\)" "w3c-\\1") + ;(to "member-\\([-a-zA-Z]+\\)" "w3-member-\\1") + ;(to "ercim-\\([-a-zA-Z]+\\)" "ercim-\\1") + ;(to "w3t" "w3t") + )) + +(setq w3c-lists2 + '((to "w3t-archive" "w3t-archive") + (to "w3c-archive" "w3c-archive"))) + +(setq xml-lists1 + '(;(to "xml-uri" "nsuri") + (to ".*editor.*" "xml-rec-comments") + (to "xml-dev" "xml") + (to "xsl-list" "xsl") + ;(to "[Xx]emacs[- ]beta" "xemacs") + (to "xmlschema-dev" "schema-dev") + (to "xproc-dev" "xproc-dev") + ;(to "xml-sig" "xml-python") + ;(to "xml-plenary" "xml-plenary") + )) + +(setq xml-lists2 + '((list "ietf-xml-mime\\.imc\\.org" "xml-mime") + (list "xml-mime\\.ietf\\.org" "xml-mime"))) + +(setq misc-list1 + '(;(from "w3t-\\([a-zA-Z]+\\)-request" "w3t-\\1") + ;(from "w3c-\\([a-zA-Z]+\\)-request" "w3c-\\1") + ;(from "xml-\\([a-zA-Z]+\\)-request" "xml-\\1") + ;(from "p.woolman" "nhs-xml") + (from "Cron Daemon" "cron") + (from ".*@mail.gumtree.com" "personal") + (from ".*@postman.storyworth.com" "storyworth") + ;(from "\\(Richard\\.Kirkham\\|rachel\\.johnson\\|maria\\.papadaki\\|marisol\\.leonen\\|sangeeta\\.tewar\\|abdullah\\.alshamsi\\|.*@buid\\.ac\\.ae\\)" "buid") + (to "www-tag" "tag") + ;(to "webarch@noreply.github.com" "tag") + ;(to "dashboard-hackers" "beagle") + ;(to "pellet-users" "pellet") + (to "tkinter-discuss" "tkinter") + ;(to "sdp-students" "sdp") + (to "fnlp-students" "fnlp") + ;(from "fox@tardis\\.ed\\.ac\\.uk\\|s1505551" "fnlp") + (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" ".*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") + ;(from "FNLP on Piazza" "fnlp") + ;(from "no-reply@piazza.com" "anlp") + (: split-on-whole-field "Subject" ".*Personal Tutor.*" "tutees20") + (: split-on-whole-field "Subject" ".*Course Selection.*" "tutees20") + ;(: 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") + (: split-on-whole-field "Subject" ".*[[]urn[]].*" "urn") + (from "\\(106300.457@compuserve.com\\|elizdrummondyoung@gmail.com\\|jcdavey12@btinternet.com\\|andrewdolan@btinternet.com\\|wandbamoyes@btinternet.com\\)" "albertus") + (to "corpus-admin" "corpora") + (: split-on-whole-field "Subject" ".*Albertus.*" "albertus") + (: split-on-whole-field "Subject" ".*\\[corpus-admin\\].*" "corpora") + ;(to ".*@\\(hst\\|hthompson\\|henry\\.thompson\\)\\.name" "personal") + (from "mikereape@.*" "mikereape") + (from "\\(.*@mumble\\.net\\|jar@\\.csail\\.mit\\.edu\\)" "jar") + (from ".*@coulters.io" "belford") + (from ".*@umega.co.uk" "belford") + (to ".*@umega.co.uk" "belford") + (: split-on-whole-field "Subject" ".*belford.*" "belford") + )) + +(setq quaker-list + '((to "quaker-\\(l\\|spectrum\\)" "quaker") + ;(to "quaker-b" "quaker-b") + ;(to "QuakerBYM" "quaker-b") + ;(from "quaker-spectrum-approval" "quaker") + )) + +(setq sms-list + '((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 "\\(s1895309\\|s1765180\\|s1764494\\|s1645474\\|s1953043\\|s1651774\\|s1732316\\|s1742667\\)@.*" "tutees20") + )) + +(defalias 'tut20 (read-kbd-macro +"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")) + +;;; groups only, comes _after_ split to pers-... for to: ht... +(setq misc-list2 + '(;(to "cogsci.general" "junk") + (from "anrdaemon@yandex.ru\\|gsenopu@gmail.com\\|pradeepan88@hotmail.com" "anr-doom") + ;(to "bp-people" "bp-people") + ;(to "ppelders" "ppelders") + ;(to "7vtw" "7vtw") + (to "\\(apps-review\\|uri-review\\|apps-discuss\\|discuss\\|architecture-discuss\\|appsdir\\|art\\)@[a-z.]*\\(ietf\\|iab\\).org" "ietf") + (to "urn@ietf.org" "urn") + (to "if-people" "if-people") + (to "maptask" "maptask") + ;(to "i18n-sig" "xml-python") + ;(to "spec-prod" "spec-prod") + ;(to "markup" "markup") + ;(to "system-notices" "w3c-sys-notes") + (to "[cC]ygwin" "cygwin") + ;(to "jde@sunsite.dk" "jde") + ;(to "jdee-users@lists.sourceforge.net" "jde") + (to "tagsoup-friends@yahoogroups.com" "tagsoup") + (to "screen-users@gnu.org" "screen") + (from "mailinglist@edinburghrc.co.uk" "erc") + (to "selenium-users" "selenium") + ;(to "ding" "gnus") + ;(to "dssslist" "dsssl") + ;(to "TEI-L" "tei") + (to "\\(announcements\\|unicode\\)@unicode.org" "unicode") + ;(to "squid-users@lists.squid-cache.org\\|squid-users@squid-cache.org" + ; "squid") + (to "exist-open" "exist") + (list "ilcc-\\([a-zA-Z]+\\)" "ilcc-\\1") + (to "ilcc" "ilcc") + (to ".*lecturers@inf.ed.ac.uk" "inf-teach") + (to "\\(aisyllabus\\|acstaff\\)" "inf-teach") + (to "\\(inf\\)?\\(pg\\|msc\\|teach\\|res\\|staff\\)\@inf\\(ormatics\\)?" + "inf-\\2" ) + ;(to "directors-of-studies" "inf-dos") + (to "common-crawl@googlegroups.com" "ccrawl") + ;(list "inkscape-user\\|openbox\\|ffmpeg-user" "misc-list") + )) + +(defvar ht-compiled-split nil) + +(defun set-ht-compiled-split () + "update the mail splitting rules" + (interactive) + (setq ht-compiled-split + (let* ((month + (format-time-string "%Y-%m" (current-time))) + (now-group (concat "group-" month)) + (now-pers (concat "pers-" month))) + `(| + (: split-on-whole-field "Subject" "testing" "junk") +;;; ("Content-Type" content-spam "gnSPAM") +;;; ("Content-Transfer-Encoding" encoding-spam "gnSPAM") +;;; (: split-on-whole-subj 'subject-spam "gnSPAM") + ;; Special to people who use Yahoo +;;; ("X-YahooFilteredBulk" ".*" "gnSPAM") +;;; (from author-spam "gnSPAM") + ;; A subject with no letters is SPAM +;;; (: split-on-whole-subj "^[^a-zA-Z]+$" "gnSPAM") + ;; It would be cool to check the + ;; date and toss it if it is "old" + (to "\\(w3[ct]\\|www\\|team\\|member\\|public\\|ercim\\)[^ ]*@.*" + (| ,@w3c-lists1 + (to "ht\\|henry\\|\\(h\\.?\\)?thompson?" ,now-pers) + ,@w3c-lists2 + (to "x.*@.*" (| ,@xml-lists1 + (to "ht\\|henry\\|\\(h\\.?\\)?thompson?" ,now-pers) + ,@xml-lists2 + ,now-group)))) + (to "x.*@.*" (| ,@xml-lists1 + (to "ht\\|henry\\|\\(h\\.?\\)?thompson?" ,now-pers) + ,@xml-lists2)) + ,@misc-list1 + (to "ht\\|henry\\|\\(h\\.?\\)?thompson?" + (| (from ".*@sms.ed.ac.uk" (| + ,@sms-list + ,now-pers)) + + ,now-pers)) + (to "quaker.*" (| + ,@quaker-list + ,now-group)) + ,@misc-list2 + ,now-group + )))) + +(set-ht-compiled-split) + +(setq nnmail-split-fancy + '(! + (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.*" + (| + (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"))) + +(setq gnus-show-mime t) ; stale +(setq mml1991-use 'pgg + mml2015-use 'pgg + mm-verify-option 'always) + +(require 'mm-decode) +(setq mm-automatic-display (remove "text/html" mm-automatic-display)) + +(custom-set-faces) + +(add-hook 'gnus-group-mode-hook 'gnus-topic-mode) + +(add-hook 'gnus-summary-mode-hook 'gnus-summary-mode-fun1) + +;;; After hiding pgp, verify the message; +;;; only happens if pgp signature is found. + +;(add-hook 'gnus-article-hide-pgp-hook +; (lambda () +; (save-excursion +; (set-buffer gnus-original-article-buffer) +; (mc-verify)))) + + +(add-hook 'message-mode-hook 'message-mode-fun1) + +(add-hook 'gnus-group-mode-hook 'gnus-group-mode-fun1) +(add-hook 'gnus-select-group-hook 'no-select) + +(add-hook 'gnus-parse-headers-hook + '(lambda () + (gnus-summary-set-local-parameters gnus-newsgroup-name))) + + +;(add-hook 'gnus-summary-mode-hook 'mc-install-read-mode) +;(add-hook 'message-mode-hook 'mc-install-write-mode) +;(add-hook 'news-reply-mode-hook 'mc-install-write-mode) + +;;; Jack Vinson's (partial Fancy mail rules for killing SPAM) +;; Content with any of the following is probably SPAM + +(require 'nnmail) +(if (not (assq 'list nnmail-split-abbrev-alist)) + (setq nnmail-split-abbrev-alist + (cons '(list . "List-Id") nnmail-split-abbrev-alist))) + +(add-hook 'nnmail-split-abbrev-alist + (cons 'content-spam "text/html\\|big5\\|gb2312\\|ks_c_.*\\|euc-kr")) + +;; Encoding with any of the following is probably SPAM +(add-hook 'nnmail-split-abbrev-alist + (cons 'encoding-spam "binary\\|base64")) + +;; These special subjects are SPAM: +;; funny characters, whitespace followed by a string, no letters +;; and any words that are always SPAM +(add-hook 'nnmail-split-abbrev-alist + (cons 'subject-spam ".*\\([\177-\277\367]\\|=\\?big5\\?\\).*")) + +;; Bad authors who still get through all of this +(add-hook 'nnmail-split-abbrev-alist + (cons 'author-spam "explicit\\|amazing")) + +;; from w/o Resent-From +(add-hook 'nnmail-split-abbrev-alist + (cons 'From "from\\|sender")) + +;; And the actual splitting rule +;(setq nnmail-split-fancy +; '(| +; ;; Various mailing lists, match on Subject or Sender headers + ; (from mail "Boing") + ; (any "my_mailing_list@foo.com" "list_group") +; + ; ;; SPAM, SPAM, SPAM + ; ("Content-Type" content-spam "gnSPAM") + ; ("Content-Transfer-Encoding" encoding-spam "gnSPAM") + ; ("Subject" subject-spam "gnSPAM") + ; ;; Special to people who use Yahoo + ; ("X-YahooFilteredBulk" ".*" "gnSPAM") + ; (from author-spam "gnSPAM") + ;; A subject with no letters is SPAM +; ("Subject" "^[^a-zA-Z]+$" "gnSPAM") + ;; It would be cool to check the date and toss it if it is "old" + ;; Several spammers send mail that has ancient dates... + + ;; Additional splitting rules on Subject for convenience. + + ;; Everything else should be coming to me + ; (to "jackvinson" "misc") + + ;; Else it is SPAM + ; "gnSPAM") +; ) + +(add-hook 'message-sent-hook (function whiten-recip)) + +(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))) + +(add-hook 'nnml-prepare-save-mail-hook (function ht-gnus-note-save-to-group)) + +(require 'gnus-art) + +(nconc gnus-treatment-function-alist + '((gnus-treat-strip-uoe-warning gnus-article-strip-uoe-warning))) + +(defun gnus-article-strip-uoe-warning (&optional interactive &rest args) + "redirect for stripping" + (interactive (list t)) + (save-excursion + (set-buffer gnus-article-buffer) + (if interactive + (call-interactively 'article-strip-uoe-warning) + (apply 'article-strip-uoe-warning args)))) + +(defun article-strip-uoe-warning () + "strip the stupid uoe warning" + (interactive) + (save-excursion + (article-goto-body) + (let ((case-fold-search t)) + (when + (looking-at "This email was sent to you by someone outside the University.") + (gnus-delete-line)) + (when + (looking-at "You should only click on links or attachments if you are certain that the email is genuine and the content is safe.") + (gnus-delete-line)) + ))) + +(setq gnus-treat-strip-uoe-warning t)