emacs-orgmode
[Top][All Lists]
Advanced

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

Re: org-babel prepends <<noweb>> expansions with the prefix of the <<tag


From: Vladimir Nikishkin
Subject: Re: org-babel prepends <<noweb>> expansions with the prefix of the <<tag>>? Can this be turned off?
Date: Thu, 10 Sep 2020 17:21:21 +0800

Hello, Bastien,

Thanks for getting back to me.
In ob-core.el, function org-babel-expand-noweb-references, line 2747,
there is a 'mapconcat, that is commented as ";; Interpose PREFIX
between every line."
It prepends the "prefix", that is the content of the block to be
expanded from the beginning of the line where a <<noweb>> reference is
encountered to the beginning of the reference itself, that is to the
first "<".

My point is that this is not the most obvious way to do the expansion.
It does work if the "prefix" is a line comment character, similar to C++ "//"

However, consider the following example:

```
# -*- mode: org; -*-

* test
  :PROPERTIES:
  :header-args:    :noweb yes
  :END:

#+name: block1
#+begin_src shell
printf "test1 \n"
printf "test2 \n"
printf "test3 \n"

#+end_src

#+begin_src shell :shebang "#!/bin/chibi-scheme"
#<<block1>> <<block1>>

#+end_src
```

Expanding this example gives:

```
#printf "test1 \n"
#printf "test2 \n"
#printf "test3 \n"
# printf "test1 \n"
#<<block1>> printf "test2 \n"
#<<block1>> printf "test3 \n"
#<<block1>>
```

Not a very obvious interpretation!
At least I would expect the following instead:

```
#printf "test1 \n"
printf "test2 \n"
printf "test3 \n" printf "test1 \n"
printf "test2 \n"
printf "test3 \n"
```

Because at least it wouldn't leave anything resembling a "<<noweb>>"
block in the expansion result.

Thanks for looking at this issue.

Vlad

On Mon, 7 Sep 2020 at 12:33, Bastien <bzg@gnu.org> wrote:
>
> Hi Vladimir,
>
> Vladimir Nikishkin <lockywolf@gmail.com> writes:
>
> > That's not entirely what I want.
>
> What do you want instead?  It's not clear to me from your example.
>
> Thanks,
>
> --
>  Bastien



-- 
Yours sincerely, Vladimir Nikishkin



reply via email to

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