mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-30 02:30:03 +00:00
org-plot: Refresh inline images after plotting
* lisp/org-plot.el (org-plot/redisplay-img-in-buffer): New function which searches the current Org buffer for overlays of a certain image, and refreshes those overlays. (org-plot/gnuplot): Use `org-plot/redisplay-img-in-buffer' after plotting to redisplay any associated inline images.
This commit is contained in:
parent
0f7d2823fd
commit
dadbd025fa
|
@ -616,6 +616,13 @@ manner suitable for prepending to a user-specified script."
|
||||||
",\\\n "))))
|
",\\\n "))))
|
||||||
script)))
|
script)))
|
||||||
|
|
||||||
|
(defun org-plot/redisplay-img-in-buffer (img-file)
|
||||||
|
"Find any overlays for IMG-FILE in the current Org buffer, and refresh them."
|
||||||
|
(dolist (img-overlay org-inline-image-overlays)
|
||||||
|
(when (string= img-file (plist-get (cdr (overlay-get img-overlay 'display)) :file))
|
||||||
|
(when (file-exists-p img-file)
|
||||||
|
(image-refresh (overlay-get img-overlay 'display))))))
|
||||||
|
|
||||||
;;-----------------------------------------------------------------------------
|
;;-----------------------------------------------------------------------------
|
||||||
;; facade functions
|
;; facade functions
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
@ -703,7 +710,10 @@ line directly before or after the table."
|
||||||
(gnuplot-mode)
|
(gnuplot-mode)
|
||||||
(gnuplot-send-buffer-to-gnuplot))
|
(gnuplot-send-buffer-to-gnuplot))
|
||||||
;; Cleanup.
|
;; Cleanup.
|
||||||
(bury-buffer (get-buffer "*gnuplot*")))))
|
(bury-buffer (get-buffer "*gnuplot*"))
|
||||||
|
;; Refresh any displayed images
|
||||||
|
(when (plist-get params :file)
|
||||||
|
(org-plot/redisplay-img-in-buffer (expand-file-name (plist-get params :file)))))))
|
||||||
|
|
||||||
(provide 'org-plot)
|
(provide 'org-plot)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue