Hello, stardiviner <numbch...@gmail.com> writes:
> New patch in attachment. Thank you. > From aafdd41f7ae5f6218a2be890f58d45be443de4a9 Mon Sep 17 00:00:00 2001 > From: stardiviner <numbch...@gmail.com> > Date: Sat, 2 Mar 2019 12:11:47 +0800 > Subject: [PATCH] ob-core.el: Make :mkdirp work for :dir too > > * lisp/ob-core.el (org-babel-execute-src-block): make directory if :dir > path does not exist when :mkdirp yes exist. > > * doc/org-manualo.rg (mkdirp): declare new change in manual. > > * etc/ORG-NEWS: declare changes in ORG-NEWS. No need to declare changes in changes file. This could end up in an infloop. > + (or (and dir > + ;; Possibly create the parent directories for file. > + (let ((fnd (file-name-as-directory > (expand-file-name dir)))) > + (cond > + ((member mkdirp '("yes" "t")) (make-directory > fnd 'parents)) > + ((member mkdirp '("no" "nil")) nil) > + (t (make-directory fnd 'parents))))) > default-directory)) I used: (or (and dir (not (member mkdirp '("no" "nil" nil))) (progn (let ((d (file-name-as-directory (expand-file-name dir)))) (make-directory d 'parents) d))) Do we need to make a case when dir is a remote? > +(ert-deftest test-ob-core/dir-mkdirp () > + (org-test-with-temp-text > + "#+begin_src sh :mkdirp yes :dir \"data/code\" > +pwd > +#+end_src" > + (org-babel-execute-src-block)) > + (should (file-directory-p "data/code"))) > + I meant (should (org-test-with-temp-text "..." ... (file-directory-p "data/code"))) I applied your patch with the changes above. Regards, -- Nicolas Goaziou