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

diff --git a/af/ac65e622fc2c6f40ad013c731cee2871948105 b/af/ac65e622fc2c6f40ad013c731cee2871948105
new file mode 100644 (file)
index 0000000..1ca39b7
--- /dev/null
@@ -0,0 +1,121 @@
+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 6F060431FC7\r
+       for <notmuch@notmuchmail.org>; Sat, 29 Sep 2012 10:55:23 -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 mlceA+4S8Bdu for <notmuch@notmuchmail.org>;\r
+       Sat, 29 Sep 2012 10:55:22 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU\r
+       [18.9.25.14])\r
+       by olra.theworths.org (Postfix) with ESMTP id E627F431FC0\r
+       for <notmuch@notmuchmail.org>; Sat, 29 Sep 2012 10:55:21 -0700 (PDT)\r
+X-AuditID: 1209190e-b7f756d000000904-4b-506736096d94\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+       by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id E4.81.02308.90637605; Sat, 29 Sep 2012 13:55:21 -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 q8THtK5t018534; \r
+       Sat, 29 Sep 2012 13:55:20 -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 q8THtJBD004648\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Sat, 29 Sep 2012 13:55:20 -0400 (EDT)\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1TI1G3-0003Er-0c; Sat, 29 Sep 2012 13:55:19 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 3/3] emacs: Work around gnus-inhibit-images bug in mm-shr\r
+Date: Sat, 29 Sep 2012 13:55:14 -0400\r
+Message-Id: <1348941314-8377-4-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10\r
+In-Reply-To: <1348941314-8377-1-git-send-email-amdragon@mit.edu>\r
+References: <1348941314-8377-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrEIsWRmVeSWpSXmKPExsUixCmqrMtplh5gcOiqqMX1mzOZHRg9nq26\r
+       xRzAGMVlk5Kak1mWWqRvl8CVcf99O0vBW6GKB20zWBoY9/F3MXJySAiYSPx5coMJwhaTuHBv\r
+       PVsXIxeHkMA+RoknU24wQzgbGCUOvF0M5Txikniy5C4jSIuQwFxGifVHYkFsNgENiW37l4PF\r
+       RQSkJXbenc3axcjBwSygJvGnSwUkLCzgKbFx5WOwbSwCqhJt89eygti8AvYSC369Z4W4Ql7i\r
+       6f0+NhCbU8BB4sCUbWwQq+wlbh6exTSBkX8BI8MqRtmU3Crd3MTMnOLUZN3i5MS8vNQiXWO9\r
+       3MwSvdSU0k2M4KCR5NvB+PWg0iFGAQ5GJR7eG6dTA4RYE8uKK3MPMUpyMCmJ8rropAcI8SXl\r
+       p1RmJBZnxBeV5qQWH2KU4GBWEuHNKAYq501JrKxKLcqHSUlzsCiJ815JuekvJJCeWJKanZpa\r
+       kFoEk5Xh4FCS4BUzBRoqWJSanlqRlplTgpBm4uAEGc4DNNwCpIa3uCAxtzgzHSJ/ilFRSpxX\r
+       FCQhAJLIKM2D64VF9StGcaBXhCGqeIAJAa77FdBgJqDBVavSQAaXJCKkpBoYtVTPWy2cHne8\r
+       kS3pwfzkTKm4sl+6xqLyGmI8yx0u7c87U3szvnQ6C9OOOw9fRtVblmoene4eYCd3dpvUKtVt\r
+       lbzWocpc5WcP99yTvZi19fCMLF0jz4Mqsvvbrm9iVZpz37Xv+pLpFc8r7i270VJ38PZNj8RN\r
+       kXlGGjG/puua/z8tfZIzVWOBEktxRqKhFnNRcSIA08eWHMUCAAA=\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 17:55:24 -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 providing a definition for\r
+gnus-inhibit-images.\r
+\r
+This fixes the "Rendering HTML mail with images" test for Emacs 24.\r
+---\r
+ emacs/notmuch-lib.el |   24 ++++++++++++++++++++++++\r
+ 1 file changed, 24 insertions(+)\r
+\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index 20d990d..c74035c 100644\r
+--- a/emacs/notmuch-lib.el\r
++++ b/emacs/notmuch-lib.el\r
+@@ -254,6 +254,30 @@ 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.  Unfortunately, gnus-art and its dependencies\r
++;; are very large and often not needed, making it undesirable to\r
++;; simply load gnus-art here.  Instead, we directly define the\r
++;; variable here.  We use defcustom instead of defvar so that it\r
++;; interacts properly with user customizations of the variable (if the\r
++;; custom value has already been loaded, only defcustom will make it\r
++;; visible).  There is a danger of overriding the documentation string\r
++;; if gnus-art is already loaded, so we don't do anything if the\r
++;; variable is already defined.  If the user attempts to customize the\r
++;; variable, we instruct custom to load gnus-art before displaying the\r
++;; widget, which will override this definition with the proper\r
++;; documentation string, groups, etc.\r
++(if (and (>= emacs-major-version 24)\r
++         (not (boundp 'gnus-inhibit-images)))\r
++    (defcustom gnus-inhibit-images nil\r
++      "Documentation will be available after loading gnus-art."\r
++      :load "gnus-art"))\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