fix(org): don't refresh images while exporting/tangling
Also limits the scope of org-display-inline-images to the current src block. org-display-inline-images was previously used on the entire subtree, which was slower than it needed to be (especially while exporting/tangling org).
This commit is contained in:
parent
9c2621020e
commit
69340149f9
1 changed files with 13 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue