org-babel-tangle: Do note erase the existing tangle target before overwriting
* lisp/ob-tangle.el (org-babel-tangle): Do not remove the existing tangle target file, if any. `write-region' later will overwrite it anyway, while removing may be unexpected if the existing target is a symlink. Reported-by: Cletip Cletip <clement020302@gmail.com> Link: https://list.orgmode.org/orgmode/CAPHku6O9NfVMAfmE3_ahmpJea_2Qm0mJMFX6qPpT8uiQ94KMZA@mail.gmail.com/
This commit is contained in:
parent
d6924212bd
commit
fbcd71e856
|
@ -313,9 +313,8 @@ matching a regular expression."
|
|||
(compare-buffer-substrings
|
||||
nil nil nil
|
||||
tangle-buf nil nil)))))))
|
||||
;; erase previous file
|
||||
(when (file-exists-p file-name)
|
||||
(delete-file file-name))
|
||||
;; We do not erase, but overwrite previous file
|
||||
;; to preserve any existing symlinks.
|
||||
(write-region nil nil file-name)
|
||||
(mapc (lambda (mode) (set-file-modes file-name mode)) modes))
|
||||
(push file-name path-collector))))))
|
||||
|
|
Loading…
Reference in New Issue