mu4e: add mu4e-action-view-with-xwidget

Action for using xwidget/webkit to display emails in a webkit widget
inside mu4e. This currently requires the git-version of emacs (emacs-25
branch).
This commit is contained in:
djcb 2016-01-24 12:32:09 +02:00
parent 2af5ac97e5
commit 7ea5f4c8e2
1 changed files with 22 additions and 2 deletions

View File

@ -91,10 +91,30 @@ You can influence the browser to use with the variable
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun mu4e-action-view-with-xwidget (msg)
"View the body of the message inside xwidget-webkit."
(unless (fboundp 'xwidget-webkit-browse-url)
(mu4e-error "No xwidget support available"))
(let* ((html (mu4e-message-field msg :body-html))
(txt (mu4e-message-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
;; simplistic -- but note that it's only an example...
(insert (or html (concat "<pre>" txt "</pre>")))
(write-file tmpfile)
(xwidget-webkit-browse-url (concat "file://" tmpfile) t))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconst mu4e-text2speech-command "festival --tts"
"Program that speaks out text it receives on standard-input.")
(defconst mu4e-text2speech-command "festival --tts"
"Program that speaks out text it receives on standard-input.")
(defun mu4e-action-message-to-speech (msg)
"Pronounce the message text using `mu4e-text2speech-command'."