* [PATCH] org-mime: make plain/text mime export a choice [not found] <mailman.109.1441036833.32276.emacs-orgmode@gnu.org> @ 2015-09-01 0:55 ` Jon Miller 2015-09-01 7:19 ` Nicolas Goaziou 0 siblings, 1 reply; 14+ messages in thread From: Jon Miller @ 2015-09-01 0:55 UTC (permalink / raw) To: emacs-orgmode 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 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] org-mime: make plain/text mime export a choice 2015-09-01 0:55 ` [PATCH] org-mime: make plain/text mime export a choice Jon Miller @ 2015-09-01 7:19 ` Nicolas Goaziou 2015-09-01 8:07 ` Eric Abrahamsen ` (2 more replies) 0 siblings, 3 replies; 14+ messages in thread From: Nicolas Goaziou @ 2015-09-01 7:19 UTC (permalink / raw) To: Jon Miller; +Cc: emacs-orgmode Hello, Jon Miller <jonebird@gmail.com> writes: > 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. Thank you for the patch. Is there any reason to keep using "org" exporter if "ascii" is superior? I.e., what about simply replacing 'org with 'ascii? Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] org-mime: make plain/text mime export a choice 2015-09-01 7:19 ` Nicolas Goaziou @ 2015-09-01 8:07 ` Eric Abrahamsen 2015-09-01 15:26 ` Nicolas Goaziou 2015-09-01 15:46 ` Jon Miller 2015-09-02 18:57 ` Will O'Brien 2 siblings, 1 reply; 14+ messages in thread From: Eric Abrahamsen @ 2015-09-01 8:07 UTC (permalink / raw) To: emacs-orgmode Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > Hello, > > Jon Miller <jonebird@gmail.com> writes: > >> 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. > > Thank you for the patch. > > Is there any reason to keep using "org" exporter if "ascii" is superior? > I.e., what about simply replacing 'org with 'ascii? I'd say it might be nice to have the option there to customize. There are several potential plain-text exportation options (I'd prefer utf8, personally), and giving the user a choice seems nice.... ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] org-mime: make plain/text mime export a choice 2015-09-01 8:07 ` Eric Abrahamsen @ 2015-09-01 15:26 ` Nicolas Goaziou 2015-09-01 16:30 ` Eric Abrahamsen 0 siblings, 1 reply; 14+ messages in thread From: Nicolas Goaziou @ 2015-09-01 15:26 UTC (permalink / raw) To: Eric Abrahamsen; +Cc: emacs-orgmode Eric Abrahamsen <eric@ericabrahamsen.net> writes: > I'd say it might be nice to have the option there to customize. There > are several potential plain-text exportation options (I'd prefer utf8, > personally), and giving the user a choice seems nice.... Then the option could offer a choice between "org", "ascii", "latin1" and utf-8. I'm still unsure that providing "org" is pertinent, however. Regards, ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] org-mime: make plain/text mime export a choice 2015-09-01 15:26 ` Nicolas Goaziou @ 2015-09-01 16:30 ` Eric Abrahamsen 2015-09-01 18:36 ` Nicolas Goaziou 0 siblings, 1 reply; 14+ messages in thread From: Eric Abrahamsen @ 2015-09-01 16:30 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 722 bytes --] I agree 'org is pretty useless. But couldn't we just allow any symbol, and let the export process blow up if an invalid symbol is given? On September 1, 2015 11:26:14 PM GMT+08:00, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote: >Eric Abrahamsen <eric@ericabrahamsen.net> writes: > >> I'd say it might be nice to have the option there to customize. There >> are several potential plain-text exportation options (I'd prefer >utf8, >> personally), and giving the user a choice seems nice.... > >Then the option could offer a choice between "org", "ascii", "latin1" >and utf-8. I'm still unsure that providing "org" is pertinent, however. > >Regards, -- Sent from my Android device with K-9 Mail. Please excuse my brevity. [-- Attachment #2: Type: text/html, Size: 1161 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] org-mime: make plain/text mime export a choice 2015-09-01 16:30 ` Eric Abrahamsen @ 2015-09-01 18:36 ` Nicolas Goaziou 2015-09-02 2:28 ` Eric Abrahamsen 0 siblings, 1 reply; 14+ messages in thread From: Nicolas Goaziou @ 2015-09-01 18:36 UTC (permalink / raw) To: Eric Abrahamsen; +Cc: emacs-orgmode Eric Abrahamsen <eric@ericabrahamsen.net> writes: > I agree 'org is pretty useless. But couldn't we just allow any symbol, > and let the export process blow up if an invalid symbol is given? Not if we allow latin1 or utf-8 as values, which are not valid export back-ends. Otherwise, I do not mind. Regards, ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] org-mime: make plain/text mime export a choice 2015-09-01 18:36 ` Nicolas Goaziou @ 2015-09-02 2:28 ` Eric Abrahamsen 0 siblings, 0 replies; 14+ messages in thread From: Eric Abrahamsen @ 2015-09-02 2:28 UTC (permalink / raw) To: emacs-orgmode Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > Eric Abrahamsen <eric@ericabrahamsen.net> writes: > >> I agree 'org is pretty useless. But couldn't we just allow any symbol, >> and let the export process blow up if an invalid symbol is given? > > Not if we allow latin1 or utf-8 as values, which are not valid export > back-ends. Otherwise, I do not mind. Of course, gotcha. I guess it would be better to have that full range of options. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] org-mime: make plain/text mime export a choice 2015-09-01 7:19 ` Nicolas Goaziou 2015-09-01 8:07 ` Eric Abrahamsen @ 2015-09-01 15:46 ` Jon Miller 2015-09-01 21:01 ` Jon Miller 2015-09-02 18:57 ` Will O'Brien 2 siblings, 1 reply; 14+ messages in thread From: Jon Miller @ 2015-09-01 15:46 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: emacs-orgmode Nicolas Goaziou writes: > Hello, > > Jon Miller <jonebird@gmail.com> writes: > >> 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. > > Thank you for the patch. > > Is there any reason to keep using "org" exporter if "ascii" is superior? > I.e., what about simply replacing 'org with 'ascii? That's a good question. I personally don't think I'd ever need to keep the plain/text section as org syntax but I wasn't sure about others, so I just introduced the variable. I suppose the simple replacement would be a simpler patch. -- Jon Miller ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] org-mime: make plain/text mime export a choice 2015-09-01 15:46 ` Jon Miller @ 2015-09-01 21:01 ` Jon Miller 0 siblings, 0 replies; 14+ messages in thread From: Jon Miller @ 2015-09-01 21:01 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: emacs-orgmode Jon Miller writes: > Nicolas Goaziou writes: > >> Hello, >> >> Jon Miller <jonebird@gmail.com> writes: >> >>> 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. >> >> Thank you for the patch. >> >> Is there any reason to keep using "org" exporter if "ascii" is superior? >> I.e., what about simply replacing 'org with 'ascii? > > That's a good question. I personally don't think I'd ever need to keep the > plain/text section as org syntax but I wasn't sure about others, so I just > introduced the variable. I suppose the simple replacement would be a simpler > patch. (My org ML subscription is daily digest but have read other replies regarding the latin1 or utf-8 additional options) After trying to include those options, I realized that the export options of latin1 or utf-8 are actually using the same ascii exporter, correct? That is, I can not use either value as-in in the call to (org-export-string-as ...) To support the other options, it appears that we'd have to change the function being used and I'm not sure which direction to take from there. I'd be willing to hack on it further if I could get a hint as to what to use. -- Jon Miller ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] org-mime: make plain/text mime export a choice 2015-09-01 7:19 ` Nicolas Goaziou 2015-09-01 8:07 ` Eric Abrahamsen 2015-09-01 15:46 ` Jon Miller @ 2015-09-02 18:57 ` Will O'Brien 2015-09-04 0:30 ` Jon Miller 2 siblings, 1 reply; 14+ messages in thread From: Will O'Brien @ 2015-09-02 18:57 UTC (permalink / raw) To: Jon Miller, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 792 bytes --] On 1 Sep 2015 08:18, "Nicolas Goaziou" <mail@nicolasgoaziou.fr> wrote: > > Is there any reason to keep using "org" exporter if "ascii" is superior? > I.e., what about simply replacing 'org with 'ascii? > FWIW There's a nice use case for exporting as org. If I compose an email which includes source code and I send it to a mixed audience, some of whom use gnus, and others an html based mua, then I get best of both worlds in terms of syntax highlighting, since gnus recognises org src blocks and applies appropriate highlighting and those using some other mua get the html highlighting as dictated by my own scheme. This also applies for a single recipient who may access email through gnus when available but needs the html version for viewing on, e.g. a handheld device. Cheers, Will [-- Attachment #2: Type: text/html, Size: 1026 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] org-mime: make plain/text mime export a choice 2015-09-02 18:57 ` Will O'Brien @ 2015-09-04 0:30 ` Jon Miller 2015-09-04 18:57 ` Nicolas Goaziou 0 siblings, 1 reply; 14+ messages in thread From: Jon Miller @ 2015-09-04 0:30 UTC (permalink / raw) To: Will O'Brien; +Cc: emacs-orgmode Will O'Brien writes: > On 1 Sep 2015 08:18, "Nicolas Goaziou" <mail@nicolasgoaziou.fr> wrote: >> >> Is there any reason to keep using "org" exporter if "ascii" is superior? >> I.e., what about simply replacing 'org with 'ascii? >> > > FWIW > > There's a nice use case for exporting as org. If I compose an email which > includes source code and I send it to a mixed audience, some of whom use > gnus, and others an html based mua, then I get best of both worlds in terms > of syntax highlighting, since gnus recognises org src blocks and applies > appropriate highlighting and those using some other mua get the html > highlighting as dictated by my own scheme. > > This also applies for a single recipient who may access email through gnus > when available but needs the html version for viewing on, e.g. a handheld > device. Okay, thanks. I figured at least a few people would prefer to keep the plain/text portion in org mode syntax and why I went with the configuration option route. At this point, I'm not sure if there is any further hacking left to be done to the original patch I sent? Are we okay with just leaving the two options of 'ascii and 'org? Thanks, -- Jon Miller ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] org-mime: make plain/text mime export a choice 2015-09-04 0:30 ` Jon Miller @ 2015-09-04 18:57 ` Nicolas Goaziou 2015-09-04 19:17 ` Jon Miller 0 siblings, 1 reply; 14+ messages in thread From: Nicolas Goaziou @ 2015-09-04 18:57 UTC (permalink / raw) To: Jon Miller; +Cc: Will O'Brien, emacs-orgmode Jon Miller <jonebird@gmail.com> writes: > At this point, I'm not sure if there is any further hacking left to be done > to the original patch I sent? Are we okay with just leaving the two options > of 'ascii and 'org? I don't think we're at a conclusion yet. In addition to providing ascii and org, we might also - provide org, ascii, latin-1 and utf8 - provide any symbol that will be understood as an export back-end WDYT? Regards, ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] org-mime: make plain/text mime export a choice 2015-09-04 18:57 ` Nicolas Goaziou @ 2015-09-04 19:17 ` Jon Miller 2015-09-05 8:49 ` Nicolas Goaziou 0 siblings, 1 reply; 14+ messages in thread From: Jon Miller @ 2015-09-04 19:17 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: Will O'Brien, emacs-orgmode Nicolas Goaziou writes: > Jon Miller <jonebird@gmail.com> writes: > >> At this point, I'm not sure if there is any further hacking left to be done >> to the original patch I sent? Are we okay with just leaving the two options >> of 'ascii and 'org? > > I don't think we're at a conclusion yet. In addition to providing ascii > and org, we might also > > - provide org, ascii, latin-1 and utf8 > - provide any symbol that will be understood as an export back-end > > WDYT? I'm willing to help hack out a solution. I just need a hint to help me along. - I specifically do not know how to produce a latin1 or utf8 export via the existing `org-export-string-as' function call that is being used. - As for updating the parameter to support any valid back-end, I assume that means updating the defcustom from a choice list to a symbol that is then later checked as a valid back-end and defaults to a simple choice when it is non-valid? -- Jon Miller ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] org-mime: make plain/text mime export a choice 2015-09-04 19:17 ` Jon Miller @ 2015-09-05 8:49 ` Nicolas Goaziou 0 siblings, 0 replies; 14+ messages in thread From: Nicolas Goaziou @ 2015-09-05 8:49 UTC (permalink / raw) To: Jon Miller; +Cc: Will O'Brien, emacs-orgmode Jon Miller <jonebird@gmail.com> writes: > I'm willing to help hack out a solution. I just need a hint to help me > along. > > - I specifically do not know how to produce a latin1 or utf8 export via the > existing `org-export-string-as' function call that is being used. Use EXT-PLIST argument, e.g., (org-export-string-as string 'ascii nil '(:ascii-charset utf-8)) (org-export-string-as string 'ascii nil '(:ascii-charset latin1)) (org-export-string-as string 'ascii nil '(:ascii-charset ascii)) > - As for updating the parameter to support any valid back-end, I assume that > means updating the defcustom from a choice list to a symbol that is then > later checked as a valid back-end and defaults to a simple choice when it > is non-valid? We could accept any symbol, try to (require 'ox-SYMBOL) and then (org-export-string-as string SYMBOL) Regards, ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2015-09-05 8:47 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <mailman.109.1441036833.32276.emacs-orgmode@gnu.org> 2015-09-01 0:55 ` [PATCH] org-mime: make plain/text mime export a choice Jon Miller 2015-09-01 7:19 ` 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
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).