diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index e1118a9bc..674c7928a 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -305,7 +305,19 @@ Also adds support for a `:sync' parameter to override `:async'." ;; Refresh inline images after executing src blocks (useful for plantuml or ;; ipython, where the result could be an image) - (add-hook 'org-babel-after-execute-hook #'org-redisplay-inline-images) + (add-hook! 'org-babel-after-execute-hook + (defun +org-redisplay-inline-images-in-babel-result-h () + (unless (or + ;; ...but not while Emacs is exporting an org buffer (where + ;; `org-display-inline-images' can be awfully slow). + (bound-and-true-p org-export-current-backend) + ;; ...and not while tangling org buffers (which happens in a temp + ;; buffer where `buffer-file-name' is nil). + (string-match-p "^ \\*temp" (buffer-name))) + (org-display-inline-images + nil nil + (org-babel-where-is-src-block-result) + (org-babel-result-end))))) (after! python (unless org-babel-python-command