Skip to content

Commit 32c280e

Browse files
authored
Add a gnuplot-program-args variable. (#65)
This variable can be used to pass additional flags to the gnuplot-program invocation when starting a gnuplot process. Document issues when using gnuplot and Windows
1 parent 62117fe commit 32c280e

File tree

2 files changed

+42
-24
lines changed

2 files changed

+42
-24
lines changed

README.org

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,37 @@ A basic gnuplot configuration can be found below.
6868

6969
A reference card for gnuplot-mode can be compiled using the =gpelcard.tex= file included in this package.
7070

71+
*** Usage on Windows
72+
73+
Multiple users have reported issues when trying to work with
74+
=gnuplot.el= on Windows. Most notably, the gnuplot process hangs after
75+
sending a first line of input (this is a common Emacs issue on
76+
Windows, see [[https://www.gnu.org/software/emacs/manual/html_mono/efaq-w32.html#Sub_002dprocesses][here]]).
77+
78+
A partial workaround was to use =pgnuplot.exe= as the
79+
=gnuplot-program=. However, =pgnuplot.exe= is not included with
80+
gnuplot since version 5.0.
81+
82+
You currently have two solutions:
83+
84+
1. Experiment using the =gnuplot-program= and =gnuplot-program-args=
85+
variables. For instance, setting
86+
87+
#+begin_src emacs-lisp
88+
(setq gnuplot-program "/path/to/cmdproxy.exe")
89+
(setq gnuplot-program-args "/C /path/to/gnuplot.exe")
90+
#+end_src
91+
92+
has been reported to work (see [[https://github.com/emacsorphanage/gnuplot/pull/33/files][here]] for a reference).
93+
94+
2. Use the simpler [[https://github.com/mkmcc/gnuplot-mode][gnuplot-mode]] package that sends the entire buffer
95+
to gnuplot. Since no =comint= is involved, it should function
96+
correctly, but you lose most features of the =gnuplot.el= package.
97+
We would like to implement a send-buffer without comint as well
98+
eventually.
99+
100+
More information on =gnuplot.el= and WIndows can be found on these threads: [[https://github.com/emacsorphanage/gnuplot/issues/15][1]], [[https://github.com/emacsorphanage/gnuplot/pull/33][2]]
101+
71102
** New features for gnuplot-mode 0.7
72103
Version 0.7 of gnuplot-mode is designed for use with gnuplot
73104
version 4.4 and up. It will also mostly work fine with older
@@ -148,25 +179,3 @@ A basic gnuplot configuration can be found below.
148179

149180
Gnuplot-mode is already on http://melpa.milkbox.net, but it would
150181
be good to get it into the other repositories too.
151-
152-
2. Using gnuplot-mode on windows is problematic. John Handy says:
153-
154-
You probably get nagged quite a bit about this. Some have been running into
155-
issues with gnuplot-mode and Windows and I'm wondering if you have any
156-
comments. I use it just fine on Linux, but it seems that Windows users are
157-
not able to send data to gnuplot successfully.
158-
159-
Org-mode also uses gnuplot-mode and this org-plot and org-mode babel+gnuplot
160-
are not working correctly on Windows.
161-
162-
Any thoughts? I'm hoping to include any results in the Org-mode wiki for
163-
gnuplot use:
164-
[[http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-gnuplot.php]]
165-
166-
If you're interested, here are some of the threads I'm referring to:
167-
[[http://newsgroups.derkeiler.com/Archive/Comp/comp.emacs/2007-07/msg00159.html]]
168-
[[http://www.mail-archive.com/[email protected]/msg14544.html ]]
169-
[[http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/53489131c79f62b3]]
170-
171-
If you'd like to see my summary of the issues to the org-mode mailing list,
172-
it's here: [[http://thread.gmane.org/gmane.emacs.orgmode/30235]]

gnuplot.el

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,12 @@ useful for functions included in `gnuplot-after-plot-hook'.")
475475
"The name of the gnuplot executable."
476476
:group 'gnuplot
477477
:type 'string)
478+
479+
(defcustom gnuplot-program-args nil
480+
"Whitespace-separated flags to pass to the gnuplot executable."
481+
:group 'gnuplot
482+
:type 'string)
483+
478484
(defvar gnuplot-program-version nil
479485
"Version number of gnuplot.
480486
This is using `gnuplot-fetch-version-number'.")
@@ -1817,8 +1823,11 @@ buffer."
18171823
(unless (and gnuplot-process (eq (process-status gnuplot-process) 'run)
18181824
gnuplot-buffer (buffer-live-p gnuplot-buffer))
18191825
(message "Starting gnuplot plotting program...")
1820-
(setq gnuplot-buffer (make-comint gnuplot-process-name gnuplot-program)
1821-
gnuplot-process (get-buffer-process gnuplot-buffer))
1826+
(let ((gnuplot-cmd (list 'make-comint gnuplot-process-name gnuplot-program)))
1827+
(when gnuplot-program-args
1828+
(setq gnuplot-cmd (append gnuplot-cmd '(nil) (split-string gnuplot-program-args))))
1829+
(setq gnuplot-buffer (eval gnuplot-cmd)
1830+
gnuplot-process (get-buffer-process gnuplot-buffer)))
18221831
(set-process-query-on-exit-flag gnuplot-process nil)
18231832
(with-current-buffer gnuplot-buffer
18241833
(gnuplot-comint-mode)

0 commit comments

Comments
 (0)