Paul Bryan <[email protected]> writes:

>> I'm guessing you mean expand and not evaluate? When I hit "C-c C-c" on both 
>> > of the blocks in your example, they are
>> evaluated just fine. 

I meant evaluate as well. The only reason it works in the second block
with Emacs lisp is because Emacs itself acts as a session. After
evaluating the first block the symbol is defined globally for the second
block. I tried using an example that wouldn't require anything else, but
I can see it was not the right choice.

> I think the issue arises if you evaluate the second block without having 
> already evaluated the first block. In that case, an
> error is signalled: 
>
> let: Symbol’s function definition is void: goo
>
> Upon removing the COMMENT from the headline and repeating, it works. Of 
> course, if you evaluate the first block first, it
> works fine in either scenario. So it seems, as Grant pointed out, the noweb 
> reference is not being resolved when the
> surrounding headline is commented.

Yes, this is correct. If you use a language like Ruby (where I noticed
it) it will not work even if the first block is evaluated first. Take
this example instead:

* COMMENT Test commented evaluation

#+name: test-echo
#+begin_src shell
  echo "testing"
#+end_src

#+begin_src shell :results output :noweb yes
  echo "does this work?"
  <<test-echo>>
#+end_src

#+RESULTS:
: does this work?

I hope this clarifies the issue here.

Thank you,
Grant
-------------------- End of forwarded message --------------------

Reply via email to