emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Grant Rettke <gcr@wisdomandwonder.com>
To: Jarmo Hurri <jarmo.hurri@iki.fi>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Babel: reusing language-specific functions
Date: Thu, 9 Oct 2014 21:11:51 -0500	[thread overview]
Message-ID: <CAAjq1mfH26c+gYK1gBcawP8RHs_Btjdx3iZFORLkUL0QZ=z-1Q@mail.gmail.com> (raw)
In-Reply-To: <878ukp24v0.fsf@iki.fi>

That is a great option when you want to run *without* a session.

That is also a nice approach when you are using plantuml and do not
want to use a single external file
and include it all over the place.

On Thu, Oct 9, 2014 at 12:23 AM, Jarmo Hurri <jarmo.hurri@iki.fi> wrote:
> 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
>
>



-- 
Grant Rettke
gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson

      reply	other threads:[~2014-10-10  2:11 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
2014-10-10  2:11       ` Grant Rettke [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='CAAjq1mfH26c+gYK1gBcawP8RHs_Btjdx3iZFORLkUL0QZ=z-1Q@mail.gmail.com' \
    --to=gcr@wisdomandwonder.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jarmo.hurri@iki.fi \
    /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).