Skip to content

Instantly share code, notes, and snippets.

@hober
Last active May 17, 2017 15:10
Show Gist options
  • Save hober/8861cc2eddb633a2bb28233c40e14862 to your computer and use it in GitHub Desktop.
Save hober/8861cc2eddb633a2bb28233c40e14862 to your computer and use it in GitHub Desktop.
(defun tess-mangle-gmane-archival-gnus-data (link)
"Mangle the `gnus-data' property value LINK.
Specifically, change the archival URL from permalink.gmane.org (Gmane's
blog-like interface) to article.gmane.org (Gmane's newslike interface)."
(let ((original-date (get-text-property 5 'original-date link))
(face (get-text-property 5 'face link)))
(propertize (replace-regexp-in-string "permalink.gmane.org"
"article.gmane.org"
(substring-no-properties link))
'face face 'original-date original-date)))
(defun tess-mangle-gmane-archival-header ()
"Mangle Gmane's Archived-At header to be more useful.
Specifically, change the archival URL from permalink.gmane.org (Gmane's
blog-like interface) to article.gmane.org (Gmane's newslike interface)."
(gnus-with-article-headers
(when (gnus-article-goto-header "Archived-At")
(save-excursion
(alter-text-property (+ 2 (point)) (1- (line-end-position))
'gnus-data
'tess-mangle-gmane-archival-gnus-data))
(when (re-search-forward "permalink.gmane.org"
(line-end-position) t)
(replace-match (propertize "article.gmane.org"
'face 'gnus-header-content))))))
(add-hook 'gnus-article-prepare-hook 'tess-mangle-gmane-archival-header)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment