emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Babel: How to call code in one org file into another org file


From: Rasmus
Subject: Re: [O] Babel: How to call code in one org file into another org file
Date: Sat, 31 Oct 2015 10:57:17 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Hi Lawrence,

Lawrence Bottorff <address@hidden> writes:

> There are many, many Babel examples, but I can't seem to find this
> functionality: A function in a Lisp code block in one org file is to be
> called from a Lisp code block in another org file. Is this possible? I know
> you can stick stuff into your personal "Library of Babel," but I just want
> to write a Lisp block that calls a function from another org file. I'll
> have SLIME running, of course.
>
>
> file1.org:
> ...
>
>  #+begin_src lisp
> (defun foo ()
>    (...))
> #+end_src
>
> file2.org:
> ...
>
> #+begin_src lisp
> (defun baa ()
>   (foo))
> #+end_src

At export time you could include a named block, but I’m not really sure
that gets you closer to what you want.

E.g. in file 1,

    #+name: fun_foo 
    #+begin_src lisp
    (defun foo ()
       (...))
    #+end_src

In file 2,

    #+include: "file1.org::fun_foo"

    #+begin_src lisp
    (defun baa ()
      (foo))
    #+end_src

Rasmus

-- 
Spil noget med Slayer!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]