mu4e: fix toggling between html/text

This commit is contained in:
djcb
2016-11-27 14:34:50 +02:00
parent b6d73b5da4
commit 68fd3b71d3
2 changed files with 63 additions and 46 deletions

View File

@ -254,7 +254,13 @@ found."
(mu4e~view-custom-field msg field))))))
mu4e-view-fields "")
"\n"
(let ((body (mu4e-message-body-text msg mu4e-view-prefer-html)))
(let* ((prefer-html
(cond
((eq mu4e~view-html-text 'html) t)
((eq mu4e~view-html-text 'text) nil)
(t mu4e-view-prefer-html)))
(body (mu4e-message-body-text msg prefer-html)))
(setq mu4e~view-html-text nil)
(when (fboundp 'add-face-text-property)
(add-face-text-property 0 (length body) 'mu4e-view-body-face t body))
body)))
@ -969,11 +975,16 @@ the new docid. Otherwise, return nil."
(mu4e-view-refresh)
(mu4e~view-hide-cited)))
(defvar mu4e~view-html-text nil
"Should we prefer html or text just this once? A symbol `text'
or `html' or nil.")
(defun mu4e-view-toggle-html ()
"Toggle html-display of the message body (if any)."
(interactive)
(let ((mu4e-view-prefer-html (not mu4e~message-body-html)))
(mu4e-view-refresh)))
(setq mu4e~view-html-text
(if mu4e~message-body-html 'text 'html))
(mu4e-view-refresh))
(defun mu4e-view-refresh ()
"Redisplay the current message."