emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] org-mime: make plain/text mime export a choice


From: Jon Miller
Subject: [O] [PATCH] org-mime: make plain/text mime export a choice
Date: Mon, 31 Aug 2015 17:55:06 -0700

Update to how org-mime constructs emails for the plain/text section of the
mime email. I've found that using the 'ascii exporter produces a saner
plain/text section than using the 'org exporter. Added a new custom variable
to control which exporter is used. and changed the default behavior to use
'ascii. Below is my git formatted patch.

-- 
Jon Miller


>From 7dca81cc20b81ac36b7580efa756b66e7f8b1705 Mon Sep 17 00:00:00 2001
From: Jon Miller <address@hidden>
Date: Mon, 31 Aug 2015 17:32:53 -0700
Subject: [PATCH] org-mime: make plain/text mime export a choice

* org-mime (org-mime-htmlize, org-mime-compose): Introduce a new
  customize variable `org-mime-plain-text-export-format' to control how
  the plain/text portion of the mime formatted email is exported.
  Defaults to 'ascii over previous hard coded 'org choice.

The 'ascii export does a better job in formatting your email in the
plain/text portion of the mime encoded message than to org
format.  Making this configurable and changing the default to ascii.

TINYCHANGE
---
 contrib/lisp/org-mime.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/contrib/lisp/org-mime.el b/contrib/lisp/org-mime.el
index 197c712..10a56eb 100644
--- a/contrib/lisp/org-mime.el
+++ b/contrib/lisp/org-mime.el
@@ -70,6 +70,12 @@
   :group 'org-mime
   :type 'string)
 
+(defcustom org-mime-plain-text-export-format 'ascii
+  "Which format to export to when filling the text/plain mime
+  section"
+  :group 'org-mime
+  :type '(choice 'org 'ascii))
+
 (defcustom org-mime-library 'mml
   "Library to use for marking up MIME elements."
   :group 'org-mime
@@ -214,7 +220,7 @@ export that region, otherwise export the entire body."
                           (buffer-substring html-start html-end)))
          (tmp-file (make-temp-name (expand-file-name
                                    "mail" temporary-file-directory)))
-         (body (org-export-string-as raw-body 'org t))
+         (body (org-export-string-as raw-body 
org-mime-plain-text-export-format t))
          ;; 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
@@ -324,7 +330,7 @@ export that region, otherwise export the entire body."
                 (org-export-string-as
                  (org-babel-trim
                   (funcall bhook body (if (eq fmt 'html) 'org 'ascii)))
-                 (if (eq fmt 'html) 'org 'ascii) t)
+                 org-mime-plain-text-export-format t)
                 html)
                (mapconcat 'identity images "\n")))))))
 
-- 
2.4.3



reply via email to

[Prev in Thread] Current Thread [Next in Thread]