From 5f1c5d4e56afd91db85884df6018960f3639230b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20Lechtenb=C3=B6rger?= Date: Mon, 12 Aug 2024 09:40:13 +0200 Subject: [PATCH] lisp/ox-publish.el: Use publish time in publish cache * lisp/ox-publish.el (org-publish-update-timestamp): Store current time in publish cache, instead of modification time of source file. (org-publish-cache-file-needs-publishing): Return t, if source or an included file was modified more recently. Previously, a source file including a newer file was published again and again. Now, publishing only happens if either source or an included file changed since the last publishing. --- lisp/ox-publish.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el index 9f943cedc..e26e2ca37 100644 --- a/lisp/ox-publish.el +++ b/lisp/ox-publish.el @@ -389,7 +389,7 @@ still decide about that independently." "Update publishing timestamp for file FILENAME. If there is no timestamp, create one." (let ((key (org-publish-timestamp-filename filename pub-dir pub-func)) - (stamp (org-publish-cache-mtime-of-src filename))) + (stamp (current-time))) (org-publish-cache-set key stamp))) (defun org-publish-remove-all-timestamps () @@ -1286,9 +1286,10 @@ If FREE-CACHE, empty the cache." (defun org-publish-cache-file-needs-publishing (filename &optional pub-dir pub-func _base-dir) "Check the timestamp of the last publishing of FILENAME. -Return non-nil if the file needs publishing. Also check if -any included files have been more recently published, so that -the file including them will be republished as well." +Return non-nil if the file needs publishing. This is the case +if either FILENAME does not occur in the publication cache or +if FILENAME, or any file included by it, was modified after the +most recent publication." (unless org-publish-cache (error "`org-publish-cache-file-needs-publishing' called, but no cache present")) @@ -1322,7 +1323,7 @@ the file including them will be republished as well." (or (null pstamp) (let ((mtime (org-publish-cache-mtime-of-src filename))) (or (time-less-p pstamp mtime) - (cl-some (lambda (ct) (time-less-p mtime ct)) + (cl-some (lambda (ct) (time-less-p pstamp ct)) included-files-mtime)))))) (defun org-publish-cache-set-file-property -- 2.25.1