From 6079222add3c45418a899d50cdd1f06eeeb28d43 Mon Sep 17 00:00:00 2001 From: jao Date: Wed, 9 Mar 2022 20:40:18 +0000 Subject: gnus address cleaning also in article buffer --- gnus.org | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'gnus.org') diff --git a/gnus.org b/gnus.org index aee07d4..a907ccf 100644 --- a/gnus.org +++ b/gnus.org @@ -493,10 +493,11 @@ " ")))) (defconst jao-gnus--news-rx - (regexp-opt '("ElDiaro.es " - "ElDiario.es - ElDiario.es: " - "The Guardian: " - "Aeon | a world of ideas: "))) + (concat (regexp-opt '("ElDiaro.es " + "ElDiario.es - ElDiario.es: " + "The Guardian: " + "Aeon | a world of ideas: ")) + "\\|unofficial mirror of [^:]+: ")) (defun gnus-user-format-function-f (headers) (let* ((from (gnus-header-from headers)) @@ -644,18 +645,22 @@ mm-discouraged-alternatives nil ;; '("text/html" "text/richtext") mm-inline-large-images 'resize) - ;; no html in From: (washing articles from arxiv feeds) + ;; no html in From: (washing articles from arxiv feeds) and cleaning up + ;; addresses (require 'shr) + (defvar jao-gnus--from-rx (concat "From: \\\"?\\( " jao-gnus--news-rx "\\)")) (defun jao-gnus-remove-anchors () (save-excursion (goto-char (point-min)) - (when (re-search-forward "[gq].+ updates on arXiv.org: " nil t) - (replace-match "") - (let ((begin (point))) - (when (re-search-forward "^\\(To\\|Subject\\):" nil t) - (beginning-of-line) - (let ((shr-width 10000)) - (shr-render-region begin (1- (point))))))))) + (cond ((re-search-forward jao-gnus--from-rx nil t) + (replace-match "" nil nil nil 1)) + ((re-search-forward "[gq].+ updates on arXiv.org: " nil t) + (replace-match "") + (let ((begin (point))) + (when (re-search-forward "^\\(To\\|Subject\\):" nil t) + (beginning-of-line) + (let ((shr-width 10000)) + (shr-render-region begin (1- (point)))))))))) (add-hook 'gnus-part-display-hook 'jao-gnus-remove-anchors) (defvar-local jao-gnus--images-p nil) -- cgit v1.2.3