stardiviner <numbch...@gmail.com> writes:

> I updated the patch.

Thanks!

> +
> +(add-hook 'org-babel-after-execute-hook 'org-toggle-inline-image-in-results)

Please note that `org-babel-after-execute-hook' is not necessarily
evaluated with point at the src block being executed.

> +(defun org-toggle-inline-image-in-results ()
> +  "Toggle inline image in babel source block results.
> +It support displaying multiple continous inline images in results."
> +  (unless (eq this-command 'org-babel-tangle)

... so this check is not really sufficient. The very reason why
`org-babel-tangle' fails with this code is because `org-babel-tangle'
with noweb references may evaluate code blocks and point position will
be at the tangled code block rather than at the code blocks being
evaluated.

`org-babel-tangle' is not the only function that may trigger block
evaluation in such a way. Any kind of reference resolution might.

We need to come up with same safe way to only display inline images in
the results when those images are actually updated interactively.
We might even need a new kind of hook that is given more contextual info
about code evaluation.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
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