unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Visuwesh <visuweshm@gmail.com>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: Eli Zaretskii <eliz@gnu.org>, 72778@debbugs.gnu.org
Subject: bug#72778: 31.0.50; Calc: g f doesn't display gnuplot window after closing
Date: Mon, 26 Aug 2024 11:32:19 +0530	[thread overview]
Message-ID: <87bk1fx1n8.fsf@gmail.com> (raw)
In-Reply-To: <87cylxywu1.fsf@web.de> (Michael Heerdegen's message of "Sun, 25 Aug 2024 07:51:02 +0200")

[ஞாயிறு ஆகஸ்ட் 25, 2024] Michael Heerdegen wrote:

> Eli Zaretskii <eliz@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.





  reply	other threads:[~2024-08-26  6:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-24  5:49 bug#72778: 31.0.50; Calc: g f doesn't display gnuplot window after closing Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-24  6:25 ` Eli Zaretskii
2024-08-24  7:00 ` Visuwesh
2024-08-24  7:31   ` Eli Zaretskii
2024-08-25  5:51     ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-26  6:02       ` Visuwesh [this message]
2024-08-26 19:32 ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-28  9:01   ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-28 12:39     ` Eli Zaretskii
2024-08-31 10:00       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bk1fx1n8.fsf@gmail.com \
    --to=visuweshm@gmail.com \
    --cc=72778@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).