GNU bug report logs - #72778
31.0.50; Calc: g f doesn't display gnuplot window after closing

Previous Next

Package: emacs;

Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>

Date: Sat, 24 Aug 2024 05:51:02 UTC

Severity: normal

Found in version 31.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 72778 <at> debbugs.gnu.org (full text, mbox):

From: Visuwesh <visuweshm <at> gmail.com>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 72778 <at> debbugs.gnu.org
Subject: Re: bug#72778: 31.0.50; Calc: g f doesn't display gnuplot window
 after closing
Date: Mon, 26 Aug 2024 11:32:19 +0530
[ஞாயிறு ஆகஸ்ட் 25, 2024] Michael Heerdegen wrote:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>> IME, gnuplot is notorious in changing its non-interactive behavior
>> from time to time, which might break the assumptions that Calc makes.
>> Suggest to look in the gnuplot's change log to see if they made some
>> change in the recent years, maybe this will give some ideas.
>
> I'm too ignorant to know what to look for.
>
> Some more data points, though:
>
>  - In *Gnuplot Trail* I see that gnuplot receives the command and emits
>    a new prompt even when the command is ignored.
>
>  - Executing (calc-gnuplot-command "set term wxt") (be sure that it is
>    not ignored!) fixes the problem for me.  I guess we don't want to do
>    that.
>
>  - I can't reproduce the issue with a terminal emulator even when
>    changing the gnuplot terminal to x11 (this is what Emacs uses for its
>    gnuplot process).
>
> I don't know much about process communication, excuse me if this is all
> irrelevant.

I am ignorant about process communication but I was able to reliably
make gnuplot open the terminal window every time by sending an extra
newline before the plot command.  Try

    M-: (process-send-string (get-buffer-process (current-buffer)) "\nplot sin(x)\n") RET

in the *Gnuplot Trail* buffer.  If you kill the gnuplot terminal window,
and reeval the same sexp, it opens again.  A naïve fix employing this
method would be

diff --git a/lisp/calc/calc-graph.el b/lisp/calc/calc-graph.el
index fb817b1bc3d..7b1ebc9f603 100644
--- a/lisp/calc/calc-graph.el
+++ b/lisp/calc/calc-graph.el
@@ -1417,7 +1417,7 @@ calc-gnuplot-command
   "Send ARGS to Gnuplot.
 Returns nil if Gnuplot signaled an error."
   (calc-graph-init)
-  (let ((cmd (concat (mapconcat 'identity args " ") "\n")))
+  (let ((cmd (concat "\n" (mapconcat 'identity args " ") "\n")))
     (or (calc-graph-w32-p)
 	(accept-process-output))
     (with-current-buffer calc-gnuplot-buffer

But it would be better if someone can explain why we require this
newline before CMD too.




This bug report was last modified 321 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.