1
0
mirror of https://github.com/djcb/mu.git synced 2024-06-27 07:35:16 +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) (defun mu4e-action-view-in-browser (msg)
"View the body of the message in a web browser. You can influence "View the body of the message in a web browser. You can influence
the browser to use with the variable `browse-url-generic-program'." the browser to use with the variable `browse-url-generic-program'."
(let* ((html (mu4e-msg-field msg :body-htm )) (let* ((html (mu4e-msg-field msg :body-html))
(txt (mu4e-msg-field msg :body-txt)) (txt (mu4e-msg-field msg :body-txt))
(tmpfile (format "%s/%d.html" temporary-file-directory (random)))) (tmpfile (format "%s%x.html" temporary-file-directory (random t))))
(unless (or html txt) (unless (or html txt)
(mu4e-error "No body part for this message")) (mu4e-error "No body part for this message"))
(with-temp-buffer (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>"))) (insert (or html (concat "<pre>" txt "</pre>")))
(when (write-file tmpfile) (write-file tmpfile)
(url-view-url (concat "file:///" tmpfile)))))) (browse-url (concat "file://" tmpfile)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;