emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] src_blocks - :results raw and replace don't work together
@ 2014-07-07  0:28 Thorsten Jolitz
  2014-07-07  1:41 ` Thomas S. Dye
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Thorsten Jolitz @ 2014-07-07  0:28 UTC (permalink / raw)
  To: emacs-orgmode


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.

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [BUG] src_blocks - :results raw and replace don't work together
  2014-07-07  0:28 [BUG] src_blocks - :results raw and replace don't work together Thorsten Jolitz
@ 2014-07-07  1:41 ` Thomas S. Dye
  2014-07-07  2:03   ` Thorsten Jolitz
  2014-07-07  9:29 ` Andreas Leha
  2014-07-07 13:56 ` Nick Dokos
  2 siblings, 1 reply; 19+ messages in thread
From: Thomas S. Dye @ 2014-07-07  1:41 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: emacs-orgmode

Aloha Thorsten,

Thorsten Jolitz <tjolitz@gmail.com> 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.

If you give the source code block a name, it should work as expected.

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [BUG] src_blocks - :results raw and replace don't work together
  2014-07-07  1:41 ` Thomas S. Dye
@ 2014-07-07  2:03   ` Thorsten Jolitz
  2014-07-07 13:48     ` Thomas S. Dye
  0 siblings, 1 reply; 19+ messages in thread
From: Thorsten Jolitz @ 2014-07-07  2:03 UTC (permalink / raw)
  To: emacs-orgmode

tsd@tsdye.com (Thomas S. Dye) writes:

Hi Thomas,

> Thorsten Jolitz <tjolitz@gmail.com> 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.
>
> If you give the source code block a name, it should work as expected.

Not over here - does it work for you?

,----
| * A
| 
| #+name: foo
| #+header: :results raw replace
| #+begin_src emacs-lisp 
|   (+ 2 2)
| #+end_src
| 
| #+results: foo
| 4
| 4
| 4
`----

BTW, even if it would work with a name, it should work without too IMO.

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [BUG] src_blocks - :results raw and replace don't work together
  2014-07-07  0:28 [BUG] src_blocks - :results raw and replace don't work together Thorsten Jolitz
  2014-07-07  1:41 ` Thomas S. Dye
@ 2014-07-07  9:29 ` Andreas Leha
  2014-07-07 10:15   ` Thorsten Jolitz
  2014-07-07 13:56 ` Nick Dokos
  2 siblings, 1 reply; 19+ messages in thread
From: Andreas Leha @ 2014-07-07  9:29 UTC (permalink / raw)
  To: emacs-orgmode

Hi Thorsten,

Thorsten Jolitz <tjolitz@gmail.com> 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
`----


Regards,
Andreas

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [BUG] src_blocks - :results raw and replace don't work together
  2014-07-07  9:29 ` Andreas Leha
@ 2014-07-07 10:15   ` Thorsten Jolitz
  2014-07-07 11:04     ` Thorsten Jolitz
  0 siblings, 1 reply; 19+ messages in thread
From: Thorsten Jolitz @ 2014-07-07 10:15 UTC (permalink / raw)
  To: emacs-orgmode

Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:

> Hi Thorsten,
>
> Thorsten Jolitz <tjolitz@gmail.com> 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).

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [BUG] src_blocks - :results raw and replace don't work together
  2014-07-07 10:15   ` Thorsten Jolitz
@ 2014-07-07 11:04     ` Thorsten Jolitz
  2014-07-07 11:16       ` Andreas Leha
  0 siblings, 1 reply; 19+ messages in thread
From: Thorsten Jolitz @ 2014-07-07 11:04 UTC (permalink / raw)
  To: emacs-orgmode

Thorsten Jolitz <tjolitz@gmail.com> writes:

> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>
>> Hi Thorsten,
>>
>> Thorsten Jolitz <tjolitz@gmail.com> 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

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [BUG] src_blocks - :results raw and replace don't work together
  2014-07-07 11:04     ` Thorsten Jolitz
@ 2014-07-07 11:16       ` Andreas Leha
  2014-07-07 11:59         ` Thorsten Jolitz
  0 siblings, 1 reply; 19+ messages in thread
From: Andreas Leha @ 2014-07-07 11:16 UTC (permalink / raw)
  To: emacs-orgmode

Hi Thorsten,


Thorsten Jolitz <tjolitz@gmail.com> writes:

> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>>
>>> Hi Thorsten,
>>>
>>> Thorsten Jolitz <tjolitz@gmail.com> 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:
> `----


I am not in the position to answer this.  But the combo "raw replace" is
problematic, I think, in that it is hard to say how much there is to be
replaced.  So I think some delimiters (as produced by :wrap) are
necesarry in the general case.

If I understand correctly, you want to nest blocks: A source block
nested in a results block.  I think, that is not possible.  So, for that
use case, I guess, another construct (other than results block) would be
necessary.

But other people might have the proper answer here...

Regards,
Andreas

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [BUG] src_blocks - :results raw and replace don't work together
  2014-07-07 11:16       ` Andreas Leha
@ 2014-07-07 11:59         ` Thorsten Jolitz
  0 siblings, 0 replies; 19+ messages in thread
From: Thorsten Jolitz @ 2014-07-07 11:59 UTC (permalink / raw)
  To: emacs-orgmode

Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:

> Hi Thorsten,

>> 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:
>> `----
>
>
> I am not in the position to answer this.  But the combo "raw replace" is
> problematic, I think, in that it is hard to say how much there is to be
> replaced.  So I think some delimiters (as produced by :wrap) are
> necesarry in the general case.

I really don't want to dig into the Org Babel internals here, but that
might well be the reason, since inserting multi-line raw Org syntax into
the buffer makes it hard to tell whats new and whats old without some
extra work/bookkeeping (doing a diff or so ...). 

> If I understand correctly, you want to nest blocks: A source block
> nested in a results block.  I think, that is not possible.  So, for that
> use case, I guess, another construct (other than results block) would be
> necessary.

Is a single 

,----
| #+results: dblock
`----

line seen as block (together will the following results)? Would surprise
me, but I don't know.

I don't want to nest blocks, I want to insert plain raw Org syntax into
the buffer that is subsequently treated just like the other content I
typed in by hand before (assuming the the leading #+results: line does
not affect the contents usual interpretation).

Maybe I'm bending Org-modes flexibility a bit too much here, but this
is my real-world use-case.

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [BUG] src_blocks - :results raw and replace don't work together
  2014-07-07  2:03   ` Thorsten Jolitz
@ 2014-07-07 13:48     ` Thomas S. Dye
  0 siblings, 0 replies; 19+ messages in thread
From: Thomas S. Dye @ 2014-07-07 13:48 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: emacs-orgmode

Thorsten Jolitz <tjolitz@gmail.com> writes:

>> If you give the source code block a name, it should work as expected.
>
> Not over here - does it work for you?

No.  Sorry for the noise.

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [BUG] src_blocks - :results raw and replace don't work together
  2014-07-07  0:28 [BUG] src_blocks - :results raw and replace don't work together Thorsten Jolitz
  2014-07-07  1:41 ` Thomas S. Dye
  2014-07-07  9:29 ` Andreas Leha
@ 2014-07-07 13:56 ` Nick Dokos
  2014-07-07 14:54   ` Grant Rettke
                     ` (2 more replies)
  2 siblings, 3 replies; 19+ messages in thread
From: Nick Dokos @ 2014-07-07 13:56 UTC (permalink / raw)
  To: emacs-orgmode

Thorsten Jolitz <tjolitz@gmail.com> 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.

Right - `raw' inserts results without delimiters so org has no idea
where they end and cannot delete them (try org-babel-remove-result)
or replace them.
-- 
Nick

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [BUG] src_blocks - :results raw and replace don't work together
  2014-07-07 13:56 ` Nick Dokos
@ 2014-07-07 14:54   ` Grant Rettke
  2014-07-07 15:31     ` Thorsten Jolitz
  2014-07-07 15:40   ` Thorsten Jolitz
  2014-08-04  1:20   ` Eric Schulte
  2 siblings, 1 reply; 19+ messages in thread
From: Grant Rettke @ 2014-07-07 14:54 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode@gnu.org

It sounds like you wanted the same thing that I did.

What I wanted is something like running 'script' before starting a
REPL and just capturing the output and that is it. That output is not
being used to be inserted back into the document or anything... it
just captured the results of commands sent into the REPL.

I tried a lot of different combinations until I felt like my goal was simple:
1. Wrap the output.
2. Put the output in a "sh" type result, something from the shell
3. Let replace work

This is what was the best:

,----
| #+PROPERTY: header-args+    :results output scalar pp replace
`----
Grant Rettke | ACM, ASA, FSF, IEEE, SIAM
gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson


On Mon, Jul 7, 2014 at 8:56 AM, Nick Dokos <ndokos@gmail.com> wrote:
> Thorsten Jolitz <tjolitz@gmail.com> 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.
>
> Right - `raw' inserts results without delimiters so org has no idea
> where they end and cannot delete them (try org-babel-remove-result)
> or replace them.
> --
> Nick
>
>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [BUG] src_blocks - :results raw and replace don't work together
  2014-07-07 14:54   ` Grant Rettke
@ 2014-07-07 15:31     ` Thorsten Jolitz
  2014-07-07 23:40       ` Grant Rettke
  2014-07-08  2:01       ` Nick Dokos
  0 siblings, 2 replies; 19+ messages in thread
From: Thorsten Jolitz @ 2014-07-07 15:31 UTC (permalink / raw)
  To: emacs-orgmode

Grant Rettke <gcr@wisdomandwonder.com> writes:

> It sounds like you wanted the same thing that I did.
>
> What I wanted is something like running 'script' before starting a
> REPL and just capturing the output and that is it. That output is not
> being used to be inserted back into the document or anything... it
> just captured the results of commands sent into the REPL.
>
> I tried a lot of different combinations until I felt like my goal was
> simple:
> 1. Wrap the output.
> 2. Put the output in a "sh" type result, something from the shell
> 3. Let replace work
>
> This is what was the best:
>
> ,----
> | #+PROPERTY: header-args+    :results output scalar pp replace
> `----

Nice trick, it gets very close to what I want (and I start to get this
:header-args+, :results+ ... syntax):

,----
| #+results: dblock
| : 
| : 
| : ** Overview :READONLY:
| : 
| : #+begin: foo :bar loo
| : 
| : #+end:
`----

Have you found a way to get rid of those leading colons (maybe with a
hook for post-processing the results before they are printed or so)?


> Grant Rettke | ACM, ASA, FSF, IEEE, SIAM
> gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/
> “Wisdom begins in wonder.” --Socrates
> ((λ (x) (x x)) (λ (x) (x x)))
> “Life has become immeasurably better since I have been forced to stop
> taking it seriously.” --Thompson
>
>
> On Mon, Jul 7, 2014 at 8:56 AM, Nick Dokos <ndokos@gmail.com> wrote:
>> Thorsten Jolitz <tjolitz@gmail.com> 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.
>>
>> Right - `raw' inserts results without delimiters so org has no idea
>> where they end and cannot delete them (try org-babel-remove-result)
>> or replace them.
>> --
>> Nick
>>
>>
>
>

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [BUG] src_blocks - :results raw and replace don't work together
  2014-07-07 13:56 ` Nick Dokos
  2014-07-07 14:54   ` Grant Rettke
@ 2014-07-07 15:40   ` Thorsten Jolitz
  2014-07-28 13:59     ` Sebastien Vauban
  2014-08-04  1:20   ` Eric Schulte
  2 siblings, 1 reply; 19+ messages in thread
From: Thorsten Jolitz @ 2014-07-07 15:40 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <ndokos@gmail.com> writes:

> Thorsten Jolitz <tjolitz@gmail.com> 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.
>
> Right - `raw' inserts results without delimiters so org has no idea
> where they end and cannot delete them (try org-babel-remove-result)
> or replace them.

ok, I see 

from `org-babel-remove-result':
,----
| (when (looking-at (concat org-babel-result-regexp ".*$")) ...)
`----

seems a bit tricky to adapt this to 'raw results ... 

But at least there should be a hint in the manual that ':results raw
replace' is not supposed to work, and what would be a possible
workaround.

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [BUG] src_blocks - :results raw and replace don't work together
  2014-07-07 15:31     ` Thorsten Jolitz
@ 2014-07-07 23:40       ` Grant Rettke
  2014-07-08  2:01       ` Nick Dokos
  1 sibling, 0 replies; 19+ messages in thread
From: Grant Rettke @ 2014-07-07 23:40 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: emacs-orgmode@gnu.org

On Mon, Jul 7, 2014 at 10:31 AM, Thorsten Jolitz <tjolitz@gmail.com> wrote:
> Have you found a way to get rid of those leading colons (maybe with a
> hook for post-processing the results before they are printed or so)?

No I have not. I'm not sure how to think about it yet.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [BUG] src_blocks - :results raw and replace don't work together
  2014-07-07 15:31     ` Thorsten Jolitz
  2014-07-07 23:40       ` Grant Rettke
@ 2014-07-08  2:01       ` Nick Dokos
  1 sibling, 0 replies; 19+ messages in thread
From: Nick Dokos @ 2014-07-08  2:01 UTC (permalink / raw)
  To: emacs-orgmode

Thorsten Jolitz <tjolitz@gmail.com> writes:

> Grant Rettke <gcr@wisdomandwonder.com> writes:
>
>> It sounds like you wanted the same thing that I did.
>>
>> What I wanted is something like running 'script' before starting a
>> REPL and just capturing the output and that is it. That output is not
>> being used to be inserted back into the document or anything... it
>> just captured the results of commands sent into the REPL.
>>
>> I tried a lot of different combinations until I felt like my goal was
>> simple:
>> 1. Wrap the output.
>> 2. Put the output in a "sh" type result, something from the shell
>> 3. Let replace work
>>
>> This is what was the best:
>>
>> ,----
>> | #+PROPERTY: header-args+    :results output scalar pp replace
>> `----
>
> Nice trick, it gets very close to what I want (and I start to get this
> :header-args+, :results+ ... syntax):
>
> ,----
> | #+results: dblock
> | : 
> | : 
> | : ** Overview :READONLY:
> | : 
> | : #+begin: foo :bar loo
> | : 
> | : #+end:
> `----
>
> Have you found a way to get rid of those leading colons (maybe with a
> hook for post-processing the results before they are printed or so)?
>
>

Output shorter than org-babel-min-lines-for-block-output (10 by default)
is colon-commented. If it's longer, then it's wrapped in an example
block. If you prefer that always, set it to 0.

Nick

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [BUG] src_blocks - :results raw and replace don't work together
  2014-07-07 15:40   ` Thorsten Jolitz
@ 2014-07-28 13:59     ` Sebastien Vauban
  2014-07-28 14:46       ` Thorsten Jolitz
  0 siblings, 1 reply; 19+ messages in thread
From: Sebastien Vauban @ 2014-07-28 13:59 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Thorsten Jolitz wrote:
> Nick Dokos <ndokos-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
>> Thorsten Jolitz <tjolitz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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.
>>
>> Right - `raw' inserts results without delimiters so org has no idea
>> where they end and cannot delete them (try org-babel-remove-result)
>> or replace them.
>
> ok, I see 
>
> from `org-babel-remove-result':
> ,----
> | (when (looking-at (concat org-babel-result-regexp ".*$")) ...)
> `----
>
> seems a bit tricky to adapt this to 'raw results ... 
>
> But at least there should be a hint in the manual that ':results raw
> replace' is not supposed to work, and what would be a possible
> workaround.

Workarounds:

- A block wrapper makes it possible for the entirety of the results to
  be clearly located, regardless of their contents, and replaced (with
  new results) by Babel upon code block re-evaluation, or

- :results drawer

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [BUG] src_blocks - :results raw and replace don't work together
  2014-07-28 13:59     ` Sebastien Vauban
@ 2014-07-28 14:46       ` Thorsten Jolitz
  0 siblings, 0 replies; 19+ messages in thread
From: Thorsten Jolitz @ 2014-07-28 14:46 UTC (permalink / raw)
  To: emacs-orgmode

Sebastien Vauban <sva-news@mygooglest.com>
writes:

> Thorsten Jolitz wrote:
>> Nick Dokos <ndokos@gmail.com> writes:
>>
>>> Thorsten Jolitz <tjolitz@gmail.com>
>>> 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.
>>>
>>> Right - `raw' inserts results without delimiters so org has no idea
>>> where they end and cannot delete them (try org-babel-remove-result)
>>> or replace them.
>>
>> ok, I see 
>>
>> from `org-babel-remove-result':
>> ,----
>> | (when (looking-at (concat org-babel-result-regexp ".*$")) ...)
>> `----
>>
>> seems a bit tricky to adapt this to 'raw results ... 
>>
>> But at least there should be a hint in the manual that ':results raw
>> replace' is not supposed to work, and what would be a possible
>> workaround.
>
> Workarounds:
>
> - A block wrapper makes it possible for the entirety of the results to
>   be clearly located, regardless of their contents, and replaced (with
>   new results) by Babel upon code block re-evaluation, or
>
> - :results drawer

Thx. I somehow remember that my problem was related to the recently
discussed issue of creating new headlines as results of source blocks,
and to the fact that only headlines can contain headlines, so wrapping
in blocks and drawers does not really work.

I finally solved that problem for me by simply inserting the new headers
from Emacs Lisp without using Org-Babel, although a few workarounds were
proposed in the mentioned thread on this mailing list (a real solution
too? unfortunately lost track ...). 

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [BUG] src_blocks - :results raw and replace don't work together
  2014-07-07 13:56 ` Nick Dokos
  2014-07-07 14:54   ` Grant Rettke
  2014-07-07 15:40   ` Thorsten Jolitz
@ 2014-08-04  1:20   ` Eric Schulte
  2014-08-06  1:15     ` Thorsten Jolitz
  2 siblings, 1 reply; 19+ messages in thread
From: Eric Schulte @ 2014-08-04  1:20 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

Nick Dokos <ndokos@gmail.com> writes:

> Thorsten Jolitz <tjolitz@gmail.com> 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.
>
> Right - `raw' inserts results without delimiters so org has no idea
> where they end and cannot delete them (try org-babel-remove-result)
> or replace them.

Well said Nick, this is a natural limitation.  See the "drawer" portion
of the following page of the manual.

  (info "(org)Results")

In general checking the manual before posting to the ML is a good idea.

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [BUG] src_blocks - :results raw and replace don't work together
  2014-08-04  1:20   ` Eric Schulte
@ 2014-08-06  1:15     ` Thorsten Jolitz
  0 siblings, 0 replies; 19+ messages in thread
From: Thorsten Jolitz @ 2014-08-06  1:15 UTC (permalink / raw)
  To: emacs-orgmode

Eric Schulte <schulte.eric@gmail.com> writes:

> In general checking the manual before posting to the ML is a good idea.

You (voluntarily) write a meaningless one-liner and then complain I
wasted 10sec of you lifetime by not ReadingTFM - come on ...

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2014-08-06  1:20 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-07  0:28 [BUG] src_blocks - :results raw and replace don't work together Thorsten Jolitz
2014-07-07  1:41 ` Thomas S. Dye
2014-07-07  2:03   ` Thorsten Jolitz
2014-07-07 13:48     ` Thomas S. Dye
2014-07-07  9:29 ` Andreas Leha
2014-07-07 10:15   ` Thorsten Jolitz
2014-07-07 11:04     ` Thorsten Jolitz
2014-07-07 11:16       ` Andreas Leha
2014-07-07 11:59         ` Thorsten Jolitz
2014-07-07 13:56 ` Nick Dokos
2014-07-07 14:54   ` Grant Rettke
2014-07-07 15:31     ` Thorsten Jolitz
2014-07-07 23:40       ` Grant Rettke
2014-07-08  2:01       ` Nick Dokos
2014-07-07 15:40   ` Thorsten Jolitz
2014-07-28 13:59     ` Sebastien Vauban
2014-07-28 14:46       ` Thorsten Jolitz
2014-08-04  1:20   ` Eric Schulte
2014-08-06  1:15     ` Thorsten Jolitz

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).