William Denton <[email protected]> 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/[email protected]/
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>