(defvar calc-graph-no-wait nil)
(defvar calc-gnuplot-trail-mark)
+(defsubst calc-graph-w32-p ()
+ (eq system-type 'windows-nt))
+
(defun calc-graph-fast (many)
(interactive "P")
(let ((calc-graph-no-auto-view t))
;; Check MS-Windows before X, in case they have
;; $DISPLAY set for some reason (e.g., Cygwin or
;; whatever)
- ((string= calc-gnuplot-name "pgnuplot")
- "windows")
+ ((string= calc-gnuplot-name "pgnuplot")
+ "windows")
+ ;; Versions of gnuplot that come without pgnuplot
+ ;; only work on MS-Windows with "qt" as the
+ ;; terminal, for some reason.
+ ((calc-graph-w32-p)
+ "qt")
((or (eq window-system 'x) (getenv "DISPLAY"))
"x11")
((>= calc-gnuplot-version 3)
(calc-graph-init)
(calc-graph-view-trail)
(calc-gnuplot-command cmd)
- (or (string= calc-gnuplot-name "pgnuplot")
+ (or (calc-graph-w32-p)
(progn
(accept-process-output)
(calc-graph-view-trail)))))
(defun calc-graph-kill (&optional no-view)
(interactive)
- (calc-graph-delete-temps)
(if (calc-gnuplot-alive)
(calc-wrapper
(or no-view (calc-graph-view-trail))
(sit-for 1)
(if (process-status calc-gnuplot-process)
(delete-process calc-gnuplot-process))
- (setq calc-gnuplot-process nil))))
+ (setq calc-gnuplot-process nil)))
+ (calc-graph-delete-temps))
(defun calc-graph-quit ()
(interactive)
(defun calc-gnuplot-command (&rest args)
(calc-graph-init)
(let ((cmd (concat (mapconcat 'identity args " ") "\n")))
- (or (string= calc-gnuplot-name "pgnuplot")
+ (or (calc-graph-w32-p)
(accept-process-output))
(with-current-buffer calc-gnuplot-buffer
(calc-gnuplot-check-for-errors)
(process-send-string calc-gnuplot-process cmd)
(if (get-buffer-window calc-gnuplot-buffer)
(calc-graph-view-trail))
- (or (string= calc-gnuplot-name "pgnuplot")
+ (or (calc-graph-w32-p)
(accept-process-output (and (not calc-graph-no-wait)
calc-gnuplot-process)))
(calc-gnuplot-check-for-errors)
(setq origin (point)))
(setq calc-graph-last-device nil)
(setq calc-graph-last-output nil)
- (if (string= calc-gnuplot-name "pgnuplot")
- (let ((version-str (shell-command-to-string "pgnuplot -V")))
+ (if (calc-graph-w32-p)
+ (let ((version-str
+ (shell-command-to-string (concat calc-gnuplot-name " -V"))))
(if (string-match "gnuplot \\([0-9]+\\)\\." version-str)
(setq calc-gnuplot-version (string-to-number
(substring version-str
(let ((args (append (and calc-gnuplot-display
(not (equal calc-gnuplot-display
(getenv "DISPLAY")))
- (not (string= calc-gnuplot-name "pgnuplot"))
+ (not (calc-graph-w32-p))
(list "-display"
calc-gnuplot-display))
(and calc-gnuplot-geometry
- (not (string= calc-gnuplot-name "pgnuplot"))
+ (not (calc-graph-w32-p))
(list "-geometry"
calc-gnuplot-geometry)))))
(setq calc-gnuplot-process
(error "Sorry, can't find \"%s\" on your system"
calc-gnuplot-name)))
(with-current-buffer calc-gnuplot-buffer
- (while (and (not (string= calc-gnuplot-name "pgnuplot"))
+ (while (and (not (calc-graph-w32-p))
(not (save-excursion
(goto-char origin)
(search-forward "gnuplot> " nil t)))
(accept-process-output calc-gnuplot-process))
(or (memq (process-status calc-gnuplot-process) '(run stop))
(error "Unable to start GNUPLOT process"))
- (if (not (string= calc-gnuplot-name "pgnuplot"))
+ (if (not (calc-graph-w32-p))
(if (save-excursion
(goto-char origin)
(re-search-forward