(Emacs/elisp/literate)+delete the old output before making a new one

org-babel-tangle-file works doesn't alter timestamps if it thinks the
Emacs Lisp file it could produce isn't any different from the one
already there.  We've already done the stat check, and don't
particularly care for what org-babel-tangle-file thinks.  Hence we
should delete the file to force org-babel-tangle-file to generate a
new file.
This commit is contained in:
2024-07-25 02:41:43 +01:00
parent 571a896f7c
commit 4f934a8a7c

View File

@@ -98,12 +98,14 @@
(let ((output-file (+literate/org-to-el org-file))) (let ((output-file (+literate/org-to-el org-file)))
(when (file-newer-than-file-p org-file output-file) (when (file-newer-than-file-p org-file output-file)
(message "[Literate]:\tTangle(%s)->%s" org-file output-file) (message "[Literate]:\tTangle(%s)->%s" org-file output-file)
(delete-file output-file)
(org-babel-tangle-file org-file)))) (org-babel-tangle-file org-file))))
(defun +literate/byte-compile-if-old (el-file) (defun +literate/byte-compile-if-old (el-file)
(let ((output-file (+literate/el-to-elc el-file))) (let ((output-file (+literate/el-to-elc el-file)))
(when (file-newer-than-file-p el-file output-file) (when (file-newer-than-file-p el-file output-file)
(message "[Literate]:\tByteCompile(%s)->%s" el-file output-file) (message "[Literate]:\tByteCompile(%s)->%s" el-file output-file)
(delete-file output-file)
(byte-compile-file el-file)))) (byte-compile-file el-file))))
(defun +literate/load-org-file (org-file) (defun +literate/load-org-file (org-file)