From be9e9953b18b5ba38301c8b7ae95bee0e060ef8a Mon Sep 17 00:00:00 2001 From: djcb Date: Sat, 11 Aug 2012 12:22:36 +0300 Subject: [PATCH] * mu4e: warn when org-export-string is not defined --- mu4e/org-mu4e.el | 62 +++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/mu4e/org-mu4e.el b/mu4e/org-mu4e.el index b4a754b3..9428d1e4 100644 --- a/mu4e/org-mu4e.el +++ b/mu4e/org-mu4e.el @@ -150,36 +150,38 @@ and images in a multipart/related part." (defun org~mu4e-mime-convert-to-html () "Convert the current body to html." - (let* ((begin - (save-excursion - (goto-char (point-min)) - (search-forward mail-header-separator))) - (end (point-max)) - (raw-body (buffer-substring begin end)) - (tmp-file (make-temp-name (expand-file-name "mail" - temporary-file-directory))) - (body (org-export-string raw-body 'org (file-name-directory tmp-file))) - ;; because we probably don't want to skip part of our mail - (org-export-skip-text-before-1st-heading nil) - ;; because we probably don't want to export a huge style file - (org-export-htmlize-output-type 'inline-css) - ;; makes the replies with ">"s look nicer - (org-export-preserve-breaks t) - ;; dvipng for inline latex because MathJax doesn't work in mail - (org-export-with-LaTeX-fragments 'dvipng) - ;; to hold attachments for inline html images - (html-and-images - (org~mu4e-mime-replace-images - (org-export-string raw-body 'html (file-name-directory tmp-file)) - tmp-file)) - (html-images (cdr html-and-images)) - (html (car html-and-images))) - (delete-region begin end) - (save-excursion - (goto-char begin) - (newline) - (insert (org~mu4e-mime-multipart - body html (mapconcat 'identity html-images "\n")))))) + (if (not (fboundp 'org-export-string)) + (mu4e-error "require function 'org-export-string not found.") + (let* ((begin + (save-excursion + (goto-char (point-min)) + (search-forward mail-header-separator))) + (end (point-max)) + (raw-body (buffer-substring begin end)) + (tmp-file (make-temp-name (expand-file-name "mail" + temporary-file-directory))) + (body (org-export-string raw-body 'org (file-name-directory tmp-file))) + ;; because we probably don't want to skip part of our mail + (org-export-skip-text-before-1st-heading nil) + ;; because we probably don't want to export a huge style file + (org-export-htmlize-output-type 'inline-css) + ;; makes the replies with ">"s look nicer + (org-export-preserve-breaks t) + ;; dvipng for inline latex because MathJax doesn't work in mail + (org-export-with-LaTeX-fragments 'dvipng) + ;; to hold attachments for inline html images + (html-and-images + (org~mu4e-mime-replace-images + (org-export-string raw-body 'html (file-name-directory tmp-file)) + tmp-file)) + (html-images (cdr html-and-images)) + (html (car html-and-images))) + (delete-region begin end) + (save-excursion + (goto-char begin) + (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 ;; possible.