From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Re: Creating new org headers from code blocks Date: Fri, 19 Sep 2014 14:43:01 +0200 Message-ID: <87r3z7aii2.fsf@gmail.com> References: <87zjdval5t.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48952) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUxXB-0002SF-23 for emacs-orgmode@gnu.org; Fri, 19 Sep 2014 08:43:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUxX0-0001tp-KW for emacs-orgmode@gnu.org; Fri, 19 Sep 2014 08:43:33 -0400 Received: from plane.gmane.org ([80.91.229.3]:47840) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUxX0-0001rx-6n for emacs-orgmode@gnu.org; Fri, 19 Sep 2014 08:43:22 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XUxWu-0006Pn-1A for emacs-orgmode@gnu.org; Fri, 19 Sep 2014 14:43:16 +0200 Received: from e178189109.adsl.alicedsl.de ([85.178.189.109]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 19 Sep 2014 14:43:16 +0200 Received: from tjolitz by e178189109.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 19 Sep 2014 14:43:16 +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 Rainer M Krug writes: > Thorsten Jolitz writes: > I don't quite understand your code below and what it is supposed to do. Drawers are probably better in most cases, but this code lets you use ':results pp replace' while developing, but converts the fixed-width pp results into raw results when desired (e.g. in a buffer copy before some action is taken). >> #+BEGIN_SRC emacs-lisp :results none >> (defvar tj/fixed-width-to-raw-langs '("R") >> "List of Babel langs for `tj/fixed-width-to-raw-results'.") >> >> (defun tj/fixed-width-to-raw-results () >> "Call `org-toggle-fixed-width' on ':results pp'." >> (org-babel-map-src-blocks nil >> (and (member lang tj/toggle-fixed-width-src-block-langs) >> (member "pp" (split-string header-args " " t)) >> (save-excursion >> (goto-char (org-babel-where-is-src-block-result)) >> (forward-line) >> (while (org-in-fixed-width-region-p) >> (org-toggle-fixed-width) >> (forward-line)))))) >> >> #+END_SRC >> #+begin_src R :results pp replace >> c("** New header2", "[[./graph1.pdf]]", "", "** and second header", "and some text" ) >> #+end_src >> >> #+results: >> : ** New header2 >> : [[./graph1.pdf]] >> : >> : ** and second header >> : and some text -- cheers, Thorsten