emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] How to use noweb reference with argument in other languages?


From: address@hidden
Subject: Re: [O] How to use noweb reference with argument in other languages?
Date: Tue, 20 Jun 2017 07:40:44 +0800

Which Org-mode version are you using? I'm using the latest Org-mode version from source code branch `master`.

When I use your `:noweb-ref` style like this:

```org
* noweb reference with argument

#+BEGIN_SRC sh :var str="" :noweb-ref sh-print-something
echo "$str"
#+END_SRC

#+BEGIN_SRC sh :results output :noweb yes
echo "hello, "
<<sh-print-something(str="stardiviner")>>
#+END_SRC

#+RESULTS:
```

Emacs reports error:

org-babel-ref-resolve: Reference ‘sh-print-something’ not found in this buffer.

Org-mode version: Org mode version 9.0.8 (9.0.8-elpaplus @ /home/stardiviner/Code/Emacs/org-mode/lisp/)

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Mon, Jun 19, 2017 at 6:21 PM, Kaushal Modi <address@hidden> wrote:
On Mon, Jun 19, 2017, 12:59 AM address@hidden <address@hidden> wrote:
I found noweb reference with argument `<<src-block-name(args)>>` issue.

It has been working fine for me for org and sh source blocks. 

And this does not work:
```org
#+NAME: sh-print-something
#+BEGIN_SRC sh :var str=""
echo "$str"
#+END_SRC

#+BEGIN_SRC sh :results output :noweb yes
echo "hello, "
<<sh-print-something(str="stardiviner")>>
#+END_SRC

You need to use :noweb-ref option  in the source blocks header args to set the noweb-ref code reference; #+NAME will not work.

I have to have used noweb for the very first time in this recent project: https://raw.githubusercontent.com/kaushalmodi/eless/master/eless.org ; search for ":noweb-ref" in there to get an idea. 
--

Kaushal Modi



reply via email to

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