* mu4e: warn when org-export-string is not defined
This commit is contained in:
@ -150,36 +150,38 @@ and images in a multipart/related part."
|
|||||||
|
|
||||||
(defun org~mu4e-mime-convert-to-html ()
|
(defun org~mu4e-mime-convert-to-html ()
|
||||||
"Convert the current body to html."
|
"Convert the current body to html."
|
||||||
(let* ((begin
|
(if (not (fboundp 'org-export-string))
|
||||||
(save-excursion
|
(mu4e-error "require function 'org-export-string not found.")
|
||||||
(goto-char (point-min))
|
(let* ((begin
|
||||||
(search-forward mail-header-separator)))
|
(save-excursion
|
||||||
(end (point-max))
|
(goto-char (point-min))
|
||||||
(raw-body (buffer-substring begin end))
|
(search-forward mail-header-separator)))
|
||||||
(tmp-file (make-temp-name (expand-file-name "mail"
|
(end (point-max))
|
||||||
temporary-file-directory)))
|
(raw-body (buffer-substring begin end))
|
||||||
(body (org-export-string raw-body 'org (file-name-directory tmp-file)))
|
(tmp-file (make-temp-name (expand-file-name "mail"
|
||||||
;; because we probably don't want to skip part of our mail
|
temporary-file-directory)))
|
||||||
(org-export-skip-text-before-1st-heading nil)
|
(body (org-export-string raw-body 'org (file-name-directory tmp-file)))
|
||||||
;; because we probably don't want to export a huge style file
|
;; because we probably don't want to skip part of our mail
|
||||||
(org-export-htmlize-output-type 'inline-css)
|
(org-export-skip-text-before-1st-heading nil)
|
||||||
;; makes the replies with ">"s look nicer
|
;; because we probably don't want to export a huge style file
|
||||||
(org-export-preserve-breaks t)
|
(org-export-htmlize-output-type 'inline-css)
|
||||||
;; dvipng for inline latex because MathJax doesn't work in mail
|
;; makes the replies with ">"s look nicer
|
||||||
(org-export-with-LaTeX-fragments 'dvipng)
|
(org-export-preserve-breaks t)
|
||||||
;; to hold attachments for inline html images
|
;; dvipng for inline latex because MathJax doesn't work in mail
|
||||||
(html-and-images
|
(org-export-with-LaTeX-fragments 'dvipng)
|
||||||
(org~mu4e-mime-replace-images
|
;; to hold attachments for inline html images
|
||||||
(org-export-string raw-body 'html (file-name-directory tmp-file))
|
(html-and-images
|
||||||
tmp-file))
|
(org~mu4e-mime-replace-images
|
||||||
(html-images (cdr html-and-images))
|
(org-export-string raw-body 'html (file-name-directory tmp-file))
|
||||||
(html (car html-and-images)))
|
tmp-file))
|
||||||
(delete-region begin end)
|
(html-images (cdr html-and-images))
|
||||||
(save-excursion
|
(html (car html-and-images)))
|
||||||
(goto-char begin)
|
(delete-region begin end)
|
||||||
(newline)
|
(save-excursion
|
||||||
(insert (org~mu4e-mime-multipart
|
(goto-char begin)
|
||||||
body html (mapconcat 'identity html-images "\n"))))))
|
(newline)
|
||||||
|
(insert (org~mu4e-mime-multipart
|
||||||
|
body html (mapconcat 'identity html-images "\n")))))))
|
||||||
|
|
||||||
;; next some functions to make the org/mu4e-compose-mode switch as smooth as
|
;; next some functions to make the org/mu4e-compose-mode switch as smooth as
|
||||||
;; possible.
|
;; possible.
|
||||||
|
|||||||
Reference in New Issue
Block a user