emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: org-redisplay-inline-images and export to HTML
Date: Mon, 21 Jul 2014 19:17:05 -0400	[thread overview]
Message-ID: <87vbqq5mku.fsf@alphaville.bos.redhat.com> (raw)
In-Reply-To: ir4zjg2uzt1.fsf@lycastus.phy.bnl.gov

Brett Viren <bv@bnl.gov> writes:

> 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
>    ...
>
> 2) Post-priming, still no HTML export
>
>    ...
>
> 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?
>

The :post trick works by side-effect: org-redisplay-inline-images does
what it says and it returns the string that `message' prints in the echo
area. Unfortunately, on export, :post is processed further with the
result that the meaningless string is passed to org-babel-ref-resolve
as a reference to be resolved - with predictable results[fn:1].

I think you'd be better off with the tip that Rick Frankel posted in
the same thread:

--8<---------------cut here---------------start------------->8---
#+BEGIN_SRC emacs-lisp
(add-hook 'org-babel-after-execute-hook
(lambda () (org-display-inline-images nil t)))
#+END_SRC
--8<---------------cut here---------------end--------------->8---

That's executed after you evaluate the block so it displays any
image(s) produced. And it does not interfere with export.

Footnotes:

[fn:1] Assuming 20-20 hindsight of course...

Nick

  reply	other threads:[~2014-07-21 23:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-21 22:12 org-redisplay-inline-images and export to HTML Brett Viren
2014-07-21 23:17 ` Nick Dokos [this message]
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=87vbqq5mku.fsf@alphaville.bos.redhat.com \
    --to=ndokos@gmail.com \
    --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).