[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] org-babel-load-file can not compile file

From: Ihor Radchenko
Subject: Re: [BUG] org-babel-load-file can not compile file
Date: Fri, 13 May 2022 18:38:14 +0800

Max Nikulin <manikulin@gmail.com> writes:

>> What if you substitute the load call with
>> (load (byte-compile-dest-file tangled-file))?
> I do not mind (of course if there is no plan to deprecate the function).
> In addition, from my point of view, `byte-recompile-file' with 0 as the 
> FORCE argument is more suitable than simple `byte-compile-file' since 
> the former does not rewrite the compiled file when it is up to date.

What about simply using touch?

>From 9746b9cd0a1accfc20b9d59c387bb05624154fe2 Mon Sep 17 00:00:00 2001
From: Ihor Radchenko <yantar92@gmail.com>
Date: Fri, 13 May 2022 18:21:36 +0800
Subject: [PATCH] org-babel-load-file: Do not rely on `org-babel-tangle-file'
 making changes

* lisp/org.el (org-babel-load-file): Update modification time even
when `org-babel-tangle-file' does not actually modify the tangled
file.  This makes sure that modify-time comparison logic does not make
Org re-tangle Org file that had been changed but the changes did not
affect the tangled code.

See https://orgmode.org/list/t5j75h$dbo$1@ciao.gmane.io
 lisp/org.el | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lisp/org.el b/lisp/org.el
index 47a16e94b..09a001414 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -256,6 +256,11 @@ (defun org-babel-load-file (file &optional compile)
              (file-attributes (file-truename file))))
+      ;; Make sure that tangled file modification time is
+      ;; updated even when `org-babel-tangle-file' does not make changes.
+      ;; This avoids re-tangling changed FILE where the changes did
+      ;; not affect the tangled code.
+      (set-file-times tangled-file)
       (org-babel-tangle-file file
                              (rx string-start

reply via email to

[Prev in Thread] Current Thread [Next in Thread]