I have some code blocks whose output changes based on side-effects e.g. they might be bash scripts that interact with names of files. How do I tell org-publish to publish a certain file every time from within the file?
of course, I can force publish every time but that wastes time when I could selectively force-publish a couple files. I also want it to be from within the file because editing my emacs configuration rather than editing the file I'm already in is more work.
Assuming that the problem you describe is caused by timestamp checking, you can customize org-publish-use-timestamps-flag
and set it to nil
.
See Triggering Publication in the manual:
14.4 Triggering Publication
===========================
Once properly configured, Org can publish with the following commands:
‘C-c C-e P x’ (‘org-publish’)
Prompt for a specific project and publish all files that belong to
it.
‘C-c C-e P p’ (‘org-publish-current-project’)
Publish the project containing the current file.
‘C-c C-e P f’ (‘org-publish-current-file’)
Publish only the current file.
‘C-c C-e P a’ (‘org-publish-all’)
Publish every project.
Org uses timestamps to track when a file has changed. The above
functions normally only publish changed files. You can override this
and force publishing of all files by giving a prefix argument to any of
the commands above, or by customizing the variable
‘org-publish-use-timestamps-flag’. This may be necessary in particular
if files include other files via ‘SETUPFILE’ or ‘INCLUDE’ keywords.