diff options
| author | Antero Mejr <antero@mailbox.org> | 2023-11-17 16:06:53 +0000 |
|---|---|---|
| committer | Ihor Radchenko <yantar92@posteo.net> | 2023-12-09 11:26:03 +0100 |
| commit | 478576749d4a73200f071cdf3c13159eb57d5fe9 (patch) | |
| tree | 64ed044ee74fbbaa49902c90a05de8dee178fb3d | |
| parent | 3280f2f8bd41c391c1b2b37e602ade952d77a8b0 (diff) | |
| download | org-mode-478576749.tar.gz | |
Move files when using `org-babel-tangle-publish'
* lisp/ob-tangle.el (org-babel-tangle-publish): Use `rename-file'
instead of `copy-file' on tangled files.
Fixes `copy-file' error when publishing to the current directory.
Don't leave behind the old tangled files when publishing.
Link: https://orgmode.org/list/87v898mgx4.fsf@mailbox.org
| -rw-r--r-- | lisp/ob-tangle.el | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index b30fd92..bd77292 100644 --- a/lisp/ob-tangle.el +++ b/lisp/ob-tangle.el @@ -219,7 +219,10 @@ Return list of the tangled file names." (unless (file-exists-p pub-dir) (make-directory pub-dir t)) (setq pub-dir (file-name-as-directory pub-dir)) - (mapc (lambda (el) (copy-file el pub-dir t)) (org-babel-tangle-file filename))) + ;; Rename files to avoid copying to same file when publishing to ./ + ;; `copy-file' would throw an error when copying file to self. + (mapc (lambda (el) (rename-file el pub-dir t)) + (org-babel-tangle-file filename))) ;;;###autoload (defun org-babel-tangle (&optional arg target-file lang-re) |
