From: Vladimir Nikishkin <lockywolf@gmail.com>
To: Bastien <bzg@gnu.org>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
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 [thread overview]
Message-ID: <CA+A2iZbS-cOC+yEXtyX7AJYWQeEU4SAUkjHwJhxtV4Mch4fyKw@mail.gmail.com> (raw)
In-Reply-To: <87363urysl.fsf@gnu.org>
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
prev parent reply other threads:[~2020-09-10 9:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 2:09 org-babel prepends <<noweb>> expansions with the prefix of the <<tag>>? Can this be turned off? Vladimir Nikishkin
2020-02-25 7:00 ` Johannes Dahl
2020-02-25 7:11 ` Johannes Dahl
2020-09-07 4:33 ` Bastien
2020-09-10 9:21 ` Vladimir Nikishkin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+A2iZbS-cOC+yEXtyX7AJYWQeEU4SAUkjHwJhxtV4Mch4fyKw@mail.gmail.com \
--to=lockywolf@gmail.com \
--cc=bzg@gnu.org \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).