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
This commit is contained in:
Eric Schulte 2010-07-30 15:08:27 -06:00
parent c32ece6e76
commit 9c1c4b3f8d
1 changed files with 9 additions and 3 deletions

View File

@ -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)