emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [babel] noweb with ob-screen??


From: Eric Schulte
Subject: Re: [O] [babel] noweb with ob-screen??
Date: Mon, 02 Jan 2012 10:47:49 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Torsten Wagner <address@hidden> writes:

> Hi
> this is a follow up on a early post.
> I try to get noweb working with ob-screen.
> I wrote several code blocks and named them.  I finished with a code block
> which calls all other blocks using noweb notation adding to its header
> :noweb yes.  I execute this block by C-c C-c but the noweb reference get
> not resolved.
> In my understanding they should isn't it? Or do I mix tangling and
> execution? In my understanding noweb should work for both cases isn't it?
>

The expansion should occur as part of executing the code block.  For
example notice the expansion of the sh code blocks in this example...

#+begin_src sh :noweb yes :results output
  <<first>>
  <<second>>
#+end_src

#+results:
: first
: second

#+name: first
#+begin_src sh
  echo first
#+end_src

#+name: second
#+begin_src sh
  echo second
#+end_src
>
> I looked in the source code of ob-screen and try to get an idea why it
> doesn't work.  However compare to other babel modes I could not find that
> it is missing anything related to noweb.  It seems to me that noweb is a
> babel mode independent functionality and hence should work with all babel
> languages.
>

This is certainly the case, noweb expansion occurs *before* the language
specific code is invoked.  In fact I can confirm that an expanded body
is passed to the screen execution function.  Are you sure that it is
only screen code blocks for which you are having trouble with noweb
references?  Could you ensure that the attached example above expands
for sh code blocks, and then try to translate it to screen code blocks?

>
> If I'm wrong could someone please point me to an example in the source code
> how to implement noweb functionality.
>

The above example should serve, the manual is also a good resource, and
finally there any many small examples located at

http://eschulte.github.com/org-scraps/

Best -- Eric

>
> Thanks a lot
>
> Torsten
>
> Cc.  Sorry all this is written down from memory on my smartphone and hence
> no code examples and maybe wrong syntax.

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

reply via email to

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