diff options
-rw-r--r-- | custom/jao-custom-gnus.el | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el index 47883c3..2256603 100644 --- a/custom/jao-custom-gnus.el +++ b/custom/jao-custom-gnus.el @@ -1,6 +1,5 @@ ;; gnus configuration -*- lexical-binding: t -*- - ;;; Feature switching vars (defvar jao-gnus-use-local-imap nil) (defvar jao-gnus-use-leafnode nil) @@ -489,12 +488,18 @@ "The Guardian: " "Aeon | a world of ideas: " ": <author>")) - "\\|unofficial mirror of [^:]+: ")) + "\\|[gq].+ updates on arXiv.org: ")) (defun gnus-user-format-function-f (headers) (let* ((from (gnus-header-from headers)) - (from (gnus-summary-extract-address-component from))) - (replace-regexp-in-string jao-gnus--news-rx "" from))) + (from (gnus-summary-extract-address-component from)) + (from (replace-regexp-in-string jao-gnus--news-rx "" from))) + (if (string-prefix-p "<a " from) + (with-temp-buffer + (insert from) + (let ((shr-width 100000)) (shr-render-buffer (current-buffer))) + (buffer-string)) + from))) (setq gnus-user-date-format-alist '(((gnus-seconds-today) . "%H:%M") @@ -660,20 +665,21 @@ (defvar jao-gnus--from-rx (concat "From: \\\"?\\( " jao-gnus--news-rx "\\)")) -(defun jao-gnus-remove-anchors () +(defun jao-gnus-format-from () (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) + (cond ((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)))))))))) + (shr-render-region begin (1- (point))) + (replace-string-in-region "\"" "" (- begin 1)))))) + ((re-search-forward jao-gnus--from-rx nil t) + (replace-match "" nil nil nil 1))))) -(add-hook 'gnus-part-display-hook 'jao-gnus-remove-anchors) +(add-hook 'gnus-part-display-hook 'jao-gnus-format-from) ;;;; follow links and enclosures (defun jao-gnus-follow-link (&optional external) |