Lawrence Bottorff <borg...@gmail.com> writes: > I would use local variables for this--something like (untested): > > # eval: (org-babel-lob-ingest path/to/your/file) > # eval: (sbe "my-add") > # eval: (sbe "multi_x2") > > Computer savvy Org moders don't like eval because anything can happen, > but if you're willing to trust yourself, then it shouldn't cause any > problems. > > With this near the bottom of your file, whenever you open the file your > other org files will be loaded into the Library of Babel where you can > load up function definitions as needed. > > Of course, you'll need to have slime running when you open the file. > > hth, > Tom > > Thanks Tom. Still, I'm wondering if the whole LOB is worth it in > Lisp/SLIME-land. I can load code with org-babel-lob-ingest into > `org-babel-library-of-babel`, but SLIME doesn't seem to know about it > -- which sort of defeats the whole purpose, if you follow what I > mean. . . . >
You got me all curious to see where things break: I had to install slime and clisp to find out. Everything is working I think: nothing is broken. As long as you are willing to add Tom's initialization (slightly modified - the function I have is org-sbe rather than sbe - I guess Tom has defined sbe in his own setup for backward-compatibility purposes), the following process works for me. Here's what I added to my .emacs: --8<---------------cut here---------------start------------->8--- (setq inferior-lisp-program "/usr/bin/clisp") ;;; start it - it's important to start slime *before* ;;; you load the c.org file below. (slime) (require 'ob-lisp) --8<---------------cut here---------------end--------------->8--- a.org and b.org are just as you defined them: --8<---------------cut here---------------start------------->8--- #+name: myadd #+begin_src lisp :session foo (defun myadd (x y) (+ x y)) #+end_src --8<---------------cut here---------------end--------------->8--- --8<---------------cut here---------------start------------->8--- #+name: multi_x2 #+begin_src lisp :session (defun multi_x2 (x) (* 2 x)) #+end_src --8<---------------cut here---------------end--------------->8--- and c.org with Tom's modifications looks like this: --8<---------------cut here---------------start------------->8--- #+name: add&multi_x2 #+begin_src lisp :session (defun add&multi_x2 (x y) (multi_x2 (myadd x y))) #+end_src #+BEGIN_SRC lisp :session (add&multi_x2 2 3) #+END_SRC # Local Variables: # eval: (org-babel-lob-ingest "./a.org") # eval: (org-babel-lob-ingest "./b.org") # eval: (org-sbe "myadd") # eval: (org-sbe "multi_x2") # End: --8<---------------cut here---------------end--------------->8--- Evaluation of the two code block in c.org proceeds correctly and without problems. -- Nick