简体   繁体   中英

FIXED: emacs:org-babel: noweb reference expand with an surplus line

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.

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 Cc Cv Ct ), I get this:

tmp$ cat 1.sh 

echo "hello, world!"

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM