emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jarmo Hurri <jarmo.hurri@iki.fi>
To: emacs-orgmode@gnu.org
Subject: Re: Babel: reusing language-specific functions
Date: Thu, 09 Oct 2014 08:23:47 +0300	[thread overview]
Message-ID: <878ukp24v0.fsf@iki.fi> (raw)
In-Reply-To: m28ukrlupy.fsf@tsdye.com

tsd@tsdye.com (Thomas S. Dye) writes:

>> Jarmo Hurri <jarmo.hurri@iki.fi> writes:
>>> I have a language-specific function - in this case Asymptote, but it
>>> could be e.g. C as well - that I want to use in a number of different
>>> source blocks of the same language in an Org file. How do I accomplish
>>> this?
> Or, perhaps use the noweb syntax.
>
>
> #+NAME: foo
> #+BEGIN_SRC emacs-lisp
>   (defun foo (x) (+ x 2))
> #+END_SRC
>
> #+results: foo
> : foo
> #+begin_src emacs-lisp :noweb yes
> <<foo>>
> (foo 3)
> #+end_src
>
> #+results:
> : 5

Yes, this is a perfect solution. You can use noweb to include any code
block, not only function definitions. Thanks!

Jarmo

  reply	other threads:[~2014-10-09  5:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-07 11:46 Babel: reusing language-specific functions Jarmo Hurri
2014-10-07 12:09 ` Thorsten Jolitz
2014-10-07 16:18   ` Thomas S. Dye
2014-10-09  5:23     ` Jarmo Hurri [this message]
2014-10-10  2:11       ` Grant Rettke

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=878ukp24v0.fsf@iki.fi \
    --to=jarmo.hurri@iki.fi \
    --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).