[Emacs] Give mu4e the ability to export mails to PDF again!
This commit is contained in:
parent
4f7927a5f7
commit
841f6b7f85
@ -4494,6 +4494,22 @@ signature to emails to the hook called when creating a new email.
|
||||
(add-hook 'mu4e-compose-mode-hook 'mml-secure-message-sign-pgpmime)
|
||||
#+END_SRC
|
||||
|
||||
mu4e used to be able to export emails to PDFs, but unfortunately this
|
||||
possibility was discontinued. But we can (sort of) bring it back!
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun mu4e-action-open-as-pdf (msg)
|
||||
"Export and open as PDF a mu4e `MSG'"
|
||||
(let* ((date (mu4e-message-field msg :date))
|
||||
(infile (mu4e~write-body-to-html msg))
|
||||
(outfile (format-time-string "/tmp/%Y-%m-%d%H%M%S.pdf" date)))
|
||||
(with-temp-buffer
|
||||
(shell-command
|
||||
(format "wkhtmltopdf %s %s" infile outfile) t))
|
||||
(find-file outfile)))
|
||||
|
||||
(add-to-list 'mu4e-view-actions '("PDF view" . mu4e-action-open-as-pdf) t)
|
||||
#+END_SRC
|
||||
|
||||
Lastly, some emails are better displayed in a browser than in Emacs. My Emacs
|
||||
build has the webkit browser enabled, so I’ll add an option to open with it
|
||||
emails.
|
||||
|
Loading…
Reference in New Issue
Block a user