Brett Viren <b...@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