From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [FEATURE] Make header argument :mkdirp yes work for other header arguments not just :tangle Date: Mon, 04 Mar 2019 23:21:25 +0100 Message-ID: <87imwy2sd6.fsf@nicolasgoaziou.fr> References: <87ftsk9w03.fsf@gmail.com> <87a7id3mf0.fsf@gmail.com> <8736o4h15m.fsf@gmail.com> <87k1hge652.fsf@nicolasgoaziou.fr> <871s3ogfbe.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([209.51.188.92]:48222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0vxr-000868-Ua for emacs-orgmode@gnu.org; Mon, 04 Mar 2019 17:21:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h0vxp-0006tS-HU for emacs-orgmode@gnu.org; Mon, 04 Mar 2019 17:21:39 -0500 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:35227) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h0vxn-0006ag-EB for emacs-orgmode@gnu.org; Mon, 04 Mar 2019 17:21:36 -0500 In-Reply-To: <871s3ogfbe.fsf@gmail.com> (stardiviner's message of "Sun, 03 Mar 2019 23:15:01 +0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: stardiviner Cc: Org Mode Hello, stardiviner writes: > New patch in attachment. Thank you. > From aafdd41f7ae5f6218a2be890f58d45be443de4a9 Mon Sep 17 00:00:00 2001 > From: stardiviner > 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