summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2009-07-30 20:02:18 -0600
committerEric Schulte <schulte.eric@gmail.com>2009-07-30 20:02:18 -0600
commit5c6308d80459778e8bdae1723e00c4c2cfed29aa (patch)
tree1becc5b9a3db7783cfa3c0cefc3c45033980feef
parent56b18db9b8793d9f781f85e82c04a8440760919b (diff)
downloadorg-mode-5c6308d80459778e8bdae1723e00c4c2cfed29aa.tar.gz
org-babel-load-file now working under new tangling schema
-rw-r--r--lisp/org-babel-tangle.el7
-rw-r--r--org-babel.org12
2 files changed, 17 insertions, 2 deletions
diff --git a/lisp/org-babel-tangle.el b/lisp/org-babel-tangle.el
index 432bf94..b40c808 100644
--- a/lisp/org-babel-tangle.el
+++ b/lisp/org-babel-tangle.el
@@ -49,6 +49,7 @@ file using `load-file'."
(sixth (file-attributes file))))))
(let* ((base-name (file-name-sans-extension file))
(exported-file (concat base-name ".el")))
+ (message "building %s" exported-file) ;; debugging
;; tangle if the org-mode file is newer than the elisp file
(unless (and (file-exists-p exported-file) (> (age file) (age exported-file)))
(org-babel-tangle-file file base-name "emacs-lisp"))
@@ -87,13 +88,15 @@ exported source code blocks by language."
(let* ((tangle (cdr (assoc :tangle params)))
(base-name (or (when (not (or (string= tangle "yes")
(string= tangle "no")))
- tangle)
+ (when (> (length tangle) 0) tangle))
target-file))
(file-name (when base-name
(concat base-name "." ext))))
+ (message "tangle=%S base-name=%S file-name=%S" tangle base-name file-name)
(when file-name
;; delete any old versions of file
- (unless (member file-name path-collector)
+ (when (and (file-exists-p file-name)
+ (not (member file-name path-collector)))
(delete-file file-name))
;; drop source-block to file
(with-temp-buffer
diff --git a/org-babel.org b/org-babel.org
index 2a45a1a..041dbc7 100644
--- a/org-babel.org
+++ b/org-babel.org
@@ -262,6 +262,18 @@ can happen in two ways...
2) if the value of the =tangle= header argument is anything other than
=no= or =yes= then it is used as the file name
+#+srcname: test-new-tangling
+#+begin_src emacs-lisp
+ (org-babel-load-file "test-tangle.org")
+ (if (string= test-tangle-advert "use org-babel-tangle for all your emacs initialization files!!")
+ "succeed"
+ "fail")
+#+end_src
+
+#+resname:
+: succeed
+
+
** PROPOSED raise elisp error when source-blocks return errors
Not sure how/if this would work, but it may be desirable.