mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2025-01-22 19:47:07 +00:00
org-babel-tangle-publish: Keep the original tangled files
* lisp/ob-tangle.el (org-babel-tangle-publish): When publishing tangled files, do not remove the original versions of these files. Keeping was the old behaviour that some users relied upon. Removing the tangled files may also be unexpected when they were tangled outside publishing, during normal user workflows. Update the docstring to explicitly state that the tangled files are copied. Reported-by: Gilles Marait <gilles.marait@inria.fr> Link: https://orgmode.org/list/878qvtkwhn.fsf@localhost
This commit is contained in:
parent
72fa36b688
commit
778a29dcc6
@ -227,13 +227,11 @@ Return list of the tangled file names."
|
||||
(org-babel-tangle nil target-file lang-re)))))
|
||||
|
||||
(defun org-babel-tangle-publish (_ filename pub-dir)
|
||||
"Tangle FILENAME and place the results in PUB-DIR."
|
||||
(unless (file-exists-p pub-dir)
|
||||
(make-directory pub-dir t))
|
||||
(setq pub-dir (file-name-as-directory pub-dir))
|
||||
;; 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))
|
||||
"Tangle FILENAME and copy the tangled file to PUB-DIR."
|
||||
(require 'ox-publish)
|
||||
(declare-function org-publish-attachment "ox-publish"
|
||||
(plist filename pub-dir))
|
||||
(mapc (lambda (el) (org-publish-attachment nil el pub-dir))
|
||||
(org-babel-tangle-file filename)))
|
||||
|
||||
;;;###autoload
|
||||
|
Loading…
Reference in New Issue
Block a user