3

When noweb reference in org-mode 's source code block is expanded, ever the content of the reference consists of only one line, it will expand the reference with an surplus line. This is an example:

The source block is :

 #+srcname: test
 #+begin_src sh
 hello
 #+end_src

 #+begin_src sh :tangle ~/tmp/1.sh
 echo "<<test>>, world!"
 #+end_src

and the block's expand result is:

 echo "hello
 echo ", world!"

How can I modify OR setup, so that I can get the expand result like this:

 echo "hello, world!"

Answer: see the comment.

astropeak
  • 147
  • 1
  • 8

1 Answers1

0

Which version of org-mode are you using?

I'm not sure why you are getting the newline added, but your example, as given, does not work because you are missing the :noweb yes header argument. I have this code:

testing

#+srcname: test                                                                 
#+begin_src sh                                                                  
hello                                                                           
#+end_src                                                                       

#+begin_src sh :tangle ~/tmp/1.sh :noweb yes                                    
echo "<<test>>, world!"                                                         
#+end_src

When I run org-babel-tangle (bound to C-c C-v C-t), I get this:

tmp$ cat 1.sh 

echo "hello, world!"

I'm using org-mode version: 7.7 (release_7.7.303.g56de2c.dirty)

cm2
  • 1,815
  • 15
  • 20
  • thank you for you advice. I have set the noweb header's default value to yes, so this can work. My org-mode version is 7.6, and I have tried version 7.7, both have the same problem. My emacs version is 23.2 on a debian system. I have start emacs with the '-q' option(then it will not load .emacs setup) but the problem still exist. I guess the emacs's installation maybe the cause. any advice? @cm2 – astropeak Dec 12 '11 at 13:19
  • After install another version of org-mode, the problem disappeared. My original org-mode version is 7.6, and then I installed the newest version 7.7(the develop version) using git. both can't work. Then I download the standard version 7.7 then it works. – astropeak Dec 12 '11 at 14:06
  • Hmmm...I'm not sure what was causing the issue. Sorry I couldn't be of more help! – cm2 Dec 12 '11 at 16:56