[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/gnuplot d26d498 062/184: Added a customization option for
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/gnuplot d26d498 062/184: Added a customization option for gnuplot-inline-image-mode. |
Date: |
Sun, 29 Aug 2021 11:03:16 -0400 (EDT) |
branch: elpa/gnuplot
commit d26d498a95353c60863a4af96c5ca30b5adad102
Author: Jonathan Oddie <j.j.oddie@gmail.com>
Commit: joddie <jonxfield@gmail.com>
Added a customization option for gnuplot-inline-image-mode.
- make it behave like a minor mode
- cleaner operation when turning inline images on and off before the
process buffer is created
---
gnuplot.el | 73 ++++++++++++++++++++++++++++++++++++--------------------------
1 file changed, 43 insertions(+), 30 deletions(-)
diff --git a/gnuplot.el b/gnuplot.el
index 119cd2a..3d8c080 100644
--- a/gnuplot.el
+++ b/gnuplot.el
@@ -588,6 +588,7 @@ to the empty string."
;; (const :tag "3.8 or newer" "3.8")
;; (const :tag "3.7 or older" "3.7")))
+
(defvar gnuplot-info-frame nil)
(defvar gnuplot-info-nodes '())
@@ -2133,7 +2134,9 @@ buffer."
(process-kill-without-query gnuplot-process nil)
(with-current-buffer gnuplot-buffer
(gnuplot-comint-mode)
- (gnuplot-inline-image-mode gnuplot-inline-image-mode)
+ (when gnuplot-inline-image-mode
+ (sleep-for gnuplot-delay)
+ (gnuplot-inline-image-mode 1))
(message "Starting gnuplot plotting program...Done")))))
(defun gnuplot-fetch-version-number ()
@@ -2269,39 +2272,49 @@ gnuplot process buffer will be displayed in a window."
;;; --- Support for displaying plot images inline in process buffer,
;;; using `set terminal png' <JJO>
-(defvar gnuplot-inline-image-filename nil
- "Name of the current Gnuplot PNG output file.")
-
-(defvar gnuplot-inline-image-mode 0
- "Whether inline Gnuplot image display is enabled: 1 for on, 0 for off.")
-
(defun gnuplot-inline-image-mode (&optional enable)
"Turn inline display of Gnuplot output in the comint buffer on or off.
-With ENABLE 0, turns inline image display off and restores the
-previous Gnuplot terminal setting. With ENABLE 1, turns inline
-image display on. With no argument, toggles inline image
-display."
- (interactive)
- (if (not (display-images-p))
- (message "Displaying images is not supported.")
- (setq enable (or enable
- (if (zerop gnuplot-inline-image-mode) 1 0)))
-
- (gnuplot-make-gnuplot-buffer)
+Works like a minor mode: with argument, turn inline image display
+on if ENABLE is positive, otherwise turn it off and restores the
+previous Gnuplot terminal setting. With no argument, toggle
+inline image display."
+ (interactive "P")
+ (setq gnuplot-inline-image-mode
+ (if (null enable) (not gnuplot-inline-image-mode)
+ (> (prefix-numeric-value enable) 0)))
+
+ (let (message)
+ (if gnuplot-inline-image-mode
+ (if (display-images-p)
+ (setq message "Plot output will be displayed in gnuplot buffer.")
+ (setq gnuplot-inline-image-mode nil
+ message "Displaying images is not supported."))
+ (setq message "Plot output will be displayed on external terminal."))
+ (when (called-interactively-p 'any) (message message)))
+
+ (when (and gnuplot-buffer (buffer-name gnuplot-buffer))
(with-current-buffer gnuplot-buffer
- (if (zerop enable)
+ (if gnuplot-inline-image-mode
(progn
- (comint-send-string gnuplot-process "set terminal pop\n")
- (setq gnuplot-inline-image-mode 0)
- (remove-hook 'comint-output-filter-functions
- 'gnuplot-insert-inline-image-output t)
- (message "Plot output will be displayed on external terminal."))
- (comint-send-string gnuplot-process "set terminal png\n")
- (gnuplot-inline-image-set-output)
- (add-hook 'comint-output-filter-functions
- 'gnuplot-insert-inline-image-output nil t)
- (setq gnuplot-inline-image-mode 1)
- (message "Plot output will be displayed in gnuplot buffer.")))))
+ (gnuplot-send-hiding-output "set terminal png\n")
+ (gnuplot-inline-image-set-output)
+ (add-hook 'comint-output-filter-functions
+ 'gnuplot-insert-inline-image-output nil t))
+ (gnuplot-send-hiding-output "set terminal pop\n")
+ (remove-hook 'comint-output-filter-functions
+ 'gnuplot-insert-inline-image-output t)))))
+
+(defcustom gnuplot-inline-image-mode nil
+ "Whether to enable inline display of Gnuplot output in the process buffer.
+Don't set this variable directly from Lisp code; instead, use
+Customize or call the `gnuplot-inline-image-mode' function, which
+behaves like a minor-mode function."
+ :group 'gnuplot
+ :type 'boolean
+ :set 'custom-set-minor-mode)
+
+(defvar gnuplot-inline-image-filename nil
+ "Name of the current Gnuplot PNG output file.")
(defun gnuplot-inline-image-set-output ()
"Set Gnuplot's output file to `gnuplot-inline-image-filename'."
- [nongnu] elpa/gnuplot a4d00db 014/184: Added gnuplot-comint-mode. Improved completion, version check (?), (continued)
- [nongnu] elpa/gnuplot a4d00db 014/184: Added gnuplot-comint-mode. Improved completion, version check (?), ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot ca6841b 041/184: Added experimental context-sensitive completion and help code., ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 7cb3975 047/184: Cleaned up the tokenizer and got rid of gnuplot-token-at-point., ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot a276f0d 033/184: Fix bug #8: remove `eval-when-compile' from definition of `gnuplot-make-regexp', ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot cd73487 064/184: Remove other cruft, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 76cfd01 043/184: Lots of fixes to grammar, and some bugfixes., ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 59f7a94 061/184: Better prompt tracking. Setup inline images on creating comint buffer., ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 18dccc2 058/184: Merge branch 'context' into devel, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot d4f8c3a 082/184: display progress while running parse tests, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 6da76ee 052/184: Merge branch 'devel', ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot d26d498 062/184: Added a customization option for gnuplot-inline-image-mode.,
ELPA Syncer <=
- [nongnu] elpa/gnuplot d70c94a 065/184: Better docstrings for context-sensitive and inline-image modes, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 43effb0 068/184: Add gnuplot-context to makefiles., ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot f0b1ea7 085/184: Update lists of font-lock keywords., ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 70dd22e 060/184: Keyboard shortcut and menu item for toggling inline mode., ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot a0fee02 086/184: use `many1' for iteration spec, and tweak its test case, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 2dc71de 077/184: Move window-full-height-p up with other compatibility hacks, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 3245468 084/184: Fixes to context-sensitive grammar, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot a290617 079/184: Make info window/frame handling work alike in context and non-context modes, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot af7e8de 073/184: Remove references to obsolete kw-compl and hilit19 packages, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 630c945 093/184: Clean up build process to be closer to gnuplot source tree., ELPA Syncer, 2021/08/29