From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: Creating new org headers from code blocks Date: Fri, 19 Sep 2014 14:55:32 +0200 Message-ID: References: <87zjdval5t.fsf@gmail.com> <87r3z7aii2.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUxj7-0004gj-4y for emacs-orgmode@gnu.org; Fri, 19 Sep 2014 08:55:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUxj0-0004ml-N8 for emacs-orgmode@gnu.org; Fri, 19 Sep 2014 08:55:53 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:62797) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUxj0-0004ll-GT for emacs-orgmode@gnu.org; Fri, 19 Sep 2014 08:55:46 -0400 Received: by mail-wi0-f181.google.com with SMTP id bs8so804390wib.2 for ; Fri, 19 Sep 2014 05:55:40 -0700 (PDT) In-Reply-To: <87r3z7aii2.fsf@gmail.com> (Thorsten Jolitz's message of "Fri, 19 Sep 2014 14:43:01 +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: Thorsten Jolitz Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Thorsten Jolitz writes: > 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). OK - I see. But what is the advantage in this approach? Drawer do perfectly what I want, i.e. encapsulating an org structure in a for replacement when re-calculated, inside the drawer they behave like normal org structure (folding, ...) and upon export they are exported as org code would be - or am I missing something? Rainer > >>> #+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", "a= nd some text" ) >>> #+end_src >>> >>> #+results: >>> : ** New header2 >>> : [[./graph1.pdf]] >>> :=20 >>> : ** and second header >>> : and some text =2D-=20 Rainer M. Krug email: Rainerkrugsde PGP: 0x0F52F982 --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) iQEcBAEBAgAGBQJUHCfJAAoJENvXNx4PUvmCSQsIAJMjd0OpQ9hPa1DeMkJ8yiYL XeW4kAChMiXPXZfCMHOXaBYI9zsN+LqHSvdw6kf2HcoRVUMuOTCPOu/7Ks3KnCDL L/mXqSzC2OhYVNuONPn0b5DgDyCfSopEKx5jQgbkNU6GJgHrXuHrpFQU46pIIAgv obp+bEQSN/yFvffvfcAv2hU2Yhoc+w2WJl1zdqaTUiJL0uirAxGjQ5lIhGABsB10 GNREQkB0h+hHH1wO0VI2auHUKd6BYzaiWJqcyDagUnpcezT1TlWgnBfJykzAkiDT +k4ZW+L6RrdukWmlWZo9KEC2J6BwgkQh+fk7mmnJk5CA5E53H4Ru9/9fqic9wg8= =E9VK -----END PGP SIGNATURE----- --=-=-=--