From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Bug: org-publish-find-title called before cache initialization signals "no cache present" [8.3.1 (release_8.3.1-505-g6b2c38 @ /home/arunisaac/.emacs.d/org-mode/lisp/)] Date: Sun, 06 Dec 2015 18:55:07 +0100 Message-ID: <8737vfo41w.fsf@nicolasgoaziou.fr> References: <87mvtsuace.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43657) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a5dUw-0003Wq-Qa for emacs-orgmode@gnu.org; Sun, 06 Dec 2015 12:53:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a5dUq-0007Ah-Vf for emacs-orgmode@gnu.org; Sun, 06 Dec 2015 12:53:22 -0500 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:52474) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a5dUq-0007AU-Oy for emacs-orgmode@gnu.org; Sun, 06 Dec 2015 12:53:16 -0500 In-Reply-To: <87mvtsuace.fsf@gmail.com> (Arun Isaac's message of "Wed, 02 Dec 2015 21:11:21 +0530") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Arun Isaac Cc: emacs-orgmode@gnu.org Hello, Arun Isaac 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