emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Max Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] org-babel-load-file can not compile file
Date: Fri, 13 May 2022 18:38:14 +0800	[thread overview]
Message-ID: <878rr5ra3t.fsf@localhost> (raw)
In-Reply-To: <t5j75h$dbo$1@ciao.gmane.io>

[-- Attachment #1: Type: text/plain, Size: 468 bytes --]

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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-babel-load-file-Do-not-rely-on-org-babel-tangle-.patch --]
[-- Type: text/x-patch, Size: 1458 bytes --]

From 9746b9cd0a1accfc20b9d59c387bb05624154fe2 Mon Sep 17 00:00:00 2001
Message-Id: <9746b9cd0a1accfc20b9d59c387bb05624154fe2.1652438075.git.yantar92@gmail.com>
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)
 	     tangled-file
 	     (file-attribute-modification-time
 	      (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
                              tangled-file
                              (rx string-start
-- 
2.35.1


  reply	other threads:[~2022-05-13 10:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10  7:34 [BUG] org-babel-load-file can not compile file Max Nikulin
2022-05-11 12:41 ` Ihor Radchenko
2022-05-12 14:55   ` Max Nikulin
2022-05-13 10:38     ` Ihor Radchenko [this message]
2022-05-13 10:38     ` Ihor Radchenko
2022-05-14 10:36       ` Max Nikulin
2022-05-14 11:35         ` Ihor Radchenko
2022-05-16 14:53           ` Max Nikulin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rr5ra3t.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=manikulin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).