emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: fm4d <m@fm4d.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] Noweb reference eval syntax does not work
Date: Sun, 08 May 2016 11:26:31 +0200	[thread overview]
Message-ID: <87shxsaojc.fsf@saiph.selenimh> (raw)
In-Reply-To: <87h9ec2ngz.fsf@fm4d.net> (fm4d's message of "Thu, 05 May 2016 23:39:56 +0200")

Hello,

fm4d <m@fm4d.net> writes:

> The noweb reference syntax that should insert results of
> evaluation of src block itself instead of src block as
> described in `org-babel-expand-noweb-reference` does not
> seems to work.
>
>
> Code for replication:
>
> * Assign 
>
> First we assign abc:
>
> #+begin_src python :noweb-ref assign_abc
> abc = "abc" + "def"
> #+end_src
>
> * Use
>
> Then we use it in a function:
>
> #+begin_src python :noweb tangle :tangle noweb-test.py
> def x():
>   <<assign_abc>>
>   return abc
>
> print(x())
> #+end_src
>
>
> <<assign_abc>> does work, <assign_abc()> fails with this error:
>
> (error "Reference ‘assign_abc’ not found in this buffer")
>   signal(error ("Reference ‘assign_abc’ not found in this buffer"))
>   error("Reference `%s' not found in this buffer" "assign_abc")
>   org-babel-ref-resolve("assign_abc()")
>   ...
>
>
> I am not sure if this is a bug or I am doing something wrong,
> the documentation on this feature is not very comprehensive.

I just discovered the :noweb-ref parameter.

It is redundant with #+NAME: keyword and slightly broken. Also it
induces hacks like `org-babel-use-quick-and-dirty-noweb-expansion' to
work-around its shortcomings. 

Besides, it doesn't make much sense to add the same parameters to
a bunch of blocks, so I find the syntax dubious.

I understand it can be a handy shortcut for inserting multiple blocks,
but, all in all, I tend to think it would be simpler to just remove the
feature, along with `:noweb-sep' and
`org-babel-use-quick-and-dirty-noweb-expansion'.

What do you, and others, think? Is NAME enough for noweb syntax, or is
there a real need fo :noweb-ref?


Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2016-05-08  9:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-05 21:39 [BUG] Noweb reference eval syntax does not work fm4d
2016-05-08  9:26 ` Nicolas Goaziou [this message]
2016-05-08 12:57   ` Rasmus
2016-05-08 16:32     ` Thomas S. Dye
2016-05-11 21:34       ` Nicolas Goaziou
2016-05-11 22:40         ` Samuel Wales
2016-05-11 23:19         ` Charles C. Berry
2016-05-12 23:35     ` Aaron Ecay
2016-05-15 22:40       ` Nicolas Goaziou
  -- strict thread matches above, loose matches on Subject: below --
2016-08-04 21:11 Karsten Schmidt
2016-08-05  2:25 ` Charles C. Berry

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=87shxsaojc.fsf@saiph.selenimh \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=m@fm4d.net \
    /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).