emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [FR] Automatically display images in resutls of evaluation


From: Ihor Radchenko
Subject: Re: [FR] Automatically display images in resutls of evaluation
Date: Thu, 22 Aug 2024 13:06:14 +0000

[ Adding Org ML back to CC ]

"Christopher M. Miles" <numbchild@gmail.com> writes:

>> A simple `org-display-inline-images' would do (with REFRESH argument).
>
> I will adjust my upper code snippet in my Emacs config.

I myself have something similar in my config:

(add-hook
 'org-babel-after-execute-hook
 (lambda ()
   (unless (eq this-command 'org-babel-tangle)
     (org-display-inline-images
      nil nil
      (save-excursion (org-back-to-heading-or-point-min t) (point))
      (save-excursion (or (outline-next-heading) (point-max)))))))

And unless (eq this-command 'org-babel-tangle) was there for a reason
(although I do not remember what was that reason). Still, need to be
careful.

>> I suggest to put this (1) under a new custom option; (2) only when
>> Emacs can actually display images.
>
> I suggest use an custom option for this behavior. About (2), can add a 
> condition: (display-graphic-p)
>
> (when (display-graphic-p)

Looks reasonable.

>     (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))))

What is more than one image? What if it is wrapped into, say, a drawer?
I'd rather be a bit less selective and refresh the whole result element.

Looking forward to your updated patch.

-- 
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>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]