emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [bugs] Export to HTML requires issuing org-babel-execute-buffer;


From: Eric Schulte
Subject: Re: [O] [bugs] Export to HTML requires issuing org-babel-execute-buffer; results replace fails
Date: Fri, 27 Jan 2012 15:43:33 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Leo Alekseyev <address@hidden> writes:

>>
>> If /inline blocks/ above don't replace their results above then that is
>> expected.  If you can find instances where call lines or blocks don't
>> replace their results then that is a bug.
>
> Yes, I was finding that neither inline nor regular blocks replace: run
> the following with C-c C-v b a few times and look at the block output
>
> -----snip------
> #+property: session *R-babel*
>
> #+NAME: foo
> #+HEADER: :var a="a1.png"
> #+BEGIN_SRC R :results output silent
>   cat("in foo block\n")
>   cat.a <- function() { cat(a,"\n",sep="") }
>   cat.a()
> #+END_SRC
> #+call: foo(a="a1.png")
>
> #+begin_src R :results output raw replace :exports results
>  cat.a()
> #+end_src
> ----------snip---------
>

OK, I see what you mean.  When I evaluate this buffer multiple times the
results of the #+call: line *are* replaced as expected, but the final
code block can not replace it's results because of the "raw" option to
the :results header argument.  The "raw" and "replace" header arguments
are not compatible because with raw results there is no way to know
where the results end.  I believe this is mentioned in the manual, if
not it should be.

>
>
>>
>>>
>>> Finally, in the last file of my original message I try to use #+call's
>>> everywhere instead of source blocks.  Cleaned up example is pasted
>>> below.  It looks broken (the first #+call bar is out of order, the
>>> second and third #+call bar's don't run), see
>>> http://pastebin.com/LqYK0Ps2 with my annotation where the output looks
>>> broken
>>>
>>
>> Ah, this is a different issue, but one which should be discussed.  I'm
>> happy we're working through all of these before the Emacs24 release.
>>
>> The problem below is not order of evaluation but rather insertion of
>> results.  The elements are evaluated in order, but the results from the
>> bar() call lines are all inserted in the same place.  In the current
>> code the raw text of the call line is used to insert the results, so
>> identical call lines replace each other's results.
>
> .......
>
>>> Although the above is a workaround, it may be cumbersome.  I'm on the
>> fence about whether to try to change the existing behavior.  If each
>> identical call line is thought of as a token of the same call then maybe
>> it makes sense to have only one location in which to insert the results
>> of that call (also it is possible that some users are relying on the
>> current behavior).  That said it is certainly confusing...
>
> I see no reason why we should think of each call line as a token of
> the same call; do you?  In fact, it's probably a fundamentally flawed
> way of thinking, because nothing guarantees that the global state of
> the session hasn't changed between call invocations.  In fact, in that
> sense, we can't even technically regard the _same_ call line as being
> a token of the same call, if we consider it at different times :)
>

I'm inclined to agree with you.

>
> Referring to what I said in another thread ("the principle of least
> surprise"):  it makes a lot of sense for the call lines to behave the
> same way a function call, or a source() statement would behave in the
> interpreter session of the original language.  From that perspective,
> the current behavior seems wrong.  Can you come up with a scenario /
> usage pattern where the current behavior is more desirable?
>

The only loss of functionality would be the ability in the existing
model to have a call line and it's results live in separate locations.
Given that call lines can not currently be named their results are named
by the information on the call line (called function, header arguments,
etc...) which will be identical for identical call lines, leading to the
current confusing behavior.

I think the best way forward would be to

1. stop auto-naming #+call: lines as we are currently and instead leave
   their results anonymous as with code blocks, and by default inserted
   immediately after the #+call: line.

2. allow names to be applied to call lines, which can then be used to
   identify their results and locate their results remotely in the
   buffer.

If this sounds like a good way forward then I'll put it on my queue for
some time in the when-I-have-more-time future. :)

Best,

>
> --Leo
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



reply via email to

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