20

Emacs 24.4 came with native eww browser. What is the proper way to use eww as a renderer for mu4e messages?

aholub7x
  • 303
  • 2
  • 5

1 Answers1

18

eww is basically an interactive wrapper around the shr package, which renders HTML as Emacs text (the actual HTML parsing is done by the libxml package). You can use it in mu4e by setting mu4e-html2text-command to a simple custom function:

(defun my-render-html-message ()
  (let ((dom (libxml-parse-html-region (point-min) (point-max))))
    (erase-buffer)
    (shr-insert-document dom)
    (goto-char (point-min))))

(setq mu4e-html2text-command 'my-render-html-message)

The git version of mu4e includes this built-in as mu4e-shr2text, and it can be set like so:

(require 'mu4e-contrib) 
(setq mu4e-html2text-command 'mu4e-shr2text) 
shosti
  • 5,048
  • 26
  • 33
  • 2
    `mu4e-shr2text` do not display images :( – shackra Dec 10 '14 at 19:58
  • @shackra For displaying html that comes from e-mail that's actually a good thing. I'm not sure if there's a key for toggling that, but even with that it should default to not showing images. That's, of course, regarding loading images from remote URIs, local images should be shown by default. – nert Oct 09 '17 at 13:34