From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Re: Possible to use src block to generate org headlines for export? Date: Tue, 22 Jul 2014 21:35:55 -0500 Message-ID: <8738dshkdw.fsf@fastmail.fm> References: <87zjg1gddd.fsf@fastmail.fm> <87wqb4amqb.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X9mPS-00026d-HR for emacs-orgmode@gnu.org; Tue, 22 Jul 2014 22:36:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X9mPN-0006W4-8O for emacs-orgmode@gnu.org; Tue, 22 Jul 2014 22:36:02 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:60977) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X9mPN-0006Vv-0P for emacs-orgmode@gnu.org; Tue, 22 Jul 2014 22:35:57 -0400 In-Reply-To: <87wqb4amqb.fsf@gmail.com> (Nick Dokos's message of "Tue, 22 Jul 2014 21:27:08 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nick Dokos Cc: emacs-orgmode@gnu.org Nick Dokos writes: >> >> In short, is there a more graceful and export-friendly way to use babel >> to generate org headlines for export? Or is there an easy way to get the >> export backend to delete the opening part of the drawer (i.e., >> :RESULTS:)? >> >> Any advice would be greatly appreciated. >> > > No solace for your pain alas. See > http://thread.gmane.org/gmane.emacs.orgmode/88557 > > My suggestion (as it was for Ronald, except that he had already rejected > it :-) ) would be to use raw: you lose the idempotency of results > production, but I don't know of any other problems. Thanks for the link. My ignorance of it shows how far behind I am on orgmode ML reading! I agree with Nicolas's argument that only headlines can contain headlines. That said, having the ability to generate org copy for export also seems useful. I wonder whether org-babel might take advantage of COMMENT headlines for org output: E.g. * COMMENT Here beginneth the results for code block named "do-some-magic" * COMMENT Here endeth the results for code block named "do-some-magic" Obviously, this could wreak havoc on ones outline structure, so some extra magic would be needed to set the correct headline level. However, since the headlines I'm generating are always at the end of the file, I've hacked my way to a solution with the following: --8<---------------cut here---------------start------------->8--- #+BEGIN_SRC emacs-lisp :exports none :results none (save-excursion (goto-char (point-min)) (while (re-search-forward "#\\+RESULTS: generate-blog-summary" nil t) (beginning-of-line) (delete-region (point) (point-max)))) #+END_SRC #+NAME: generate-blog-summary #+BEGIN_SRC perl :exports results :results output org raw print "* Headline One\n"; print "* Headline Two\n"; print "* Headline Three\n"; #+END_SRC --8<---------------cut here---------------end--------------->8--- Thus, each time I export, the emacs-lisp snippet nicely deletes the old results, making space for the new ones. Let's hope the real blog (when I get around to publishing it) is more interesting than the example above. ;) Best, Matt