-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't send buffer to gnuplot under Windows #15
Comments
Which version of gnuplot-mode are you using, and how did you install it (e.g., from MELPA or elsewhere?) |
From: joddie <[email protected]mailto:[email protected]> Which version of gnuplot-mode are you using, and how did you install it (e.g., from MELPA or elsewhere?) — I've installed gnuplot 20121127.1316 using package-list-packages and selecting gnuplot. When I open a gnuplot script file, it announces itself as Gnuplot-mode 0.6.1 (gnuplot 3.7) Send region has the same problem – only the first line appears in the gnuplot window, and Emacs hangs until I press C-g Send line using C-v works in part – the line does appear after the prompt in the gnu plot window, but again Emacs then hangs with a spinning circle cursor until I press C-g. It looks like the problem might have something to do with not getting proper confirmation that the first line was sent properly. |
Hmm. I don't have access to a Windows machine right now to debug this, unfortunately. As far as I know gnuplot.el doesn't do anything special to check whether a line has been received. What do you get as a backtrace if you do |
Here's what I get when I try to send a few lines using C-c C-r: Debugger entered--Lisp error: (quit) |
From: Richard Stanton I've installed gnuplot 20121127.1316 using package-list-packages and selecting gnuplot. When I open a gnuplot script file, it announces itself as Gnuplot-mode 0.6.1 (gnuplot 3.7) That's odd all by itself. The version of gnuplot actually installed is 4.6. On my Mac, the gnuplot version is reported correctly. |
That is interesting. Gnuplot-mode tries to call gnuplot when first loaded to find the version information, and defaults to guessing version 3.7 if it can't do this. If you don't mind a bit more debugging, could you try inserting the following in a scratch buffer and evaluating it? It should pop up a buffer with Gnuplot's splash message.
There must be something funny going on with the way Emacs communicates with gnuplot, but I don't know what it could be. Maybe I should look at the other gnuplot mode and see how they do it... |
I get a blank buffer when I try what you suggest… I agree it’s something to do with the way Emacs talks to gnuplot, but I don‘t know what. I’ve tried both the pgnuplot.exe and gnuplot.exe executables that come with the Windows version of gnuplot 4.6, and neither works. From: joddie [mailto:[email protected]] That is interesting. Gnuplot-mode tries to call gnuplot when first loaded to find the version information, and defaults to guessing version 3.7 if it can't do this. If you don't mind a bit more debugging, could you try inserting the following in a scratch buffer and evaluating it? It should pop up a buffer with Gnuplot's splash message. (with-current-buffer (get-buffer-create "gnuplot test") (erase-buffer) (insert "show version") (call-process-region (point-min) (point-max) gnuplot-program t (current-buffer)) (pop-to-buffer (current-buffer))) There must be something funny going on with the way Emacs communicates with gnuplot, but I don't know what it could be. Maybe I should look at the other gnuplot mode and see how they do it... — |
Thanks for the bug report and for trying the suggestion. For now I'm not sure what the problem is, sorry. I'll try to debug a bit more when I have access to a Windows machine again (not until the new year, unfortunately). |
I had a glance at Mike McCourt's gnuplot-mode, and I see that it doesn't run gnuplot as an interactive process, but starts a new process from scratch each time you send it a file as input. So that probably explains why it doesn't suffer from this problem. If you don't mind running one more test, what happens when you evaluate the following in a scratch buffer? It should give you an Emacs window with an interactive gnuplot inside it. If that doesn't work, then I'm really not sure how to fix this.
One more question. What is the difference between |
No rush – I can always use my Mac. I’m very happy to help in any way with debugging/testing. From: joddie [mailto:[email protected]] Thanks for the bug report and for trying the suggestion. For now I'm not sure what the problem is, sorry. I'll try to debug a bit more when I have access to a Windows machine again (not until the new year, unfortunately). — |
If you don't mind running one more test, what happens when you evaluate the following in a scratch buffer? It should give you an Emacs window with an interactive gnuplot inside it. If that doesn't work, then I'm really not sure how to fix this. I tried this three times. The first two, the gnuplot shell buffer displayed the message Timeout: gnuplot is not ready Process gnuplot exited abnormally with code 1 The third time, the buffer displayed nothing at all. In each case, however, a (separate, GUI, non-Emacs) gnuplot window opened outside Emacs. After the third time, I tried typing in the gnuplot shell window. When I entered a line and typed return, the command was successfully executed by (and appeared in) one of the (non-Emacs) gnuplot windows, but besides my own typing, no text ever appeared in the gnuplot shell buffer. Is the code by any chance waiting for some sort of prompt to appear in the buffer? One more question. What is the difference between gnuplot.exe and pgnuplot.exe in current Windows distributions? I gather from the discussion at http://gnuplot.10905.n7.nabble.com/names-of-gnuplot-Win32-binaries-td11759.html that there are some differences in how they deal with the console, so this problem probably relates to that in some way. I'm not sure about this either. The experiment above was using pgnuplot.exe Using gnuplot.exe instead, although a gnuplot.exe process is visible in the task manager, nothing appears in the Emacs buffer (again), unlike pgnuplot, no separate Windows window appears, and again unlike pgnuplot, nothing at first (seemed to) happen when I typed "plot sin(x)". However, then I tried set term windows and this time it worked. So it appears that both pgnuplot.exe and gnuplot.exe could, in principle, be made to work, as long as you don't mind none of the output ever appearing in the Emacs buffer. |
This is an interesting topic. I ran into the same problem. I hope you can look at it soon. Regards, |
I have the same issue. The gnuplot shell opens and I can type in commands: e.g. plot sin(x). As soon as I hit enter emacs hangs and I can only recover by C-g. |
Btw. this is the call stack I get: Debugger entered--Lisp error: (quit) the # (smaller sign) process gnuplot (bigger sign) seems to me a bit strange, should this be a pid? |
I solved the problem, at least partially. By setting: |
That backtrace looks normal. Emacs subprocesses are identified with an arbitrary name and their printed representation looks like Unfortunately, I suspect this is due to how gnuplot on windows handles its input and output, not with Emacs or gnuplot-mode (the code snippet above relies only on the generic I vaguely remember some talk on the gnuplot mailing list about changing this behaviour so that Win32 gnuplot behaves more like its unix-y version, but I don't know if anything came of that. Alternatively, there is a simpler alternative gnuplot-mode to this one (linked elsewhere on github and also on MELPA) which doesn't rely on running gnuplot as a subprocess, so you could try that. Sorry, that's all I've got! |
The discussion here might be slightly relevant: http://gnuplot.10905.n7.nabble.com/pgnuplot-exe-flow-control-td11194.html Are there still three different executables, |
With gnuplot started from cmd: I get a gnuplot shell in the same command window, it is a "console application". However, Emacs does not work with gnuplot but works with pgnuplot. I managed to get rid of the blocking: The next thing I want to try is to get gnuplot work together with org-mode's html-output. |
Huh, I stand corrected. Thank you for investigating further. It's still not clear to me what happens if you start The discussion at http://www.gnu.org/software/emacs/windows/Sub_002dprocesses.html#Sub_002dprocesses might also be useful. A patch would be great if you get it working reliably! |
In the mean time I managed to run org-plot/gnuplot on a table and see the plot in a gnuplot window. I also managed to generate proper html output by following this description: http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-gnuplot.html I just tried to run gnuplot and pgnuplot in an Emacs shell, both hang in: (comint-send-input nil nil). Seems like different gnuplot executable would be required which sends something back to comint-send-input. This way an interactive gnuplot shell within Emacs would work. However, for my purpose the workaround described above is just enough. |
Hi, I realize this thread is over a year old, but as I am still fighting this problem... Harry79, did you get org-plot/gnuplot working with pgnuplot.exe? I made the same changes you mentioned above
And got so far as running org-plot/gnuplot on a buffer with a org-plot table, which will open a new GnuPlot window, but will not show any plot, only
Did you make any additional changes to get it working? Any hints would be much appreciated. Best regards, |
I have it working together with org-mode, have not tried to use another method of invoking it.
Howto use it with org-mode:
Move your cursor to the src block and press C-c C-c. Hope this helps. |
Thanks Harry! Now it seems to send the data to GnuPlot at least:
But it doesn't seem to send the script to GnuPlot. Could it be me using the MELPA version of gnuplot-mode, you seem to load it manually? |
As noted upthread, I think this has to do with how Gnuplot handles its interactive terminal input and output under windows. The simplest test is to evaluate the following, for some value of
That should create a bare-bones Comint buffer in Emacs, containing a running Gnuplot shell which will accept commands. If that works, it should be possible to get the rest of the mode working. The other |
@johanborg, you almost have it. I removed my change to gnuplot.el and have exactly the same behavior you reported. In (defun gnuplot-send-string-to-gnuplot (string text)... By the way I am using gnuplot-mode, version 0.7. |
Thanks a lot, now it works! I actually already made the change in gnuplot.el, but forgot i had it compiled, which took precedent. Recompiling fixed everything. :) Edit: Also fixed org-plot/gnuplut for other org tables. |
Following the instructions supplied I have also managed to get this to work (my problem was much like johanborg's). I'd like to thank all of you for your persistance in supplying a solution! This has bugged me for years and been a time-sink equally long. |
Gnuplot V5 no longer includes pgnuplot.exe. I am now back to C-g to end the attempted plot session with no output. Tried a straightforward sub with wgnuplot but that just opened the console and I could not have a plot returned to my org doc. Is there a workaround for this with the disappearance of pgnuplot? |
I don't normally do my gnuplotting on windows, but ... Does the |
Gnuplot 5.x works fine standalone on Windows 10-64b, its a great program. I am just try to create plots inline in Emacs 25.1. I have enabled it with org-babel and am following the method listed above. I tried using gnuplot as is to replace pgnuplot. That provides a message saying the plot is complete but Emacs does not respond until you C-g out and no plot is created. I substituted wgnuplot in place of pgnuplot and it opens a console window. I can run the script in that window but it does not return the plot to Emacs. I have to work in windows so linux is not an option. I posted the message to see if anyone had an updated advice/workarounds. Thanks for your reply, appreciated. (PS: I am not a programmer, just an end user using Emacs for research papers which is why I'd love to have gnuplot work inline on Emacs/Windows.). |
Emacs run gnuplot.exe as a sub process, But in that sub process CACHES the input and output, So the input or output weren't reach at the final destination. I don't think that can be solved. :( |
Why not? |
Windows is not supported for now. please ref #33 |
I just installed gnuplot 4.6 in Windows Vista, and then installed gnuplot-mode. Unfortunately, when I try to send the buffer to gnuplot, only the first line of the buffer seems to get sent (looking at the gnuplot window). I'm using pgnuplot.exe as my executable, but I've also tried gnuplot.exe and this doesn't help.
Note: If I use the latest version of gnuplot-mode.el by Mike McCourt, with the same gnuplot setup, it sends the whole buffer to gnuplot just fine, so the gnuplot setup does work (in theory).
Thanks.
The text was updated successfully, but these errors were encountered: