emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: CS Suehs <skelter.net@gmail.com>
To: Nick Daly <nick+orgmode@despisinggravity.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: plantuml, png and caching
Date: Thu, 15 Apr 2021 12:46:53 -0500	[thread overview]
Message-ID: <CAJbc-DLwrqNQzVXUDjzBGW9kfJ+bdJFQ1fJmd4Ryb2neTt=jzQ@mail.gmail.com> (raw)
In-Reply-To: <87a6q12019.fsf@europa>

Nick,
I had the :cache yes on the same line with #+BEGIN like
#+BEGIN_SRC plantuml :file helloworld.png :cache yes

When I change to your method, caching seems to work.
It looks like setting it as a section property also works.

Thank you.
Should I expect the setting on the BEGIN_SRC line to work?

On Tue, Apr 13, 2021 at 7:16 PM Nick Daly
<nick+orgmode@despisinggravity.com> wrote:
>
> CS Suehs <skelter.net@gmail.com> writes:
>
> > Should I expect PlantUML source blocks and their resulting images to
> > be cached and respect `:cache true` ?
>
> Yes.
>
> > In my experience they regenerate every export, even with :cache true.
>
> Can you provide an example?
>
> This example caches correctly for me on v9.1.14.
>
>     #+name: helloworld
>     #+header: :cache yes
>     #+BEGIN_SRC plantuml :file helloworld.png
>       @startuml
>       Hello --> World
>       @enduml
>     #+END_SRC
>
>     #+RESULTS[f29ead8751dde1b4c4ee1b8fcb97e133c75eed0d]: helloworld
>     [[file:helloworld.png]]
>
> The only time I've seen caching break is if the diagram imports an
> external file.  In that case, the diagram doesn't regenerate often
> enough, because org doesn't notice that the external file changed.  The
> fix to that is to include the hash of the external file as a dependent
> var.
>
>     #+name: md5
>     #+BEGIN_SRC shell :cache no :var afile="PLACEHOLDER"
>       md5sum $afile
>     #+END_SRC
>
>     #+name: cache-correctly
>     #+header: :var md5input=md5("data.txt")
>     #+BEGIN_SRC R :exports results :results output graphics :file data.svg
>       aData <- read.csv("data.txt")
>       ggplot(data = aData,
>              mapping = aes(x = aData$id, y = aData$value))
>     #+END_SRC
>
> Thanks,
> Nick


  reply	other threads:[~2021-04-15 17:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13 21:54 CS Suehs
2021-04-14  0:16 ` Nick Daly
2021-04-15 17:46   ` CS Suehs [this message]
2021-04-15 18:33     ` George Mauer
2021-04-18 18:10       ` Nick Daly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJbc-DLwrqNQzVXUDjzBGW9kfJ+bdJFQ1fJmd4Ryb2neTt=jzQ@mail.gmail.com' \
    --to=skelter.net@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=nick+orgmode@despisinggravity.com \
    --subject='Re: plantuml, png and caching' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this 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).