From 1fac3e95c3c7b83018130af8eaf0060f69961548 Mon Sep 17 00:00:00 2001 From: jao Date: Sat, 2 Jul 2022 00:56:33 +0100 Subject: attic --- attic/misc.el | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'attic') diff --git a/attic/misc.el b/attic/misc.el index e394490..038072b 100644 --- a/attic/misc.el +++ b/attic/misc.el @@ -122,6 +122,12 @@ (message "%s = %s" v (format-time-string "%Y-%m-%d %H:%M:%S" (seconds-to-time (/ v 1000.0)))))) +;;; twtxt +(use-package twtxt + :ensure t + :init (setq twtxt-file (expand-file-name "~/doc/jao.io/twtxt") + twtxt-following + '(("yarn" "https://twtxt.net/user/news/twtxt.txt")))) ;;; gnus bits (jao-transient-major-mode gnus-group @@ -163,3 +169,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) -- cgit v1.2.3