emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] evaluation context in call statements


From: Eric Schulte
Subject: Re: [O] evaluation context in call statements
Date: Wed, 26 Jun 2013 09:06:22 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

>> My vote is for adding #+name support to call lines, and then handling
>> their results in the same manner as code block results.

Achim Gratz <address@hidden> writes:
> I'm not sure what this would entail other than replacing the call with
> its arguments with the name of the call in the results line.  But yes,
> that'd be a step forward, although you'd have to be careful when copying
> calls.
>

This could work exactly as named source blocks work.  E.g.,

Unnamed code block.

#+begin_src emacs-lisp
  'bar
#+end_src

#+RESULTS:
: bar

Named code block.

#+name: foo-block
#+begin_src emacs-lisp
  'foo
#+end_src

can have text between itself and its results

#+RESULTS: foo-block
: foo

Unnamed call line.

#+call: foo-block()

#+RESULTS: foo-block()
: foo

Named call line.

#+name: foo-call
#+call: foo-block()

Can have text between itself and its results.

#+RESULTS: foo-call
: foo
Rick Frankel <address@hidden> writes:
> It seems inconsistent to add #+name support to call lines but not the
> other block modifiers (#+header :var ..., etc). I think call lines are
> a special case, so would be ok with the new :target option.

See above.  This is not inconsistent, it is equivalent with how names
and code block already work, which means it is less for new users to
learn and old users to keep track of.  Also, the existing code block
results handling has not caused much confusion, and seems to be powerful
enough to deal with every use case.

Achim Gratz <address@hidden> and Rick Frankel <address@hidden> write:
>> My current suggestion is however to limit the results block search to
>> the same subtree and stop searching at later #+CALL and #+BEGIN_SRC
>> line.  We could make this conditional on a :[no]clobber argument to
>> keep compatibility with the current behaviour (clobbering the first
>> result would be the current and perhaps default behaviour).
>
> These search bounds make sense, but i think this should be the
> default behavior. I don't see the current behavior as making
> sense---at least to me.

I agree that the current behavior is confusing, but I don't like this
suggestion.  I expect people will be mystified when calls replace
results in the same subtree and don't replace blocks elsewhere in the
same Org-mode file.  No other parts of Org-mode's code block support
work this way.

> At the time (late 2012) I found Nicolases changes (named results
> blocks, attributes and captions on the results block and not the
> source, etc) confusing. I still find it odd that you need to evaluate
> a source block before you can e.g, add a caption or attributes to the
> results (previous behavior was that header arguments on the source
> block were used for the results in exporting.)
>

I think this behavior works well and I don't think it will change.  I
see how it could be nice to automatically apply attributes (e.g.,
captions, labels etc...) of a code block to that blocks results, but
then what if I want to export the code block body and not the results,
what if I want to export both.  I think Nicolas was right to unify,
simplify and clarify the Org-mode attribute semantics.

Thanks for the feedback.

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

reply via email to

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