branch: elpa/org-mime
commit dd1b9881af705b9e78f79791c9f933cabe59c125
Author: Chen Bin <[email protected]>
Commit: Chen Bin <[email protected]>

    remove drawers when org-mime-htmlize-subtree at emacs 24.3
---
 README.org  |  4 ++++
 org-mime.el | 27 ++++++++++++++++++---------
 2 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/README.org b/README.org
index 2912cd7765..e2257a02cb 100644
--- a/README.org
+++ b/README.org
@@ -89,5 +89,9 @@ Or just setup your export options in org buffer/subtree which 
is overrided by `o
 - org-mime was developed by Eric Schulte with much-appreciated help and 
discussion from everyone on the 
[[https://lists.gnu.org/archive/html/emacs-orgmode/2010-03/msg00500.html][using 
orgmode to send html mail]] thread especially Eric S. Fraga for adding WL 
support.
 - [[https://github.com/acowley][Anthony Cowley]] fixed many bugs for exporting
 - [[https://github.com/titaniumbones][Matt Price]] improved handling of mail 
headers (CC, BCC ...)
+* Report bug
+You need provides the version of Emacs and Org-mode you are using.
+
+We also need exact steps to reproduce the issue.
 * Licence
 Documentation from the http://orgmode.org/worg/ website (either in its HTML 
format or in its Org format) is licensed under the 
[[http://www.gnu.org/copyleft/fdl.html][GNU Free Documentation License version 
1.3]] or later. The code examples and css style sheets are licensed under the 
[[http://www.gnu.org/licenses/gpl.html][GNU General Public License v3 or 
later]].
diff --git a/org-mime.el b/org-mime.el
index 4a3a3e2d69..3beeba580d 100644
--- a/org-mime.el
+++ b/org-mime.el
@@ -6,7 +6,7 @@
 ;; Maintainer: Chen Bin (redguardtoo)
 ;; Keywords: mime, mail, email, html
 ;; Homepage: http://github.com/org-mime/org-mime
-;; Version: 0.0.6
+;; Version: 0.0.7
 ;; Package-Requires: ((emacs "24") (cl-lib "0.5"))
 
 ;; This file is not part of GNU Emacs.
@@ -147,14 +147,23 @@ You could use either `org-up-heading-safe' or 
`org-back-to-heading'.")
 
 (defun org-mime--export-string (s fmt &optional opts)
   "Export string S into HTML format.  OPTS is export options."
-  (if org-mime-debug (message "org-mime--export-string called => %s" opts))
-  ;; we won't export title from org file anyway
-  (if opts (setq opts (plist-put opts 'title nil)))
-  (if (fboundp 'org-export-string-as)
-      ;; emacs24.4+
-      (org-export-string-as s fmt t (if org-mime-export-options 
org-mime-export-options opts))
-    ;; emacs 24.3
-    (org-export-string s (symbol-name fmt))))
+  (let* (rlt)
+    (if org-mime-debug (message "org-mime--export-string called => %s" opts))
+    ;; we won't export title from org file anyway
+    (if opts (setq opts (plist-put opts 'title nil)))
+    (if (fboundp 'org-export-string-as)
+        ;; emacs24.4+
+        (setq rlt (org-export-string-as s fmt t (if org-mime-export-options 
org-mime-export-options opts)))
+      ;; emacs 24.3
+      (setq rlt (org-export-string s (symbol-name fmt)))
+      ;; manually remove the drawers, see 
https://github.com/org-mime/org-mime/issues/3
+      ;; Only happens on Emacs 24.3
+      (let* ((b (string-match ":END:" rlt)))
+        (if (and b (> b 0))
+            (setq rlt (substring-no-properties rlt
+                                               (+ b (length ":END:"))
+                                               (length rlt))))))
+    rlt))
 
 ;; example hook, for setting a dark background in <pre 
style="background-color: #EEE;"> elements
 (defun org-mime-change-element-style (element style)

Reply via email to