From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: Possible to use src block to generate org headlines for export? Date: Thu, 24 Jul 2014 11:21:51 +0100 Message-ID: References: <87zjg1gddd.fsf@fastmail.fm> <87wqb4amqb.fsf@gmail.com> <8738dshkdw.fsf@fastmail.fm> <8761io2jnz.fsf@fastmail.fm> <87ha27a5ip.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAG9S-0003ms-Qw for emacs-orgmode@gnu.org; Thu, 24 Jul 2014 06:21:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XAG9L-0001J2-WC for emacs-orgmode@gnu.org; Thu, 24 Jul 2014 06:21:30 -0400 Received: from plane.gmane.org ([80.91.229.3]:47066) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAG9L-0001Iv-P2 for emacs-orgmode@gnu.org; Thu, 24 Jul 2014 06:21:23 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XAG9K-0002Rk-00 for emacs-orgmode@gnu.org; Thu, 24 Jul 2014 12:21:22 +0200 Received: from 193.63.222.28 ([193.63.222.28]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 24 Jul 2014 12:21:21 +0200 Received: from andreas.leha by 193.63.222.28 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 24 Jul 2014 12:21:21 +0200 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: emacs-orgmode@gnu.org Hi all, Nick Dokos writes: > Charles Berry writes: > >> Matt Lundin imapmail.org> writes: >> >> [deleted] >> >>> Footnotes: >>> >>> [fn:1] If one really needs to see the headlines in the original org >>> buffer, a hook can be used to remove the :RESULTS: drawer. >>> >>> --8<---------------cut here---------------start------------->8--- >>> (defun my-remove-stray-results-drawer (backend) >>> (when (eq backend 'html) >>> (while (re-search-forward "^\\s-*:RESULTS:\\s-*\n" nil t) >>> (replace-match "")))) >>> >>> (add-hook 'org-export-before-parsing-hook 'my-remove-results-drawer) >>> --8<---------------cut here---------------end--------------->8--- >>> >>> >> >> Or wrap the results in a drawer when you type C-c C-c, but render them as >> raw on export (which removes the drawer and replaces with raw results). >> >> Like so: >> >> #+header: :results (if (boundp 'backend) "raw" "drawer") >> #+BEGIN_SRC emacs-lisp :exports both >> >> (format "* headline\n1\n2\n5\n") >> #+END_SRC >> > > That's a very nice tip - one small weakness is that it'll do the wrong > thing if you just happen to have a binding for "backend" outside of the > export mechanism. Is that a valid feature request: Allow the combination of :results raw and :results replace -- regardless of the produced content? IIUC the parser does not allow this right now. But (without any knowledge on the parser) I can imagine 'special' results drawers that do not have any function/effect other than delimiting babel results (plus possibly folding). If these existed, I would even enable them by default no matter of 'raw' or not. Something like this: --8<---------------cut here---------------start------------->8--- #+name: some_code #+begin_src sh echo "hello world" #+end_src #+begin_results some_code : hello world #+end_results --8<---------------cut here---------------end--------------->8--- Regards, Andreas