1
0
mirror of https://github.com/djcb/mu.git synced 2024-06-20 06:46:50 +02:00

* fix mu4e-action-view-in-browser (thanks semente!)

This commit is contained in:
djcb 2012-09-25 07:38:57 +03:00
parent fe82c505d9
commit 81f74219b2

View File

@ -75,16 +75,16 @@ view."
(defun mu4e-action-view-in-browser (msg)
"View the body of the message in a web browser. You can influence
the browser to use with the variable `browse-url-generic-program'."
(let* ((html (mu4e-msg-field msg :body-htm ))
(txt (mu4e-msg-field msg :body-txt))
(tmpfile (format "%s/%d.html" temporary-file-directory (random))))
(let* ((html (mu4e-msg-field msg :body-html))
(txt (mu4e-msg-field msg :body-txt))
(tmpfile (format "%s%x.html" temporary-file-directory (random t))))
(unless (or html txt)
(mu4e-error "No body part for this message"))
(with-temp-buffer
;; this is simplistic -- but note that it's only an example
;; simplistic -- but note that it's only an example...
(insert (or html (concat "<pre>" txt "</pre>")))
(when (write-file tmpfile)
(url-view-url (concat "file:///" tmpfile))))))
(write-file tmpfile)
(browse-url (concat "file://" tmpfile)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;