emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "R. Michael Weylandt" <michael.weylandt@gmail.com>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: :mkdirp without path specifier
Date: Fri, 2 May 2014 23:47:46 -0400	[thread overview]
Message-ID: <CAAmySGO7ZhDfsOQ1bBXYQ-XFK6VUV92cR1EOGMUen_C03gv5Sg@mail.gmail.com> (raw)
In-Reply-To: <CAAmySGMzq+aGd4Za+F49+KKKXcnzLYLXMnA7XDRLYS5ry7-tMw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 211 bytes --]

On Fri, May 2, 2014 at 11:43 PM, R. Michael Weylandt
<michael.weylandt@gmail.com> wrote:
> Patch attached. Should apply cleanly against master and maint.


Bah, botched the formatting. Attached should be fixed.

[-- Attachment #2: 0001-Fix-tangle-with-mkdirp-yes-tangle-FILE.patch --]
[-- Type: application/octet-stream, Size: 1408 bytes --]

From 69be77b0de028b32a7c102affc14f49a4eb98279 Mon Sep 17 00:00:00 2001
From: Michael Weylandt <michael.weylandt@gmail.com>
Date: Fri, 2 May 2014 23:30:42 -0400
Subject: [PATCH] Fix tangle with ":mkdirp yes :tangle FILE"

* ob-tangle.el (org-babel-tangle): Fix tangling with :mkdirp and :tangle FILE.
Since (file-name-directory FILE) returns nil, don't pass it to
make-directory without checking.

Fixes tangling of files like:
,#############################
,#+TITLE: Test
,#+BEGIN_SRC python :mkdir yes :tangle test.py
,print 1 + 2 + 3
,#+END_SRC
,#############################

TINYCHANGE
---
 lisp/ob-tangle.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index be7e9a6..dd92345 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -234,7 +234,8 @@ used to limit the exported source code blocks by language."
 		      ;; 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))
+			(if (file-name-directory file-name)
+			    (make-directory (file-name-directory file-name) 'parents)))
 		      ;; delete any old versions of file
 		      (when (and (file-exists-p file-name)
 				 (not (member file-name (mapcar #'car path-collector))))
-- 
1.8.3.4 (Apple Git-47)


  reply	other threads:[~2014-05-03  3:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-01 19:47 :mkdirp without path specifier Michael Weylandt
2014-05-03  3:43 ` R. Michael Weylandt
2014-05-03  3:47   ` R. Michael Weylandt [this message]
2014-05-03  8:19     ` Achim Gratz
2014-05-03 14:52       ` R. Michael Weylandt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAmySGO7ZhDfsOQ1bBXYQ-XFK6VUV92cR1EOGMUen_C03gv5Sg@mail.gmail.com \
    --to=michael.weylandt@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).