emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 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/)]
@ 2015-12-02 15:41 Arun Isaac
  2015-12-06 17:55 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Arun Isaac @ 2015-12-02 15:41 UTC (permalink / raw)
  To: emacs-orgmode


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.

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.

Thank you,
Arun Isaac.

Emacs  : GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.6)
 of 2015-09-10 on foutrelis
Package: Org-mode version 8.3.1 (release_8.3.1-505-g6b2c38 @ /home/arunisaac/.emacs.d/org-mode/lisp/)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* 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/)]
  2015-12-02 15:41 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/)] Arun Isaac
@ 2015-12-06 17:55 ` Nicolas Goaziou
  2015-12-07 12:09   ` Arun Isaac
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2015-12-06 17:55 UTC (permalink / raw)
  To: Arun Isaac; +Cc: emacs-orgmode

Hello,

Arun Isaac <theroarofthedragon@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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* 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/)]
  2015-12-06 17:55 ` Nicolas Goaziou
@ 2015-12-07 12:09   ` Arun Isaac
  0 siblings, 0 replies; 3+ messages in thread
From: Arun Isaac @ 2015-12-07 12:09 UTC (permalink / raw)
  To: Emacs orgmode

[-- Attachment #1: Type: text/plain, Size: 1169 bytes --]

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> 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.

Is org-publish-find-title an internal function? If so, expecting the
user to be responsible for initializing the cache is acceptable.

But, is there some "external function" to find the title of an org file?
I couldn't find any, and hence resorted to using org-publish-find-title.

> 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.

How about initializing the cache before the execution of the preparation
function? I am calling org-publish-find-title in the preparation
function, and this would address my use case. If you think this is a
good idea, I can come up with a patch.

Else, we can close this issue. It's not really a major problem.

Regards,
Arun Isaac

[-- Attachment #2.1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-07 12:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-02 15:41 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/)] Arun Isaac
2015-12-06 17:55 ` Nicolas Goaziou
2015-12-07 12:09   ` Arun Isaac

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).