From 26f4d41cf1ea84bb2f4f23c52ffc62ef3b7add12 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 9 Jul 2020 03:11:09 +0530 Subject: Do not create tangle output in :posts-directory. An ennu-operation should not write anything in the input directories. Doing so is a recipe for data loss. * ennu.el (ennu-publish-post): Do not create tangle output in :posts-directory. --- ennu.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ennu.el b/ennu.el index ae61f0e..c19799f 100644 --- a/ennu.el +++ b/ennu.el @@ -132,9 +132,15 @@ last form in BODY." (ennu-setting :static-directory))) (ennu-post-tangle post)) :publish (lambda (&rest output-files) - (org-babel-tangle-publish - nil (ennu-post-filename post) - (file-name-directory (first output-files))))))) + ;; TODO: Handle tangle outputs that are nested + ;; into directories, and when each tangle output + ;; is nested into a different directory. + (let ((post-file-copy (concat + (file-name-directory (first output-files)) + (file-name-nondirectory (ennu-post-filename post))))) + (copy-file (ennu-post-filename post) post-file-copy) + (org-babel-tangle-file post-file-copy) + (delete-file post-file-copy)))))) posts) link-publish-operations))) -- cgit v1.2.3