[PATCH] emacs: Work around gnus-inhibit-images bug in mm-shr
authorAustin Clements <amdragon@MIT.EDU>
Sat, 29 Sep 2012 18:03:43 +0000 (14:03 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:49:39 +0000 (09:49 -0800)
df/b9c4c6923139f303430fe85bd0e62effc8bee1 [new file with mode: 0644]

diff --git a/df/b9c4c6923139f303430fe85bd0e62effc8bee1 b/df/b9c4c6923139f303430fe85bd0e62effc8bee1
new file mode 100644 (file)
index 0000000..fdc6823
--- /dev/null
@@ -0,0 +1,116 @@
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id E03EA431FBF\r
+       for <notmuch@notmuchmail.org>; Sat, 29 Sep 2012 11:03:47 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 8hTySBPEQ2P5 for <notmuch@notmuchmail.org>;\r
+       Sat, 29 Sep 2012 11:03:47 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU\r
+       [18.9.25.15])\r
+       by olra.theworths.org (Postfix) with ESMTP id 3249C431FBC\r
+       for <notmuch@notmuchmail.org>; Sat, 29 Sep 2012 11:03:47 -0700 (PDT)\r
+X-AuditID: 1209190f-b7f636d00000095b-11-506738021bac\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+       by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 0D.9E.02395.20837605; Sat, 29 Sep 2012 14:03:46 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q8TI3kgi019124; \r
+       Sat, 29 Sep 2012 14:03:46 -0400\r
+Received: from drake.dyndns.org\r
+       (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+       [209.6.116.242]) (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q8TI3jjH005274\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Sat, 29 Sep 2012 14:03:46 -0400 (EDT)\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1TI1OC-00043Q-Vi; Sat, 29 Sep 2012 14:03:44 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: Work around gnus-inhibit-images bug in mm-shr\r
+Date: Sat, 29 Sep 2012 14:03:43 -0400\r
+Message-Id: <1348941823-15516-1-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10\r
+In-Reply-To: <1348941314-8377-4-git-send-email-amdragon@mit.edu>\r
+References: <1348941314-8377-4-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrIIsWRmVeSWpSXmKPExsUixCmqrMtkkR5gsKfR0OL6zZnMDowez1bd\r
+       Yg5gjOKySUnNySxLLdK3S+DKmL30LnPBT76KRxsvsjUwLuLpYuTkkBAwkfjzcwULhC0mceHe\r
+       ejYQW0hgH6PE5D7tLkYuIHsDo8SiK0vYIZxHTBJvT/azQjhzGSW+b9nCBNLCJqAhsW3/ckYQ\r
+       W0RAWmLn3dlARRwczAJqEn+6VEBMYQFXiV9vdUEqWARUJf68ewJWzSvgIDHrxh9GiCPkJZ7e\r
+       7wM7ghMo3rDyAwvEQfYSk09+Z5nAyL+AkWEVo2xKbpVubmJmTnFqsm5xcmJeXmqRrolebmaJ\r
+       XmpK6SZGcMhI8u9g/HZQ6RCjAAejEg+vxvHUACHWxLLiytxDjJIcTEqivC466QFCfEn5KZUZ\r
+       icUZ8UWlOanFhxglOJiVRHgzioHKeVMSK6tSi/JhUtIcLErivFdTbvoLCaQnlqRmp6YWpBbB\r
+       ZGU4OJQkePPNgYYKFqWmp1akZeaUIKSZODhBhvMADb9pBlTDW1yQmFucmQ6RP8WoKCXOawDS\r
+       LACSyCjNg+uFxfQrRnGgV4R5DUGqeIDpAK77FdBgJqDBVavSQAaXJCKkpBoYAz20V+9vOm6Q\r
+       xhpSKSAQW7pFyT7vbOV0X51XzzIWW1pLvJXfktzJ/scg+5jTHL6MF73Rcj0lh0IXB/1hWSQx\r
+       d3n7sv8Fmm91FzydGcDE2LWyIau3/7OG6tFotZllj39UOPAqXks9/ak8hpdRWfOQ7T0ly9kH\r
+       nNPcv8qLXDo/67pCfVAut7cSS3FGoqEWc1FxIgCAovjZxAIAAA==\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 29 Sep 2012 18:03:48 -0000\r
+\r
+Emacs 24's mm-shr HTML email renderer fails to load gnus-art before\r
+referencing gnus-inhibit-images, resulting in a void-variable error\r
+when notmuch attempts to render an HTML email with inline images.\r
+This works around this bug by advising mm-shr to load gnus-art.\r
+\r
+mm-shr is the only function outside of gnus-art itself that references\r
+gnus-inhibit-images, so this workaround should be correct.  If this\r
+ever changes, hopefully they will have fixed this bug upstream first.\r
+\r
+This fixes the "Rendering HTML mail with images" test for Emacs 24.\r
+---\r
+\r
+This is an alternate fix to the one provided in patch 3/3.\r
+\r
+ emacs/notmuch-lib.el |   13 +++++++++++++\r
+ 1 file changed, 13 insertions(+)\r
+\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index 20d990d..69867ad 100644\r
+--- a/emacs/notmuch-lib.el\r
++++ b/emacs/notmuch-lib.el\r
+@@ -254,6 +254,19 @@ the given type."\r
+   (or (plist-get part :content)\r
+       (notmuch-get-bodypart-internal (notmuch-id-to-query (plist-get msg :id)) nth process-crypto)))\r
\r
++;; Workaround: The call to `mm-display-part' below triggers a bug in\r
++;; Emacs 24 if it attempts to use the shr renderer to display an HTML\r
++;; part with images in it (demonstrated in 24.1 and 24.2 on Debian and\r
++;; Fedora 17, though unreproducable in other configurations).\r
++;; `mm-shr' references the variable `gnus-inhibit-images' without\r
++;; first loading gnus-art, which defines it, resulting in a\r
++;; void-variable error.  Hence, we advise `mm-shr' to ensure gnus-art\r
++;; is loaded.\r
++(if (>= emacs-major-version 24)\r
++    (defadvice mm-shr (before load-gnus-arts activate)\r
++      (require 'gnus-art nil t)\r
++      (ad-disable-advice 'mm-shr 'before 'load-gnus-arts)))\r
++\r
+ (defun notmuch-mm-display-part-inline (msg part nth content-type process-crypto)\r
+   "Use the mm-decode/mm-view functions to display a part in the\r
+ current buffer, if possible."\r
+-- \r
+1.7.10\r
+\r