Function: gnuplot--insert-inline-image-output
gnuplot--insert-inline-image-output is a natively compiled function
defined in gnuplot.el.
Signature
(gnuplot--insert-inline-image-output STRING)
Documentation
Insert Gnuplot graphical output STRING in the gnuplot-comint buffer.
Called via comint-preoutput-filter-functions hook when
gnuplot-inline-image-mode is enabled. Checks the status of the
file gnuplot--inline-image-filename; if it exists and has
nonzero size, inserts it as an inline image, stores a new
temporary filename in gnuplot--inline-image-filename, and
updates Gnuplot with the appropriate "set output" command.
Source Code
;; Defined in /nix/store/xvcy7r1jiw71avhnh6kmin403kpqrdhc-emacs-packages-deps/share/emacs/site-lisp/elpa/gnuplot-20260623.1111/gnuplot.el
(defun gnuplot--insert-inline-image-output (_string)
"Insert Gnuplot graphical output STRING in the gnuplot-comint buffer.
Called via `comint-preoutput-filter-functions' hook when
`gnuplot-inline-image-mode' is enabled. Checks the status of the
file `gnuplot--inline-image-filename'; if it exists and has
nonzero size, inserts it as an inline image, stores a new
temporary filename in `gnuplot--inline-image-filename', and
updates Gnuplot with the appropriate \"set output\" command."
(unless gnuplot--inhibit-filter ; Prevent recursively entering this filter
(let ((gnuplot--inhibit-filter t)) ; (causing an infinite loop)
(save-excursion
(goto-char (point-max))
(beginning-of-line)
(when (looking-at gnuplot--prompt-regexp)
(let* ((filename gnuplot--inline-image-filename)
(size (nth 7 (file-attributes filename))))
(when (and size (> size 0))
(gnuplot-send-hiding-output "set output\n") ; Flush output file
(sit-for 0.1) ; Hack: wait for Gnuplot IO to finish
(cl-ecase gnuplot-inline-image-mode
((nil) nil)
(inline
(ignore-errors
(let ((image (create-image filename)))
(beginning-of-line)
(insert-image image)
(insert "\n")
(gnuplot--inline-image-set-output))))
(dedicated
(with-current-buffer (get-buffer-create gnuplot-image-buffer)
(let ((inhibit-read-only t))
(erase-buffer)
(insert-file-contents filename)
(ignore-errors (normal-mode))
(display-buffer (current-buffer))
(gnuplot--inline-image-set-output))))))))))))