emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Brett Viren <bv@bnl.gov>
To: emacs-orgmode@gnu.org
Subject: org-redisplay-inline-images and export to HTML
Date: Mon, 21 Jul 2014 18:12:10 -0400	[thread overview]
Message-ID: <ir4zjg2uzt1.fsf@lycastus.phy.bnl.gov> (raw)

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

Someone recently posted a tip to add

  :post (org-redisplay-inline-images)

to a SRC block which generates an image in order to freshen the Emacs
buffer with the regenerated image each time the block is executed.  It
works *almost* fine but I have two problems which I hope someone can
help with.


1) Priming-the-pump

I'm using a document containing a GraphViz graph and running "dot" on it:

----------------------------------------------------------------------
#+BEGIN_SRC dot :cmd dot :cmdline -Tpng :file foo.png :exports results :post (org-redisplay-inline-images) 
  digraph "foo" {
    rankdir=LR;
    params -> builders;
    builders -> objects;
    objects -> file;
  }
#+END_SRC
----------------------------------------------------------------------

I do "C-c C-c" in the block and the buffer does not display any result.
I see the messages:

----------------------------------------------------------------------
No images to display inline
executing Dot code block...
Wrote /tmp/babel-11819Iqr/ob-input-11819Lrv
org-babel-ref-resolve: Reference 'No images to display inline' not found in this buffer
----------------------------------------------------------------------

If I do "C-c hh" to export to HTML I see:

----------------------------------------------------------------------
org-babel-exp processing...
No images to display inline [2 times]
executing Dot code block...
Wrote /tmp/babel-11819Iqr/ob-input-11819kTR
org-babel-ref-resolve: Reference 'No images to display inline' not found in this buffer
----------------------------------------------------------------------

And I get no HTML file produced.

If I now take out the :post and do "C-c C-c" I get this appearing just
after the SRC block as expected:

----------------------------------------------------------------------
#+RESULTS:
[[file:foo.png]]
----------------------------------------------------------------------

If I now add back the ":post" and do "C-c C-c" again I get the inlined
image.  I can now edit the SRC block and repeat the "C-c C-c" and I am
pleased to see the figure refresh each time.  It's great!  But, it needs
this "pump priming".


2) Post-priming, still no HTML export

After this "priming the pump" is done the second problem is that still a
"C-c hh" does not produce an exported HTML file.  Similar messages:

----------------------------------------------------------------------
org-babel-exp processing...
No images to display inline
Inline image display turned off
No images to display inline
executing Dot code block...
Wrote /tmp/babel-11819Iqr/ob-input-11819zYx
org-babel-ref-resolve: Reference 'No images to display inline' not found in this buffer
----------------------------------------------------------------------

Finally, if I remove the :post but leave the "#+RESULTS:" I can do 
a successful "C-c hh".  

So, the upshot is I have to keep adding and removing the :post to make
things work in different contexts.  This is obviously not so smooth.


Is there some way to both have my cake an eat it too?

Thanks!
-Brett.

[-- Attachment #2: Type: application/pgp-signature, Size: 180 bytes --]

             reply	other threads:[~2014-07-21 22:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-21 22:12 Brett Viren [this message]
2014-07-21 23:17 ` org-redisplay-inline-images and export to HTML Nick Dokos
2014-07-22 13:57   ` Brett Viren
2014-07-22 15:40     ` Nick Dokos
     [not found]       ` <8761ip5rml.fsf-/Z0n3E7Cx4sTdff2QS34phcY2uh10dtjAL8bYrjMMd8@public.gmane.org>
2015-01-22 13:34         ` Live refresh of inline images with org-display-inline-images stopped working Sebastien Vauban

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=ir4zjg2uzt1.fsf@lycastus.phy.bnl.gov \
    --to=bv@bnl.gov \
    --cc=emacs-orgmode@gnu.org \
    /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).