From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas S. Dye Subject: Re: Babel: How to call code in one org file into another org file Date: Fri, 30 Oct 2015 17:08:12 -1000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55827) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZsMWr-000278-D9 for emacs-orgmode@gnu.org; Fri, 30 Oct 2015 23:08:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZsMWo-0008Rn-3t for emacs-orgmode@gnu.org; Fri, 30 Oct 2015 23:08:29 -0400 Received: from gproxy5-pub.mail.unifiedlayer.com ([67.222.38.55]:57506) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1ZsMWn-0008RR-Sr for emacs-orgmode@gnu.org; Fri, 30 Oct 2015 23:08:26 -0400 In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Lawrence Bottorff Cc: emacs-orgmode Mailinglist Aloha Lawrence, Lawrence Bottorff writes: > Doing M-x org-babel-lob-files called up a customization buffer that allowed > me to put in many separate file paths. I did this for ../a.org and ../b.org. > > a.org: > > #+name: myadd > #+begin_src lisp :session > (defun myadd (x y) > (+ x y)) > #+end_src > > b.org: > > #+name: multi_x2 > #+begin_src lisp :session > (defun multi_x2 (x) > (* 2 x)) > #+end_src > > then in c.org: > > #+name: add&multi_x2 > #+begin_src lisp :session > (defun add&multi_x2 (x y) > (multi_x2 (myadd x y))) > #+end_src > > but upon C-c C-c in c.org SLIME didn't know about myadd or multi_x2 ... > until I did C-c C-c in both a.org and b.org for the respective functions. > Then c.org's add&multi_x2 knew about the helper functions. That is > wonderful and allows a very distributed and modular approach to org-mode LP > for Lisp. However, it would be nice if I didn't have to acquaint my SLIME > session by hand all of my ingested babel-lob files. Any way to have this > happen automatically upon C-c C-c-ing my main org file? I found this > > discussion, > but I don't believe it really addresses my wish. 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 -- Thomas S. Dye http://www.tsdye.com