diff options
| author | Eli Zaretskii | 2009-08-07 14:54:10 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2009-08-07 14:54:10 +0000 |
| commit | 8b0bcc2ecac58940cf73cf52680a8eff052ab41f (patch) | |
| tree | 48fc6a551d5865b4171918d73a30bf97b3ac7819 | |
| parent | 615cc5fba6e5f7dd6a24e8d41747ed53391880b6 (diff) | |
| download | emacs-8b0bcc2ecac58940cf73cf52680a8eff052ab41f.tar.gz emacs-8b0bcc2ecac58940cf73cf52680a8eff052ab41f.zip | |
(calc-graph-plot): Set calc-graph-last-device to "windows" when "pgnuplot"
is used.
(calc-graph-command, calc-gnuplot-command, calc-graph-init): Don't call
accept-process-output if "pgnuplot" is used.
(calc-graph-init): Don't send -display and -geometry to "pgnuplot". If
"pgnuplot" is used, glean gnuplot version by running "pgnuplot -V" with
shell-command-to-string.
| -rw-r--r-- | lisp/ChangeLog | 15 | ||||
| -rw-r--r-- | lisp/calc/calc-graph.el | 64 |
2 files changed, 58 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 308c3f086e8..d7ef410f837 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,6 +1,19 @@ | |||
| 1 | 2009-08-07 Eli Zaretskii <eliz@gnu.org> | 1 | 2009-08-07 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * Makefile.in (ELCFILES): org/org-export-latex.elc renames to | 3 | * calc/calc-graph.el (calc-graph-plot): Set calc-graph-last-device |
| 4 | to "windows" when "pgnuplot" is used. | ||
| 5 | (calc-graph-command, calc-gnuplot-command, calc-graph-init): Don't | ||
| 6 | call accept-process-output if "pgnuplot" is used. | ||
| 7 | (calc-graph-init): Don't send -display and -geometry to | ||
| 8 | "pgnuplot". If "pgnuplot" is used, glean gnuplot version by | ||
| 9 | running "pgnuplot -V" with shell-command-to-string. | ||
| 10 | |||
| 11 | * calc/calc.el (calc-gnuplot-name) [windows-nt]: Use "pgnuplot" as | ||
| 12 | the default. | ||
| 13 | |||
| 14 | 2009-08-07 Eli Zaretskii <eliz@gnu.org> | ||
| 15 | |||
| 16 | * Makefile.in (ELCFILES): org/org-export-latex.elc renamed to | ||
| 4 | org/org-latex.elc. | 17 | org/org-latex.elc. |
| 5 | 18 | ||
| 6 | 2009-08-07 Dan Nicolaescu <dann@ics.uci.edu> | 19 | 2009-08-07 Dan Nicolaescu <dann@ics.uci.edu> |
diff --git a/lisp/calc/calc-graph.el b/lisp/calc/calc-graph.el index 5e9470da5f3..cb50cf9ab26 100644 --- a/lisp/calc/calc-graph.el +++ b/lisp/calc/calc-graph.el | |||
| @@ -375,12 +375,19 @@ | |||
| 375 | (setq output (car (read-from-string output))) | 375 | (setq output (car (read-from-string output))) |
| 376 | (setq output calc-gnuplot-default-output))) | 376 | (setq output calc-gnuplot-default-output))) |
| 377 | (if (or (equal device "") (equal device "default")) | 377 | (if (or (equal device "") (equal device "default")) |
| 378 | (setq device (if printing | 378 | (setq device |
| 379 | "postscript" | 379 | (cond |
| 380 | (if (or (eq window-system 'x) (getenv "DISPLAY")) | 380 | (printing "postscript") |
| 381 | "x11" | 381 | ;; Check MS-Windows before X, in case they have |
| 382 | (if (>= calc-gnuplot-version 3) | 382 | ;; $DISPLAY set for some reason (e.g., Cygwin or |
| 383 | "dumb" "postscript"))))) | 383 | ;; whatever) |
| 384 | ((string= calc-gnuplot-name "pgnuplot") | ||
| 385 | "windows") | ||
| 386 | ((or (eq window-system 'x) (getenv "DISPLAY")) | ||
| 387 | "x11") | ||
| 388 | ((>= calc-gnuplot-version 3) | ||
| 389 | "dumb") | ||
| 390 | (t "postscript")))) | ||
| 384 | (if (equal device "dumb") | 391 | (if (equal device "dumb") |
| 385 | (setq device (format "dumb %d %d" | 392 | (setq device (format "dumb %d %d" |
| 386 | (1- (frame-width)) (1- (frame-height))))) | 393 | (1- (frame-width)) (1- (frame-height))))) |
| @@ -1324,8 +1331,10 @@ This \"dumb\" driver will be present in Gnuplot 3.0." | |||
| 1324 | (calc-graph-init) | 1331 | (calc-graph-init) |
| 1325 | (calc-graph-view-trail) | 1332 | (calc-graph-view-trail) |
| 1326 | (calc-gnuplot-command cmd) | 1333 | (calc-gnuplot-command cmd) |
| 1327 | (accept-process-output) | 1334 | (or (string= calc-gnuplot-name "pgnuplot") |
| 1328 | (calc-graph-view-trail))) | 1335 | (progn |
| 1336 | (accept-process-output) | ||
| 1337 | (calc-graph-view-trail))))) | ||
| 1329 | 1338 | ||
| 1330 | (defun calc-graph-kill (&optional no-view) | 1339 | (defun calc-graph-kill (&optional no-view) |
| 1331 | (interactive) | 1340 | (interactive) |
| @@ -1407,7 +1416,8 @@ This \"dumb\" driver will be present in Gnuplot 3.0." | |||
| 1407 | (defun calc-gnuplot-command (&rest args) | 1416 | (defun calc-gnuplot-command (&rest args) |
| 1408 | (calc-graph-init) | 1417 | (calc-graph-init) |
| 1409 | (let ((cmd (concat (mapconcat 'identity args " ") "\n"))) | 1418 | (let ((cmd (concat (mapconcat 'identity args " ") "\n"))) |
| 1410 | (accept-process-output) | 1419 | (or (string= calc-gnuplot-name "pgnuplot") |
| 1420 | (accept-process-output)) | ||
| 1411 | (save-excursion | 1421 | (save-excursion |
| 1412 | (set-buffer calc-gnuplot-buffer) | 1422 | (set-buffer calc-gnuplot-buffer) |
| 1413 | (calc-gnuplot-check-for-errors) | 1423 | (calc-gnuplot-check-for-errors) |
| @@ -1419,8 +1429,9 @@ This \"dumb\" driver will be present in Gnuplot 3.0." | |||
| 1419 | (process-send-string calc-gnuplot-process cmd) | 1429 | (process-send-string calc-gnuplot-process cmd) |
| 1420 | (if (get-buffer-window calc-gnuplot-buffer) | 1430 | (if (get-buffer-window calc-gnuplot-buffer) |
| 1421 | (calc-graph-view-trail)) | 1431 | (calc-graph-view-trail)) |
| 1422 | (accept-process-output (and (not calc-graph-no-wait) | 1432 | (or (string= calc-gnuplot-name "pgnuplot") |
| 1423 | calc-gnuplot-process)) | 1433 | (accept-process-output (and (not calc-graph-no-wait) |
| 1434 | calc-gnuplot-process))) | ||
| 1424 | (calc-gnuplot-check-for-errors) | 1435 | (calc-gnuplot-check-for-errors) |
| 1425 | (if (get-buffer-window calc-gnuplot-buffer) | 1436 | (if (get-buffer-window calc-gnuplot-buffer) |
| 1426 | (calc-graph-view-trail))))) | 1437 | (calc-graph-view-trail))))) |
| @@ -1448,13 +1459,23 @@ This \"dumb\" driver will be present in Gnuplot 3.0." | |||
| 1448 | (setq origin (point))) | 1459 | (setq origin (point))) |
| 1449 | (setq calc-graph-last-device nil) | 1460 | (setq calc-graph-last-device nil) |
| 1450 | (setq calc-graph-last-output nil) | 1461 | (setq calc-graph-last-output nil) |
| 1462 | (if (string= calc-gnuplot-name "pgnuplot") | ||
| 1463 | (let ((version-str (shell-command-to-string "pgnuplot -V"))) | ||
| 1464 | (if (string-match "gnuplot \\([0-9]+\\)\\." version-str) | ||
| 1465 | (setq calc-gnuplot-version (string-to-number | ||
| 1466 | (substring version-str | ||
| 1467 | (match-beginning 1) | ||
| 1468 | (match-end 1)))) | ||
| 1469 | (setq calc-gnuplot-version 1)))) | ||
| 1451 | (condition-case err | 1470 | (condition-case err |
| 1452 | (let ((args (append (and calc-gnuplot-display | 1471 | (let ((args (append (and calc-gnuplot-display |
| 1453 | (not (equal calc-gnuplot-display | 1472 | (not (equal calc-gnuplot-display |
| 1454 | (getenv "DISPLAY"))) | 1473 | (getenv "DISPLAY"))) |
| 1474 | (not (string= calc-gnuplot-name "pgnuplot")) | ||
| 1455 | (list "-display" | 1475 | (list "-display" |
| 1456 | calc-gnuplot-display)) | 1476 | calc-gnuplot-display)) |
| 1457 | (and calc-gnuplot-geometry | 1477 | (and calc-gnuplot-geometry |
| 1478 | (not (string= calc-gnuplot-name "pgnuplot")) | ||
| 1458 | (list "-geometry" | 1479 | (list "-geometry" |
| 1459 | calc-gnuplot-geometry))))) | 1480 | calc-gnuplot-geometry))))) |
| 1460 | (setq calc-gnuplot-process | 1481 | (setq calc-gnuplot-process |
| @@ -1469,21 +1490,24 @@ This \"dumb\" driver will be present in Gnuplot 3.0." | |||
| 1469 | calc-gnuplot-name))) | 1490 | calc-gnuplot-name))) |
| 1470 | (save-excursion | 1491 | (save-excursion |
| 1471 | (set-buffer calc-gnuplot-buffer) | 1492 | (set-buffer calc-gnuplot-buffer) |
| 1472 | (while (and (not (save-excursion | 1493 | (while (and (not (string= calc-gnuplot-name "pgnuplot")) |
| 1494 | (not (save-excursion | ||
| 1473 | (goto-char origin) | 1495 | (goto-char origin) |
| 1474 | (search-forward "gnuplot> " nil t))) | 1496 | (search-forward "gnuplot> " nil t))) |
| 1475 | (memq (process-status calc-gnuplot-process) '(run stop))) | 1497 | (memq (process-status calc-gnuplot-process) '(run stop))) |
| 1476 | (accept-process-output calc-gnuplot-process)) | 1498 | (accept-process-output calc-gnuplot-process)) |
| 1477 | (or (memq (process-status calc-gnuplot-process) '(run stop)) | 1499 | (or (memq (process-status calc-gnuplot-process) '(run stop)) |
| 1478 | (error "Unable to start GNUPLOT process")) | 1500 | (error "Unable to start GNUPLOT process")) |
| 1479 | (if (save-excursion | 1501 | (if (not (string= calc-gnuplot-name "pgnuplot")) |
| 1480 | (goto-char origin) | 1502 | (if (save-excursion |
| 1481 | (re-search-forward | 1503 | (goto-char origin) |
| 1482 | "G N U P L O T.*\n.*version \\([0-9]+\\)\\." nil t)) | 1504 | (re-search-forward |
| 1483 | (setq calc-gnuplot-version (string-to-number (buffer-substring | 1505 | "G N U P L O T.*\n.*version \\([0-9]+\\)\\." nil t)) |
| 1484 | (match-beginning 1) | 1506 | (setq calc-gnuplot-version |
| 1485 | (match-end 1)))) | 1507 | (string-to-number (buffer-substring |
| 1486 | (setq calc-gnuplot-version 1)) | 1508 | (match-beginning 1) |
| 1509 | (match-end 1)))) | ||
| 1510 | (setq calc-gnuplot-version 1))) | ||
| 1487 | (goto-char (point-max))))) | 1511 | (goto-char (point-max))))) |
| 1488 | (save-excursion | 1512 | (save-excursion |
| 1489 | (set-buffer calc-gnuplot-input) | 1513 | (set-buffer calc-gnuplot-input) |