[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [BUG] src_blocks - :results raw and replace don't work together
From: |
Thorsten Jolitz |
Subject: |
Re: [O] [BUG] src_blocks - :results raw and replace don't work together |
Date: |
Mon, 07 Jul 2014 13:04:14 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Thorsten Jolitz <address@hidden> writes:
> Andreas Leha <address@hidden> writes:
>
>> Hi Thorsten,
>>
>> Thorsten Jolitz <address@hidden> writes:
>>
>>> Hi List,
>>>
>>> evaluating this 3 times does not work as expected:
>>>
>>> ,----
>>> | * A
>>> |
>>> | #+header: :results raw replace
>>> | #+begin_src emacs-lisp
>>> | (+ 2 2)
>>> | #+end_src
>>> |
>>> | #+results:
>>> | 4
>>> | 4
>>> | 4
>>> `----
>>>
>>> Independent from argument order, 'replace' (which should be default
>>> anyway) is ignored.
>>
>>
>> Try adding the :wrap, which works for me:
>>
>> ,----
>> | * A
>> |
>> | #+header: :results raw replace :wrap
>> | #+begin_src emacs-lisp
>> | (+ 2 2)
>> | #+end_src
>> |
>> | #+results:
>> | #+BEGIN_RESULTS
>> | 4
>> | #+END_RESULTS
>> `----
>
> This actually works here too, thanks. But is this wrapping results block
> 'neutral', i.e. is its content treated just like raw Org syntax in all
> situations? E.g. when I create a dblock from elisp, would
>
> #+results:
> #+BEGIN_RESULTS
> #+begin my-dblock
> (foo)
> #+end
> #+END_RESULTS
>
> be equivalent to
>
> #+results:
> #+begin my-dblock
> (foo)
> #+end
>
> in all cases?
>
> However, the combo ':results raw replace' seems like the natural fit
> when programmatically creating content in an Org file with a src_block
> that might eventually be evaluated more than once. That it does not work
> 'as-is' seems too much of a surprise to not call it a bug (at least when
> the manual does not mention it as special case).
My use-case is actually this, and it won't work with wrapped results:
,----
| ** Utility Function :ARCHIVE:
|
| #+name: create-subtree-with-dblock
| #+header: :var name="foo"
| #+header: :var prms=":bar loo"
| #+header: :results replace raw
| #+begin_src emacs-lisp
| (format
| (concat "\n\n** Overview :READONLY:\n\n"
| "#+begin: %s %s\n\n#+end:\n")
| name prms)
| #+end_src
|
| #+results: dblock
|
|
| ** Overview :READONLY:
|
| #+begin: foo :bar loo
|
| #+end:
`----
--
cheers,
Thorsten
Re: [O] [BUG] src_blocks - :results raw and replace don't work together, Nick Dokos, 2014/07/07
Re: [O] [BUG] src_blocks - :results raw and replace don't work together, Thorsten Jolitz, 2014/07/07