Latest iteration of patch attached. > In theory, we might not need to clear image cache as long as we call > `image-flush' in `org-link-preview-clear'. Removed (clear-image-cache) when refreshing since we run (image-flush) unconditionally in org-link-preview-file. > My hesitance about top-level require is that ol.el is loaded by default > and that the preview functionality may or may not be used by the > users. So, loading image.el ought to be optional. No change here. > It means that you are scheduling every single preview batch to fire at > the same time. I think that the timers here should run sequentially - > (1) fire the first batch without delay; (2) wait org-link-preview-delay > and fire the next batch; (3) ... Done, and tested preview run timings to be sure. >> + (lambda (previews) >> + ;; (message "queue: %d" preview-queue-size) >> + (cl-decf preview-queue-size) >> + (dolist (preview-spec (nreverse previews)) >> + (when-let* ((ov (cadr preview-spec)) >> + (buf (overlay-buffer ov))) > > ov or its buffer may not exit at the time the timer is fired. > Because, for example, the buffer is killed, or because user edited the > underlying link before it got displayed. Handled by (overlay-buffer ov), as explained in the previous email. Karthik