unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Chris Gray <chrismgray@gmail.com>
To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org
Subject: Re: [RFC][PATCH] emacs: Provide scaffolding so that the new `shr' HTML renderer can run.
Date: Mon, 19 Dec 2011 23:38:36 -0700	[thread overview]
Message-ID: <8762hbkas3.fsf@gmail.com> (raw)
In-Reply-To: <1324309559-7993-1-git-send-email-dme@dme.org>

On Mon, 19 Dec 2011 15:45:59 +0000, David Edmondson <dme@dme.org> 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 <chrismgray@gmail.com>
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

  parent reply	other threads:[~2011-12-20  6:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-19 15:45 [RFC][PATCH] emacs: Provide scaffolding so that the new `shr' HTML renderer can run David Edmondson
2011-12-19 17:50 ` Aaron Ecay
2011-12-20  6:38 ` Chris Gray [this message]
2011-12-20  8:35   ` David Edmondson
2011-12-20 14:27     ` Chris Gray
2011-12-20 14:33       ` David Edmondson
2011-12-20 16:09         ` Chris Gray
2011-12-20  8:40   ` Aaron Ecay
2011-12-20 17:06     ` Chris Gray
2012-01-23 14:43   ` Florian Friesdorf
2012-01-23 17:14     ` Chris Gray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8762hbkas3.fsf@gmail.com \
    --to=chrismgray@gmail.com \
    --cc=dme@dme.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).