Re: problems reading mail with mime parts

Greg Bognar <[email protected]> Wed, 27 Nov 2019 21:47:14 -0500
Newsgroups gmane.mail.wanderlust.general.japanese
Message-ID <[email protected]>
> I would like to do automatically what I have been doing manually, i.e. mark
> the region and do shr-render-region, along with disabling read only mode if
> that is necessary.  Is there a hook where I can put that?

As Kazuhiro said, when there is no Content-Type header, the content is treated
as text/plain part.  You would have to tell WL the difference between a message
body that is html and one that is plain text.  My guess is that then you would
use wl-message-buffer-created-hook and wl-message-redisplay-hook.  See also
https://www.emacswiki.org/emacs/WlHooks.

Wouldn't it be easier to write a function that renders the message buffer and
bind it to a key in wl-summary-mode-map?  That way, when the cursor is on a
message in the summary window that has only html text, you could display it with
a keypress.

You don't need to select a region and disable read-only-mode.  You could use
shr-render-buffer instead.  I'm no elisp expert, but this seems to work on a
test message:

(defun render-raw-html-body ()
  (interactive)
  (let ((cur-buf (current-buffer)))
    (wl-summary-toggle-disp-msg 'on)
    (when (wl-summary-set-message-buffer-or-redisplay 'ignore-original)
      (shr-render-buffer (current-buffer))
      (set-buffer cur-buf))))