* mu4e-actions.el: use the improved mu4e-action-view-in-browser

This commit is contained in:
djcb
2012-06-12 00:20:01 +03:00
parent aa1c296ded
commit 1c8f12c25e

View File

@ -73,18 +73,15 @@ view."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun mu4e-action-view-in-browser (msg) (defun mu4e-action-view-in-browser (msg)
"Hack to view the html part for MSG in a web browser." "View the body of the message in a web browser. You can influence
(let* ((shellpath (shell-quote-argument (mu4e-msg-field msg :path))) the browser to use with the variable `browse-url-generic-program'."
(partnum (let ((html (mu4e-msg-field msg :body-html))
(shell-command-to-string (tmpfile (format "%s/%d.html" temporary-file-directory (random))))
(format "%s extract %s | grep 'text/html' | awk '{print $1}'" (unless html (error "No html part for this message"))
mu4e-mu-binary shellpath)))) (with-temp-file tmpfile
(unless (> (length partnum) 0) (insert html)
(error "No html part for this message")) (save-buffer)
(call-process-shell-command (url-view-url (concat "file:///" tmpfile)))))
(format "cd %s; %s extract %s --parts=%s --overwrite --play"
(shell-quote-argument temporary-file-directory)
mu4e-mu-binary shellpath (substring partnum 0 -1)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;