stardiviner <numbch...@gmail.com> writes: > I have an idea, would you like to add an function in bellowing: > > #+begin_src emacs-lisp > (defun org-toggle-inline-images-in-results () > "Toggle inline images in babel source block results." > (save-excursion > ;; [C-c C-v C-o] `org-babel-open-src-block-result' > (let ((begin (org-babel-where-is-src-block-result)) > (end (progn > (end-of-line) > (skip-chars-forward " \r\t\n") > (looking-at org-link-bracket-re) > ;; (org-babel-read-result) > (point)))) > (org-toggle-inline-images-command nil begin end)))) > > (add-hook 'org-babel-after-execute-hook > 'org-toggle-inline-images-in-results) > #+end_src > > WDYT? after all I originally propose this patch for this purpose to > improve the babel result inline image toggle displaying performance.
I do not mind this kind of feature, but `org-babel-after-execute-hook' is probably not the best place - it may be triggered noninteractively, including in Emacs running in batch mode, where displaying images is impossible. In particular, `org-babel-tangle' does it. Also, you do not need `org-toggle-inline-images-command' for this. You do not need "toggle" in general - what if an image was previously displayed and you evaluate an src block? A simple `org-display-inline-images' would do (with REFRESH argument). I suggest to put this (1) under a new custom option; (2) only when Emacs can actually display images. -- 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>