William Denton <will...@williamdenton.org> writes:

> Probably everyone on this list who uses Org code blocks to generate
> graphics has something in their configuration file that refreshes the
> image in the buffer when its code block is run and the image is
> regenerated.  What is the (most) correct way to do that?
> ...
> This isn't documented in the manual, and looking around on the web I see a 
> lot of old copied-and-pasted code.  I'm happy to try to update the manual 
> with how to do this.

There is a number of solutions spread across user configs.
Mine has
(add-hook
   'org-babel-after-execute-hook
   (lambda ()
     (unless (eq this-command 'org-babel-tangle)
       (org-display-inline-images
        nil nil
        (save-excursion (org-back-to-heading-or-point-min t) (point))
        (save-excursion (or (outline-next-heading) (point-max)))))))

However, doing this reliably is a bit tricky.
See
https://list.orgmode.org/orgmode/6461a84b.a70a0220.b6d36.5...@mx.google.com/
That patch can hopefully be completed some day.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to