diff options
author | jao <jao@gnu.org> | 2022-07-02 00:56:33 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-07-02 01:08:55 +0100 |
commit | 195a366fe64d38f6b6332e80fc5dec8469b89982 (patch) | |
tree | c8ef367479000ebe6c1eb32b75adb92e3f39618a /attic/misc.el | |
parent | fa039163ec824f1678965588ebee8fe25ed362f8 (diff) | |
download | elibs-195a366fe64d38f6b6332e80fc5dec8469b89982.tar.gz elibs-195a366fe64d38f6b6332e80fc5dec8469b89982.tar.bz2 |
attic
Diffstat (limited to 'attic/misc.el')
-rw-r--r-- | attic/misc.el | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/attic/misc.el b/attic/misc.el index e394490..76a2220 100644 --- a/attic/misc.el +++ b/attic/misc.el @@ -163,3 +163,23 @@ (with-eval-after-load "jao-afio" (add-hook 'jao-afio-switch-hook #'jao-gnus--first-group)) + +;;;; remove HTML from From contents (arxiv with r2e) +(require 'shr) +(defvar jao-gnus--from-rx + (concat "From: \\\"?\\( " jao-gnus--news-rx "\\)")) + +(defun jao-gnus-remove-anchors () + (save-excursion + (goto-char (point-min)) + (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) |