aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Austin Clements <amdragon@MIT.EDU>2012-09-29 14:03:43 -0400
committerGravatar David Bremner <bremner@debian.org>2012-09-30 11:40:31 -0300
commitf227d63b273613e8d0882fe443d66c295e4bf444 (patch)
tree68e40dbfad7146be293d93f8461b65258bfef48e
parent54005b46256162b8f96fefbd70bf159698e24aad (diff)
emacs: Work around gnus-inhibit-images bug in mm-shr
Emacs 24's mm-shr HTML email renderer fails to load gnus-art before referencing gnus-inhibit-images, resulting in a void-variable error when notmuch attempts to render an HTML email with inline images. This works around this bug by advising mm-shr to load gnus-art. mm-shr is the only function outside of gnus-art itself that references gnus-inhibit-images, so this workaround should be correct. If this ever changes, hopefully they will have fixed this bug upstream first. This fixes the "Rendering HTML mail with images" test for Emacs 24.
-rw-r--r--emacs/notmuch-lib.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 20d990df..69867ada 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -254,6 +254,19 @@ the given type."
(or (plist-get part :content)
(notmuch-get-bodypart-internal (notmuch-id-to-query (plist-get msg :id)) nth process-crypto)))
+;; Workaround: The call to `mm-display-part' below triggers a bug in
+;; Emacs 24 if it attempts to use the shr renderer to display an HTML
+;; part with images in it (demonstrated in 24.1 and 24.2 on Debian and
+;; Fedora 17, though unreproducable in other configurations).
+;; `mm-shr' references the variable `gnus-inhibit-images' without
+;; first loading gnus-art, which defines it, resulting in a
+;; void-variable error. Hence, we advise `mm-shr' to ensure gnus-art
+;; is loaded.
+(if (>= emacs-major-version 24)
+ (defadvice mm-shr (before load-gnus-arts activate)
+ (require 'gnus-art nil t)
+ (ad-disable-advice 'mm-shr 'before 'load-gnus-arts)))
+
(defun notmuch-mm-display-part-inline (msg part nth content-type process-crypto)
"Use the mm-decode/mm-view functions to display a part in the
current buffer, if possible."