Skip to content

Instantly share code, notes, and snippets.

@apconole
Last active April 1, 2017 04:42
Show Gist options
  • Save apconole/1e53ca99dd3899b07e5743718a1db300 to your computer and use it in GitHub Desktop.
Save apconole/1e53ca99dd3899b07e5743718a1db300 to your computer and use it in GitHub Desktop.
;; Licensed under the terms of the GNU General Public Agreement
;; Version 2.0 or later
;; This work is derived from the gnus-article-html function in
;; gnus-html.el originally authored by Lars Magne Ingebrigtsen <larsi@gnus.org>
(require 'xwidget)
(defun xw-gnus-article-html (&optional handle)
(let ((article-buffer (current-buffer)))
(unless handle
(setq handle (mm-dissect-buffer t)))
(save-restriction
(narrow-to-region (point) (point))
(save-excursion
(mm-with-part handle
(let* ((coding-system-for-read 'utf-8)
(coding-system-for-write 'utf-8)
(default-process-coding-system
(cons coding-system-for-read coding-system-for-write))
(charset (mail-content-type-get (mm-handle-type handle)
'charset)))
(when (and charset
(setq charset (mm-charset-to-coding-system
charset nil t))
(not (eq charset 'ascii)))
(insert (prog1
(decode-coding-string (buffer-string) charset)
(erase-buffer)
(mm-enable-multibyte))))
(setq tf-handle (make-temp-file "/tmp/test.html"))
(write-region (point-min) (point-max) tf-handle t)
(xwidget-webkit-new-session (concat "file://" tf-handle))
)))
(gnus-html-wash-tags))))
(setq mm-text-html-renderer 'xw-gnus-article-html)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment