emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Creating new org headers from code blocks


From: Rainer M Krug
Subject: Re: [O] Creating new org headers from code blocks
Date: Fri, 19 Sep 2014 14:55:32 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin)

Thorsten Jolitz <address@hidden> writes:

> Rainer M Krug <address@hidden> writes:
>
>> Thorsten Jolitz <address@hidden> 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", "and 
>>> some text" )
>>> #+end_src
>>>
>>> #+results:
>>> : ** New header2
>>> : [[./graph1.pdf]]
>>> : 
>>> : ** and second header
>>> : and some text

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

Attachment: pgp7XNVtzLjTV.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]