Browse Source

ob-lisp: setting *default-pathname-defaults* to the directory of the Org-mode file

  Thanks to Mark Cox for suggesting this change.

* lisp/ob-lisp.el (org-babel-execute:lisp): Setting the value of
  *default-pathname-defaults* to either the value of the :dir header
  argument or the directory of the containing Org-mode file.
Eric Schulte 13 years ago
parent
commit
459cbd4fd8
1 changed files with 7 additions and 2 deletions
  1. 7 2
      lisp/ob-lisp.el

+ 7 - 2
lisp/ob-lisp.el

@@ -73,8 +73,13 @@
     (with-temp-buffer
       (insert (org-babel-expand-body:lisp body params))
       (slime-eval `(swank:eval-and-grab-output
-		    ,(format "(progn %s)" (buffer-substring-no-properties
-					   (point-min) (point-max))))
+		    ,(format "(let ((*default-pathname-defaults* %S)) %s)"
+			     (let ((dir (if (assoc :dir params)
+					    (cdr (assoc :dir params))
+					  default-directory)))
+			       (when dir (concat "#P" dir)))
+			     (buffer-substring-no-properties
+			      (point-min) (point-max))))
 		  (cdr (assoc :package params)))))
    (org-babel-pick-name (cdr (assoc :colname-names params))
 			(cdr (assoc :colnames params)))