From mboxrd@z Thu Jan 1 00:00:00 1970 From: Niels Giesen Subject: [Niels Giesen] Re: Re: Sending org buffer as mail? Date: Mon, 27 Dec 2010 17:32:37 +0100 Message-ID: <87d3on18ii.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from [140.186.70.92] (port=59612 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PXG17-0004Hj-02 for emacs-orgmode@gnu.org; Mon, 27 Dec 2010 11:33:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PXG0g-0005C3-3U for emacs-orgmode@gnu.org; Mon, 27 Dec 2010 11:33:23 -0500 Received: from mail-ey0-f169.google.com ([209.85.215.169]:57427) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PXG0f-0005Br-Nk for emacs-orgmode@gnu.org; Mon, 27 Dec 2010 11:33:22 -0500 Received: by eyh6 with SMTP id 6so1125823eyh.0 for ; Mon, 27 Dec 2010 08:33:20 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: message/rfc822 Content-Disposition: inline Return-Path: Received: from matroshka.gmail.com (237pc207.sshunet.nl [145.97.207.237]) by mx.google.com with ESMTPS id t5sm8983187eeh.2.2010.12.27.08.27.46 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 27 Dec 2010 08:27:46 -0800 (PST) From: Niels Giesen To: "Eric Schulte" Subject: Re: [Orgmode] Re: Sending org buffer as mail? References: <87oc8huycc.fsf@gmail.com> <87vd2mu9qg.fsf@gmail.com> <87d3oni7pw.fsf@gmail.com> Date: Mon, 27 Dec 2010 17:27:05 +0100 In-Reply-To: <87d3oni7pw.fsf@gmail.com> (Eric Schulte's message of "Mon, 27 Dec 2010 07:53:47 -0700") Message-ID: <87hbdz18rq.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain "Eric Schulte" writes: > Niels Giesen writes: > >> "Eric Schulte" writes: >> >>> Niels Giesen writes: >>> >>>> "Eric Schulte" writes: >>>> >>>>> Thanks, I've just pushed up a new version of org-mime which makes use of >>>>> this function. >>>> >> >> Hi Eric, thanks for implementing this. >> >> However, I see a problem in the solution for when html-ascii is >> specified as the MAIL_FMT, being that the same hook will be run for both >> parts of the message. I think it better not to have a html-ascii hook >> and run the html hook for the html part and the ascii hook for the ascii >> part. Otherwise the ascii hook may for instance delete a =BEGIN_SRC= >> line and insert cut lines not needed by html. >> >> Same goes for html (which is in fact html-org). Although I cannot really >> think of any hooks I might want to run there. >> > > Thanks for pointing this out. I've just pushed up a fix which > implements a single hook for each format, and (as you suggested) runs > each hook over only the related mime part of the message. > Thanks. I think I noticed a bug though, being that `org-mime-pre-html-hook' is run for the ascii and org parts of html-ascii and org. The code below should fix this: #+begin_src diff Changes in HEAD Modified contrib/lisp/org-mime.el diff --git a/contrib/lisp/org-mime.el b/contrib/lisp/org-mime.el index 48c898e..68a3498 100644 --- a/contrib/lisp/org-mime.el +++ b/contrib/lisp/org-mime.el @@ -293,7 +293,8 @@ export that region, otherwise export the entire body." (html (org-mime-apply-html-hook (car html-and-images)))) (insert (org-mime-multipart (org-export-string - (org-babel-trim (bhook body 'html)) + (org-babel-trim + (bhook body (if (eq fmt 'html) 'org 'ascii))) (if (eq fmt 'html) 'org 'ascii)) html) (mapconcat 'identity images "\n")))))))) #+end_src >> >> I'll take a look at the link you gave for "Org-mode block fontification" >> in gnus, although that seems like a solution for the receiving side, and >> most of my peers do not run gnus and org, or emacs for that matter, but >> many do want to receive mail in plain text. >> > > I like the 'html option for situations like this, as a fontified html > version of the email is sent for normal users, however an org format > exports is supplied as a mime alternative, so users who have instructed > their email clients to prefer plain text will be presented with the > plain text org syntax. In my wildest of dreams the org-mode begin_src > syntax could be adopted as a plain-text standard for setting off source > code, so that email clients other than gnus could begin providing for > their own fontification of such blocks. > Now that would be something wild indeed. Of course the upside of org syntax is that even if nothing is done with it automatically, the human reader at least has a hint as to what language is used in the code block, and in that regard it is better than ascii with nondescript scissor lines. I just might have to revisit my earlier stance on this... >> >> On the subject of encouraging so-called code blocks brought to our >> attention by Samuel, encouraging this was not my intention, I should >> have thought better before posting and I will never in my life post such >> immoral examples anymore. >> > > Your consideration is much appreciated. :) > >> >> Regards, >> >> Niels >> >>>> [...] >>>> >>>> Hi Eric, >>>> >>>> I love the org-mime-subtree function! It makes writing good-looking >>>> mails very easy. >>>> >>>> Now for a proposal: >>>> >>>> For ascii export used for mail, it would be cool if SRC and EXAMPLE >>>> blocks be surrounded by "cut here" scissor lines. They look well in gnus >>>> for example: >>>> >>> >>> For even better looking code in gnus, I personally prefer to use org as >>> my export target (rather than ascii), and with "Org-mode code block >>> fontification" configuration from >>> http://eschulte.github.com/emacs-starter-kit/starter-kit-gnus.html >>> code blocks inside org-mode markup will be correctly fontified in gnus >>> messages. >>> >>>> >>>> code or example here >>>> >>>> Maybe the best way to achieve this is to define a hook before the string >>>> is sent to `org-export-string' with the FMT arg set to 'ascii, so that >>>> people can define their own functions. For instance, there are also >>>> people who prefer a block like >>>> >>> >>> good idea, I've just added a series of hooks to org-mime which will be >>> called in a temporary buffer holding the text to be exported, so you >>> could add a function here to add scissor lines around code blocks. Like >>> Sam I would discourage the use of boxquotes for anything that users may >>> want to cut and paste. For ascii use the `org-mime-pre-ascii-hook'. >>> >>> If you come up with useful hooks it may be nice to share them on worg at >>> http://orgmode.org/worg/org-contrib/org-mime.php >>> >>>> >>>> ,----[ emacs-lisp ] >>>> | source here >>>> `---- >>>> >>>> What do you think? >>>> >>>> Regards, >>>> >>>> Niels. >>> >>> Thanks for the suggestion -- Eric >>> >>> --=-=-= Content-Type: text/plain -- http://pft.github.com/ (forwarding message to the list as I forgot to do a wide reply) --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --=-=-=--