From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1A7C8431FD0 for ; Mon, 19 Dec 2011 22:38:58 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TOQ1LScJLhmG for ; Mon, 19 Dec 2011 22:38:57 -0800 (PST) Received: from mail-yx0-f181.google.com (mail-yx0-f181.google.com [209.85.213.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 7239D431FB6 for ; Mon, 19 Dec 2011 22:38:57 -0800 (PST) Received: by yenm3 with SMTP id m3so5013203yen.26 for ; Mon, 19 Dec 2011 22:38:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version:content-type; bh=N6Na5KuFtHKt/pzJBS0DV8yRHUe+wJkuleZByB0V/vw=; b=dynstkZOuD7CebnuiF1qDO3naZdgiweXHohS82+iVu5n11sNvmE6DE7nLSA70wn3PP h4y2L3+aomkKj+u8qtKm9CKUwT4iUjbqu2rM1g4VcTIC5RAsio4f1r39NYVvgUZ/D+Md XID+pr2pErn3isbsGParNRV6U6oowwN8dvYAE= Received: by 10.236.197.42 with SMTP id s30mr1156160yhn.8.1324363135905; Mon, 19 Dec 2011 22:38:55 -0800 (PST) Received: from driftwood (S0106001f333bc36d.cg.shawcable.net. [68.144.78.164]) by mx.google.com with ESMTPS id r68sm1490228yhm.18.2011.12.19.22.38.53 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 19 Dec 2011 22:38:54 -0800 (PST) From: Chris Gray To: David Edmondson , notmuch@notmuchmail.org Subject: Re: [RFC][PATCH] emacs: Provide scaffolding so that the new `shr' HTML renderer can run. In-Reply-To: <1324309559-7993-1-git-send-email-dme@dme.org> References: <1324309559-7993-1-git-send-email-dme@dme.org> User-Agent: Notmuch/0.10.2+95~g2eb2694 (http://notmuchmail.org) Emacs/24.0.92.1 (i486-pc-linux-gnu) Date: Mon, 19 Dec 2011 23:38:36 -0700 Message-ID: <8762hbkas3.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2011 06:38:58 -0000 On Mon, 19 Dec 2011 15:45:59 +0000, David Edmondson wrote: > 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) I believe that gnus-inhibit-images is defined in gnus-art.el. Perhaps that file should just be require'd rather than having this workaround. > +(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. This is working around a bug in gnus. I think the better solution would be for gnus to fix the bug. The following patch against gnus works for me. (I have tried submitting it to the gnus bug list, but have not been able to check if it got through.) Cheers, Chris commit 45e5a06ea63d8d9f9a962db7d739c7d7056ef712 (HEAD, refs/heads/master) Author: Chris Gray Date: Mon Dec 19 23:33:30 2011 -0700 mm-decode.el (mm-shr): Added check to bufferp for gnus-summary-buffer If gnus-summary-buffer is a string, then (buffer-name gnus-summary-buffer) gives an error. Modified lisp/mm-decode.el diff --git a/lisp/mm-decode.el b/lisp/mm-decode.el index 44e2af5..7005dd7 100644 --- a/lisp/mm-decode.el +++ b/lisp/mm-decode.el @@ -1724,6 +1724,7 @@ If RECURSIVE, search recursively." (buffer-string)))))) shr-inhibit-images shr-blocked-images charset char) (if (and (boundp 'gnus-summary-buffer) + (bufferp gnus-summary-buffer) (buffer-name gnus-summary-buffer)) (with-current-buffer gnus-summary-buffer (setq shr-inhibit-images gnus-inhibit-images