Ver código fonte

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
Eric Schulte 14 anos atrás
pai
commit
9c1c4b3f8d
1 arquivos alterados com 9 adições e 3 exclusões
  1. 9 3
      contrib/lisp/org-mime.el

+ 9 - 3
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)