diff options
author | Glenn Morris <rgm@gnu.org> | 2019-01-18 07:50:47 -0800 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2019-01-18 07:50:47 -0800 |
commit | 957090b79531fbd7729e5d28c3496b9114c1f543 (patch) | |
tree | a389b4547ac7861bb7f5bc9579ac13f217fdbfb9 /lisp/calc | |
parent | 5e3b0f5239027a413775d375f04376a3c97d0bf9 (diff) | |
parent | b6d78a0d8019a92f94ce3fc41ddb0886f8b70d85 (diff) | |
download | emacs-957090b79531fbd7729e5d28c3496b9114c1f543.tar.gz |
Merge from origin/emacs-26
b6d78a0 (origin/emacs-26) Fix a typo in ELisp manual
c9f6f86 Prevent redrawing if frame is garbaged
00ba226 Attempt to fix hangs on MS-Windows due to C-g
b26d637 Fix Calc graph output on MS-Windows
03818b0 Fix a minor mistake in ELisp manual
6ac5985 ; Fix some trivial doc typos
21b9026 * etc/tutorials/TUTORIAL: Fix typo (bug#34049)
d223727 Fix UI of Buffer-menu
0f71655 Reinitialize ispell-really-enchant when changing the speller
9845044 Speed up loading css-mode
Diffstat (limited to 'lisp/calc')
-rw-r--r-- | lisp/calc/calc-graph.el | 35 | ||||
-rw-r--r-- | lisp/calc/calc.el | 11 |
2 files changed, 31 insertions, 15 deletions
diff --git a/lisp/calc/calc-graph.el b/lisp/calc/calc-graph.el index ff7f12d9faf..317f403ead6 100644 --- a/lisp/calc/calc-graph.el +++ b/lisp/calc/calc-graph.el @@ -65,6 +65,9 @@ (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)) @@ -376,8 +379,13 @@ ;; 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) @@ -1321,14 +1329,13 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (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)) @@ -1337,7 +1344,8 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (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) @@ -1404,7 +1412,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (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) @@ -1416,7 +1424,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (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) @@ -1445,8 +1453,9 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (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 @@ -1457,11 +1466,11 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (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 @@ -1475,7 +1484,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (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))) @@ -1483,7 +1492,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (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 diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index c1f23cc94e4..7390ea350e1 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -395,10 +395,17 @@ This is not required to be present for user-written mode annotations." (string :tag "Closing annotation delimiter")))) (defcustom calc-gnuplot-name - (if (eq system-type 'windows-nt) "pgnuplot" "gnuplot") + (if (and (eq system-type 'windows-nt) + ;; Gnuplot v4.x on MS-Windows came with a special + ;; pipe-enabled gnuplot executable for batch-mode + ;; execution; newer versions allow using gnuplot.exe. + (executable-find "pgnuplot")) + "pgnuplot" + "gnuplot") "Name of GNUPLOT program, for calc-graph features." :group 'calc - :type '(string)) + :type '(string) + :version "26.2") (defcustom calc-gnuplot-plot-command nil |