summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2010-07-30 15:08:27 -0600
committerEric Schulte <schulte.eric@gmail.com>2010-07-30 15:08:27 -0600
commit9c1c4b3f8d23edd4bc3c73580990c7c59b7913d9 (patch)
treed45878ca339e14cf3ffd33392076c885642de620
parentc32ece6e76f52766d063c531c97c49bb9f371177 (diff)
downloadorg-mode-9c1c4b3f8d23edd4bc3c73580990c7c59b7913d9.tar.gz
org-mime: fixed major error -- was exporting entire as text/plain mime part
Thanks to Ethan Ligon for pointing this out * contrib/lisp/org-mime.el (org-mime-org-buffer-htmlize): fixed major error -- was exporting entire as text/plain mime part, now when region is active, only that region is exported
-rw-r--r--contrib/lisp/org-mime.el12
1 files changed, 9 insertions, 3 deletions
diff --git a/contrib/lisp/org-mime.el b/contrib/lisp/org-mime.el
index e61236c..109ec69 100644
--- a/contrib/lisp/org-mime.el
+++ b/contrib/lisp/org-mime.el
@@ -238,7 +238,12 @@ handling with appropriate MIME encoding."
(goto-char (point-min)))))
(html-end (or (and region-p (region-end))
(point-max)))
- (body (org-export-as-org nil nil nil 'string t))
+ (temp-body-file (make-temp-file "org-mime-export"))
+ (raw-body (buffer-substring html-start html-end))
+ (body (with-temp-buffer
+ (insert raw-body)
+ (write-file temp-body-file)
+ (org-export-as-org nil nil nil 'string t)))
(org-link-file-path-type 'absolute)
;; because we probably don't want to export a huge style file
(org-export-htmlize-output-type 'inline-css)
@@ -251,7 +256,8 @@ handling with appropriate MIME encoding."
;; dump the exported html into a fresh message buffer
(reporter-compose-outgoing)
(goto-char (point-max))
- (insert (org-mime-multipart body html)
- (mapconcat 'identity html-images "\n"))))
+ (prog1 (insert (org-mime-multipart body html)
+ (mapconcat 'identity html-images "\n"))
+ (delete-file temp-body-file))))
(provide 'org-mime) \ No newline at end of file