Prechádzať zdrojové kódy

ob-tangle: do not run make-directory with nil argument

* lisp/ob-tangle.el (org-babel-tangle): When `file-name-directory'
  returns nil, do not run make-directory.  Remove superfluous when
  clauses by using short-circuiting `and' instead.

Thanks to R. Michael Weylandt for reporting the problem and offering a
patch.

http://permalink.gmane.org/gmane.emacs.orgmode/85749
http://permalink.gmane.org/gmane.emacs.orgmode/85774
Achim Gratz 11 rokov pred
rodič
commit
063c8b03b7
1 zmenil súbory, kde vykonal 7 pridanie a 6 odobranie
  1. 7 6
      lisp/ob-tangle.el

+ 7 - 6
lisp/ob-tangle.el

@@ -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)))