Re: [RFC][PATCH] emacs: Provide scaffolding so that the new `shr' HTML renderer can...
authorChris Gray <chrismgray@gmail.com>
Tue, 20 Dec 2011 06:38:36 +0000 (23:38 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:41:05 +0000 (09:41 -0800)
4b/45d15e6a9ba28947e28adfffd2f638f9f7d199 [new file with mode: 0644]

diff --git a/4b/45d15e6a9ba28947e28adfffd2f638f9f7d199 b/4b/45d15e6a9ba28947e28adfffd2f638f9f7d199
new file mode 100644 (file)
index 0000000..3f49d5c
--- /dev/null
@@ -0,0 +1,144 @@
+Return-Path: <chrismgray@gmail.com>\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 1A7C8431FD0\r
+       for <notmuch@notmuchmail.org>; Mon, 19 Dec 2011 22:38:58 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, 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 TOQ1LScJLhmG for <notmuch@notmuchmail.org>;\r
+       Mon, 19 Dec 2011 22:38:57 -0800 (PST)\r
+Received: from mail-yx0-f181.google.com (mail-yx0-f181.google.com\r
+       [209.85.213.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 7239D431FB6\r
+       for <notmuch@notmuchmail.org>; Mon, 19 Dec 2011 22:38:57 -0800 (PST)\r
+Received: by yenm3 with SMTP id m3so5013203yen.26\r
+       for <notmuch@notmuchmail.org>; Mon, 19 Dec 2011 22:38:55 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+       :mime-version:content-type;\r
+       bh=N6Na5KuFtHKt/pzJBS0DV8yRHUe+wJkuleZByB0V/vw=;\r
+       b=dynstkZOuD7CebnuiF1qDO3naZdgiweXHohS82+iVu5n11sNvmE6DE7nLSA70wn3PP\r
+       h4y2L3+aomkKj+u8qtKm9CKUwT4iUjbqu2rM1g4VcTIC5RAsio4f1r39NYVvgUZ/D+Md\r
+       XID+pr2pErn3isbsGParNRV6U6oowwN8dvYAE=\r
+Received: by 10.236.197.42 with SMTP id s30mr1156160yhn.8.1324363135905;\r
+       Mon, 19 Dec 2011 22:38:55 -0800 (PST)\r
+Received: from driftwood (S0106001f333bc36d.cg.shawcable.net. [68.144.78.164])\r
+       by mx.google.com with ESMTPS id\r
+       r68sm1490228yhm.18.2011.12.19.22.38.53\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Mon, 19 Dec 2011 22:38:54 -0800 (PST)\r
+From: Chris Gray <chrismgray@gmail.com>\r
+To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org\r
+Subject: Re: [RFC][PATCH] emacs: Provide scaffolding so that the new `shr'\r
+       HTML renderer can run.\r
+In-Reply-To: <1324309559-7993-1-git-send-email-dme@dme.org>\r
+References: <1324309559-7993-1-git-send-email-dme@dme.org>\r
+User-Agent: Notmuch/0.10.2+95~g2eb2694 (http://notmuchmail.org)\r
+       Emacs/24.0.92.1 (i486-pc-linux-gnu)\r
+Date: Mon, 19 Dec 2011 23:38:36 -0700\r
+Message-ID: <8762hbkas3.fsf@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\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: Tue, 20 Dec 2011 06:38:58 -0000\r
+\r
+On Mon, 19 Dec 2011 15:45:59 +0000, David Edmondson <dme@dme.org> wrote:\r
+> Latest gnus provides a new HTML renderer entirely in lisp. It requires\r
+> some minor but ugly scaffolding to allow use with notmuch.\r
+> ---\r
+> \r
+> This is pretty horrible, but works in the cases that I tested. It\r
+> would be useful if a few other people could test. Note that `cid:'\r
+> images included with a text/html part are not inserted in the correct\r
+> place, but that also appears to be the case for gnus.\r
+> \r
+> This should be tagged `notmuch::wip' in the new world order!\r
+> \r
+>  emacs/notmuch-show.el |   14 +++++++++++++-\r
+>  1 files changed, 13 insertions(+), 1 deletions(-)\r
+> \r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index 63b01e5..f52f233 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -320,6 +320,13 @@ message at DEPTH in the current thread."\r
+>      ;; ange-ftp, which is reasonable to use here.\r
+>      (mm-write-region (point-min) (point-max) file nil nil nil 'no-conversion t)))))\r
+>  \r
+> +;; Nonsense required to have the new gnus `shr' HTML display code\r
+> +;; work.\r
+> +(defvar gnus-summary-buffer)\r
+> +(defvar gnus-inhibit-images)\r
+\r
+I believe that gnus-inhibit-images is defined in gnus-art.el.  Perhaps\r
+that file should just be require'd rather than having this workaround.\r
+\r
+> +(if (not (fboundp 'gnus-blocked-images))\r
+> +    (defun gnus-blocked-images () nil))\r
+> +\r
+>  (defun notmuch-show-mm-display-part-inline (msg part nth content-type)\r
+>    "Use the mm-decode/mm-view functions to display a part in the\r
+>  current buffer, if possible."\r
+> @@ -331,7 +338,12 @@ current buffer, if possible."\r
+>          (let ((content (notmuch-show-get-bodypart-content msg part nth)))\r
+>            (insert content)\r
+>            (set-buffer display-buffer)\r
+> -          (mm-display-part handle)\r
+> +\r
+> +          ;; Nonsense required to have the new gnus `shr' HTML\r
+> +          ;; display code work.\r
+> +          (let ((gnus-inhibit-images nil))\r
+> +            (makunbound 'gnus-summary-buffer) ; Blech.\r
+\r
+This is working around a bug in gnus.  I think the better solution would\r
+be for gnus to fix the bug.  The following patch against gnus works for\r
+me.  (I have tried submitting it to the gnus bug list, but have not been\r
+able to check if it got through.)\r
+\r
+Cheers,\r
+Chris\r
+\r
+commit 45e5a06ea63d8d9f9a962db7d739c7d7056ef712 (HEAD, refs/heads/master)\r
+Author: Chris Gray <chrismgray@gmail.com>\r
+Date:   Mon Dec 19 23:33:30 2011 -0700\r
+\r
+    mm-decode.el (mm-shr): Added check to bufferp for gnus-summary-buffer\r
+    \r
+    If gnus-summary-buffer is a string, then (buffer-name\r
+    gnus-summary-buffer) gives an error.\r
+\r
+       Modified lisp/mm-decode.el\r
+diff --git a/lisp/mm-decode.el b/lisp/mm-decode.el\r
+index 44e2af5..7005dd7 100644\r
+--- a/lisp/mm-decode.el\r
++++ b/lisp/mm-decode.el\r
+@@ -1724,6 +1724,7 @@ If RECURSIVE, search recursively."\r
+                                     (buffer-string))))))\r
+       shr-inhibit-images shr-blocked-images charset char)\r
+     (if (and (boundp 'gnus-summary-buffer)\r
++           (bufferp gnus-summary-buffer)\r
+            (buffer-name gnus-summary-buffer))\r
+       (with-current-buffer gnus-summary-buffer\r
+         (setq shr-inhibit-images gnus-inhibit-images\r
+\r
+\r