emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jon Miller <jonebird@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] org-mime: make plain/text mime export a choice
Date: Mon, 31 Aug 2015 17:55:06 -0700	[thread overview]
Message-ID: <vl8fa8t7vtzp.fsf@crad-millertime.qualcomm.com> (raw)
In-Reply-To: mailman.109.1441036833.32276.emacs-orgmode@gnu.org

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 <jonEbird@gmail.com>
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	other threads:[~2015-09-01  0:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.109.1441036833.32276.emacs-orgmode@gnu.org>
2015-09-01  0:55 ` Jon Miller [this message]
2015-09-01  7:19   ` [PATCH] org-mime: make plain/text mime export a choice Nicolas Goaziou
2015-09-01  8:07     ` Eric Abrahamsen
2015-09-01 15:26       ` Nicolas Goaziou
2015-09-01 16:30         ` Eric Abrahamsen
2015-09-01 18:36           ` Nicolas Goaziou
2015-09-02  2:28             ` Eric Abrahamsen
2015-09-01 15:46     ` Jon Miller
2015-09-01 21:01       ` Jon Miller
2015-09-02 18:57     ` Will O'Brien
2015-09-04  0:30       ` Jon Miller
2015-09-04 18:57         ` Nicolas Goaziou
2015-09-04 19:17           ` Jon Miller
2015-09-05  8:49             ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vl8fa8t7vtzp.fsf@crad-millertime.qualcomm.com \
    --to=jonebird@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).