]> code.delx.au - gnu-emacs/blobdiff - lisp/org/ob-tangle.el
-
[gnu-emacs] / lisp / org / ob-tangle.el
index ffc74cb22a94cab3326800dd7ba4d98bc74c2636..bfd5a062fc1468a9e47508d0ab7817f2adc815f2 100644 (file)
@@ -1,6 +1,6 @@
 ;;; ob-tangle.el --- extract source code from org-mode files
 
-;; Copyright (C) 2009-2013 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2016 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
@@ -225,13 +225,14 @@ used to limit the exported source code blocks by language."
                                          (concat base-name "." ext) base-name))))
                    (when file-name
                      ;; Possibly create the parent directories for file.
-                     (when (let ((m (funcall get-spec :mkdirp)))
-                              (and m (not (string= m "no"))))
-                       (make-directory (file-name-directory file-name) 'parents))
+                     (let ((m (funcall get-spec :mkdirp))
+                           (fnd (file-name-directory file-name)))
+                       (and m fnd (not (string= m "no"))
+                            (make-directory fnd 'parents)))
                      ;; delete any old versions of file
-                     (when (and (file-exists-p file-name)
-                                (not (member file-name (mapcar #'car path-collector))))
-                       (delete-file file-name))
+                     (and (file-exists-p file-name)
+                          (not (member file-name (mapcar #'car path-collector)))
+                          (delete-file file-name))
                      ;; drop source-block to file
                      (with-temp-buffer
                        (when (fboundp lang-f) (ignore-errors (funcall lang-f)))
@@ -301,7 +302,7 @@ Insert the source-code specified by SPEC into the current source
 code file.  This function uses `comment-region' which assumes
 that the appropriate major-mode is set.  SPEC has the form:
 
-  \(start-line file link source-name params body comment)"
+  (start-line file link source-name params body comment)"
   (let* ((start-line (nth 0 spec))
         (file (nth 1 spec))
         (link (nth 2 spec))