[RFC][PATCH] emacs: Provide scaffolding so that the new `shr' HTML renderer can run.

David Edmondson dme at dme.org
Mon Dec 19 07:45:59 PST 2011


Latest gnus provides a new HTML renderer entirely in lisp. It requires
some minor but ugly scaffolding to allow use with notmuch.
---

This is pretty horrible, but works in the cases that I tested. It
would be useful if a few other people could test. Note that `cid:'
images included with a text/html part are not inserted in the correct
place, but that also appears to be the case for gnus.

This should be tagged `notmuch::wip' in the new world order!

 emacs/notmuch-show.el |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 63b01e5..f52f233 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -320,6 +320,13 @@ message at DEPTH in the current thread."
 	;; ange-ftp, which is reasonable to use here.
 	(mm-write-region (point-min) (point-max) file nil nil nil 'no-conversion t)))))
 
+;; Nonsense required to have the new gnus `shr' HTML display code
+;; work.
+(defvar gnus-summary-buffer)
+(defvar gnus-inhibit-images)
+(if (not (fboundp 'gnus-blocked-images))
+    (defun gnus-blocked-images () nil))
+
 (defun notmuch-show-mm-display-part-inline (msg part nth content-type)
   "Use the mm-decode/mm-view functions to display a part in the
 current buffer, if possible."
@@ -331,7 +338,12 @@ current buffer, if possible."
 	    (let ((content (notmuch-show-get-bodypart-content msg part nth)))
 	      (insert content)
 	      (set-buffer display-buffer)
-	      (mm-display-part handle)
+
+	      ;; Nonsense required to have the new gnus `shr' HTML
+	      ;; display code work.
+	      (let ((gnus-inhibit-images nil))
+		(makunbound 'gnus-summary-buffer) ; Blech.
+		(mm-display-part handle))
 	      t)
 	  nil)))))
 
-- 
1.7.7.3



More information about the notmuch mailing list