From 7ea5f4c8e223edea9eae1b3b65e4f761f06a434c Mon Sep 17 00:00:00 2001 From: djcb Date: Sun, 24 Jan 2016 12:32:09 +0200 Subject: [PATCH] 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). --- mu4e/mu4e-actions.el | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/mu4e/mu4e-actions.el b/mu4e/mu4e-actions.el index 89f9c040..df5df87e 100644 --- a/mu4e/mu4e-actions.el +++ b/mu4e/mu4e-actions.el @@ -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 "
" txt "
"))) + (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'."