Hello, Arun Isaac <theroarofthedra...@gmail.com> writes:
> If org-publish-find-title is called before org-publish-cache is > initialized (by some routine calling org-publish-initialize-cache), a > "no cache present" error is signalled. > > This happens because org-publish-find-title does not pass a PROJECT-NAME > argument to org-publish-cache-get-file-property. Only if a PROJECT-NAME > argument is passed to org-publish-cache-get-file-property does it > initialize the cache. > > Can this be considered a bug? Is org-publish-cache-get-file-property > supposed to automatically initialize the cache if it is not present? Or > is the user supposed to initialize the cache manually if required? > > In my use case, my preparation-function calls > org-publish-find-title. However org-publish-projects initializes the > cache only after executing the preparation function. Hence I get a "no > cache present" error. IIUC, you are responsible for calling `org-publish-find-title', an internal "ox-publish" function, before `org-publish-cache' is initialized. In this case I tend to think that you are also responsible for taking care of the cache. > I could work around this problem by simply initializing the cache on my > own. But, I'm wondering if this can be fixed at a more fundamental > level. You can suggest a patch, if you want to. The problem is that functions calling `org-publish-cache-get-file-property' do not usually know about the current project name. Calling `org-publish-get-project-from-filename' each time is a bit expensive, IMO. Regards, -- Nicolas Goaziou