emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Daly <nick+orgmode@despisinggravity.com>
To: CS Suehs <skelter.net@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: plantuml, png and caching
Date: Tue, 13 Apr 2021 19:16:18 -0500	[thread overview]
Message-ID: <87a6q12019.fsf@europa> (raw)
In-Reply-To: <CAJbc-DLOzs-8VikLt3Ldoi9WMT1rAVOtz97T=E6o4ndeW2b14A@mail.gmail.com>

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-14  1:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13 21:54 plantuml, png and caching CS Suehs
2021-04-14  0:16 ` Nick Daly [this message]
2021-04-15 17:46   ` CS Suehs
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=87a6q12019.fsf@europa \
    --to=nick+orgmode@despisinggravity.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=skelter.net@gmail.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).