Browse Source

fleshing out actual loading of tangled files

Eric Schulte 16 years ago
parent
commit
07c919cb31
3 changed files with 19 additions and 2 deletions
  1. 7 0
      lisp/org-babel-tangle.el
  2. 2 2
      org-babel.org
  3. 10 0
      test-tangle.org

+ 7 - 0
lisp/org-babel-tangle.el

@@ -38,6 +38,13 @@ language, and the cdr should be a list containing the extension
 and shebang(#!) line to use when writing out the language to
 file.")
 
+(defun org-babel-load-file (file)
+  "Load the contents of the Emacs Lisp source code blocks in
+FILE.  This function will first export the source code using
+`org-babel-tangle' and then load the resulting file using
+`load-file'."
+  (load-file (org-babel-tangle-file "emacs-lisp")))
+
 (defun org-babel-tangle-file (file &optional lang)
   "Extract the bodies of all source code blocks in FILE with
 `org-babel-tangle'.  Optional argument LANG can be used to limit

+ 2 - 2
org-babel.org

@@ -200,12 +200,12 @@ would then be [[#sandbox][the sandbox]].
 
 
 * Tasks [27/44]
-** TODO singe-function tangling and loading elisp from literate org-mode file [0/2]
+** TODO singe-function tangling and loading elisp from literate org-mode file [1/2]
 
 This function should tangle the org-mode file for elisp, and then call
 `load-file' on the resulting tangled file.
 
-*** TODO add optional language limiter to org-babel-tangle
+*** DONE add optional language limiter to org-babel-tangle
 This should check to see if there is any need to re-export
 
 *** TODO ensure that org-babel-tangle returns the path to the tangled file(s)

+ 10 - 0
test-tangle.org

@@ -76,3 +76,13 @@ end
 #+begin_src ruby :session special
 plus_two(holder)
 #+end_src
+
+
+** Emacs Lisp initialization stuff
+
+#+srcname: lets-set-some-variables
+#+begin_src emacs-lisp 
+  (setq test-tangle-loading "org-babel tangles")
+  (setq test-tangle-advert "use org-babel-tangle for all your emacs initialization files!!")
+  (setq test-tangle-file-path (expand-file-name (buffer-file-name)))
+#+end_src