summaryrefslogtreecommitdiff
path: root/ennu.el
diff options
context:
space:
mode:
authorArun Isaac2020-07-09 03:11:09 +0530
committerArun Isaac2020-07-09 03:11:09 +0530
commit26f4d41cf1ea84bb2f4f23c52ffc62ef3b7add12 (patch)
tree2bb4326c2393e5f844952529fa1f67b68edaaa01 /ennu.el
parent64b2350163d95cb0baa311914a6aa246201d4dc4 (diff)
downloadennum-26f4d41cf1ea84bb2f4f23c52ffc62ef3b7add12.tar.gz
ennum-26f4d41cf1ea84bb2f4f23c52ffc62ef3b7add12.tar.lz
ennum-26f4d41cf1ea84bb2f4f23c52ffc62ef3b7add12.zip
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.
Diffstat (limited to 'ennu.el')
-rw-r--r--ennu.el12
1 files 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)))