From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Python source block and :dir header arg Date: Tue, 02 Apr 2019 11:59:11 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([209.51.188.92]:56098) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBLoq-0002MF-GJ for emacs-orgmode@gnu.org; Tue, 02 Apr 2019 11:59:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBLok-0002yS-SC for emacs-orgmode@gnu.org; Tue, 02 Apr 2019 11:59:24 -0400 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]:39920) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hBLoi-0002vm-Rc for emacs-orgmode@gnu.org; Tue, 02 Apr 2019 11:59:17 -0400 Received: by mail-qk1-x72c.google.com with SMTP id c189so8213817qke.6 for ; Tue, 02 Apr 2019 08:59:16 -0700 (PDT) In-reply-to: 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: Joao Cortes Cc: "emacs-orgmode@gnu.org" That looks different than what I see in org 9.2.1, if it has changed then it might be a bug indeed. What I see is: (default-directory (or (and dir (file-name-as-directory (expand-file-name dir))) default-directory)) I think :mkdirp is only for tangling files, so I wouldn't expect it to affect this, unless its use has been expanded. Even if it has been expanded, if the directory exists, it should work fine, but if it doesn't exist, and :mkdirp is nil or no, then it should fail. If it is non-nil then the directory should be made I guess. Joao Cortes writes: > Looking at org-babel-execute-src-block, It seems the only way to get the > the intended behavihour is adding :mkdirp "yes" or some other > value that gives a true value to the result of the =and= call in the > following snippet. > > This is the relevant code at ob-core.el, starting at line 681. > #+begin_src emacs-lisp :line yes > (default-directory > (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))) > default-directory)) > #+end_src > > This looks like a bug. If the :dir directory already > exists, the :mkdirp parameter should not stop setting the default > directory to :dir -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu