I found a lot of third-part Emacs packages refresh Org source block image 
result using the API function like this:

#+begin_src emacs-lisp
;; Automatically refresh inline images.
  (add-hook 'org-babel-after-execute-hook
            (defun ob-dall-e--refresh-inline-images ()
              (when org-inline-image-overlays

The `org-redisplay-inline-images' will refresh whole buffer inline
images. When the buffer is a big Org file, and not all inline images are
display already by default (still image file links under fold status).
Invoking `org-redisplay-inline-images' will cause Emacs suspend a long

So I suggest to add an variant local function of
`org-redisplay-inline-images' which named
`org-redisplay-inline-images-under-headline' that only redisplay inline
images under current headline to solve the issue.

Here is the diff code prototype, Ihor, can you review it? If it's ok, I
will send patch update then.

#+begin_src diff
 (defun org-redisplay-inline-images ()
-  "Assure display of inline images and refresh them."
+  "Assure display of global all inline images in buffer and refresh them.
+NOTE: This function will refresh whole buffer inline images, if
+you only want to refresh inline images under headline, suggest to
+use `org-redisplay-inline-images-under-headline' in your hook or advice."
   (unless org-inline-image-overlays
+(defun org-redisplay-inline-images-under-headline ()
+  "Assure display of images under current headline and refresh them.
+This function is the suggested to be used in hook or advice."
+  (interactive)
+  (org-with-wide-buffer
+   (org-narrow-to-subtree)
+   ;; If has nested headlines, beg,end only from parent headline
+   ;; to first child headline which reference to upper
+   ;; let-binding `org-next-visible-heading'.
+   (org-display-inline-images
+    nil nil
+    (point-min) (progn (org-next-visible-heading 1) (point)))))


[ stardiviner ]
I try to make every word tell the meaning that I want to express without 

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3

Attachment: signature.asc
Description: PGP signature

Reply via email to