I have hundreds Org files under a directory hierarchy and would want to export only those recently modified in HTML to speed up the process. I have the following project alist that I feed up to org-publish
:
`("html"
:base-directory "~/Org/wiki"
:base-extension "org"
:include ,(my/org-files-to-publish)
:with-broken-links t
:publishing-directory "~/Org/wiki"
:publishing-function org-html-publish-to-html)
where (my/org-files-to-publish)
returns recent Org files to export.
It seems that org-publish
considers not only files of :include
but also unconditionally those immediately under the root directory (e.g. ~/Org/wiki
here).
Question: How to export exactly a list of Org files to HTML ?
As :exclude
accepts only regex and not a files list, I can't find a reliable way to do what I want beside looping on (my/org-files-to-publish)
using org-publish-file
plus some extra stuff org-publish-projects
does.
P.S. This theory is confirmed by checking the output of set-difference :test 'equal
between org-publish-get-base-files PROJECT
and (my/org-files-to-publish)
.
my/org-files-to-publish
is only called once above: when you defineorg-publish-project-alist
in the first place. Once that has been done, the:include
list is set for the duration of the session. So the problem is NOT how to export exactly a list of Org files: you do that by setting the:include
property. Your problem seems to be: how to dynamically change the:include
property so that its value is the result of the function call. Am I understanding the problem correctly?org-publish-project-alist
, I use a project alist that I feed up toorg-publish
whenever I'm publishing. Somy/org-files-to-publish
is called each time, and the list of files indeed changes dynamically. I print the list length to make sure this really happens. Now, no matter what list I'm exporting, it always exports and start by the first-level files unconditionally (even if the list doesn't include them). And this is becauseorg-publish-projects
(called byorg-publish
) includes them by callingorg-publish-get-base-files
.:include
those files exclusively.