From: jenia.ivlev@gmail.com (jenia.ivlev)
To: emacs-orgmode@gnu.org
Subject: Re: babel, header arguments.
Date: Fri, 21 Nov 2014 15:55:43 -0500 [thread overview]
Message-ID: <87r3wwgto0.fsf@gmail.com> (raw)
In-Reply-To: m2k32ob8a6.fsf@tsdye.com
tsd@tsdye.com (Thomas S. Dye) writes:
> jenia.ivlev@gmail.com (jenia.ivlev) writes:
>
>> tsd@tsdye.com (Thomas S. Dye) writes:
>>
>>> Aloha,
>>>
>>> jenia.ivlev@gmail.com (jenia.ivlev) writes:
>>>
>>>> Also, what if I want to import the actual function defintion into
>>>> another src block:
>>>>
>>>> #+begin_src scheme
>>>> (+ (my-plus 3 4) 1)
>>>> #+end_src
>>>> something here that import the previous function definitions
>>>>
>>>> Is that possible?
>>>
>>> Yes, see section 14.10 Noweb reference syntax in the manual.
>>>
>>> You'll have something that looks like this:
>>>
>>> #+header: :noweb yes
>>> #+begin_src scheme
>>> <<previous-function-definition>>
>>> (+ (previous-function 3 4) 1)
>>> #+end_src
>>>
>>> hth,
>>> Tom
>>
>> What do you mean? <<previous-function-definition>> should be replaced
>> with the actual function definition? But I use babel-mode so that I can
>> interlace code in a natural language document. I want these src blocks
>> to be separate.
>>
>>
>
> Sorry, it refers to the name of the source code block.
>
> ,-------------------------------------------------------------------------
> | The “noweb” (see <http://www.cs.tufts.edu/~nr/noweb/>) Literate
> | Programming system allows named blocks of code to be referenced by using
> | the familiar Noweb syntax:
> |
> | <<code-block-name>>
> `-------------------------------------------------------------------------
>
> hth,
> Tom
I have one last quick question, I have an exmaple here with no-web that
I think should work but doesnt. I wonder why:
#+BEGIN_SRC C :noweb-ref begin
int main() {
printf("Line 1\n");
#+END_SRC
#+BEGIN_SRC C :noweb-ref middle
printf("Second\n");
#+END_SRC
#+BEGIN_SRC C :noweb-ref end
}
main();
#+END_SRC
#+BEGIN_SRC C :noweb yes
<<begin>>
<<middle>>
<<end>>
printf("some appropriate debug word");
#+END_SRC
And the output is:
/tmp/babel-15080Ms4/C-src-150805OE.c: In function ‘main’:
/tmp/babel-15080Ms4/C-src-150805OE.c:6:7: warning: incompatible implicit declaration of built-in function ‘printf’
printf("Line 1\n");
^
/tmp/babel-15080Ms4/C-src-150805OE.c: At top level:
/tmp/babel-15080Ms4/C-src-150805OE.c:10:5: warning: data definition has no type or storage class
main();
^
/tmp/babel-15080Ms4/C-src-150805OE.c:12:8: error: expected declaration specifiers or ‘...’ before string constant
printf("asti");
^
/bin/bash: /tmp/babel-15080Ms4/C-bin-15080GZK: Permission denied
Or if I dont include the
printf("some appropriate debug word");
then, I get no output at all.
`Code block produced no output.`
So my question is how do I make this work. lol.
Thanks in advance again
prev parent reply other threads:[~2014-11-21 20:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-18 18:44 babel, header arguments jenia.ivlev
2014-11-20 9:36 ` Sebastien Vauban
2014-11-21 19:35 ` jenia.ivlev
2014-11-21 19:49 ` Thomas S. Dye
2014-11-21 20:09 ` jenia.ivlev
2014-11-21 20:32 ` jenia.ivlev
2014-11-21 20:36 ` Thomas S. Dye
2014-11-21 20:55 ` jenia.ivlev [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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r3wwgto0.fsf@gmail.com \
--to=jenia.ivlev@gmail.com \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.