branch: elpa/gnuplot
commit d6f8598a0cf5938780aff68333c6d119e1de8724
Author: joddie <[email protected]>
Commit: joddie <[email protected]>
Cleanup inline-image mode
- Check for the ability to display images whenever
`gnuplot-inline-image-mode` is non-nil (not only when `inline`)
- Use `message` rather than `error` when images cannot be displayed;
should avoid annoying startup errors when the same configuration is
shared between graphical and TTY emacs
- Check that the Gnuplot process is running before sending commands to
set up image capturing
---
gnuplot.el | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/gnuplot.el b/gnuplot.el
index e5b3e99..9f34377 100644
--- a/gnuplot.el
+++ b/gnuplot.el
@@ -704,10 +704,12 @@ symbol `complete' in gnuplot-mode buffers."
(defun gnuplot-set-display-mode (variable value &rest args)
"Customize :set function for `gnuplot-inline-image-mode'."
(if (and (eq variable 'gnuplot-inline-image-mode)
- (eq value 'inline)
+ value
(not (gnuplot-display-images-p)))
- (error "Displaying images is not supported."))
- (set variable value)
+ (progn
+ (message "Displaying images is not supported.")
+ (set variable nil))
+ (set variable value))
(gnuplot-setup-comint-for-image-mode))
(defcustom gnuplot-inline-image-mode nil
@@ -2467,7 +2469,8 @@ gnuplot process buffer will be displayed in a window."
(message "Setting will take effect when plots are displayed in Emacs")))
(defun gnuplot-setup-comint-for-image-mode ()
- (when (and gnuplot-buffer (buffer-name gnuplot-buffer))
+ (when (and gnuplot-buffer (buffer-live-p gnuplot-buffer)
+ (get-buffer-process gnuplot-buffer))
(with-current-buffer gnuplot-buffer
(if gnuplot-inline-image-mode
(progn