Once more about *general-display-prefix*



Hello *,

Some time ago, variables *prompt-prefix*, *prompt-suffix*, etc. were 
introduced into maxima sources to make interfacing with external programs 
easier and more robust. They are used by the TeXmacs interface.

By the way, are they used by other interfaces (wxmaxima, imaxima)? If so, 
how? If not, why?

The theory about how the maxima REPL should work is following. The user 
writes something at the maxima prompt, terminates it with ; or $, and 
presses enter. Maxima writes *general-display-prefix*, then some output 
(maybe empty), then *prompt-prefix*, then the prompt, then 
*prompt-suffix*, and then waits for more user input. We can make an 
analogy: suppose
*general-display-prefix* = [
*prompt-prefix*          = (
*prompt-suffix*          = )]
Then the brackets should be paired correctly:
[
(
)]

For the current discussion, a question like "Is a positive or negative?"
is considered as a prompt. Currently, maxima does not write 
*general-display-prefix* after such questions. This was reported as a bug 
1362658, and a patch to fix it was attached.

There is another (and more serious) issue: if the user writes several 
statements in a single line, separating them by ; or $, then 
*general-display-prefix* is written several times. Continuing our analogy, 
if the user writes, say,
x:1$ y:2$
then maxima output has unbalanced brackets:
[
[
(
)]
The TeXmacs interface hangs: it waits for one more ] which never arrives.

It seems that the function call which writes *general-display-prefix* in 
macsys.lisp is actually situated in a wrong place. I'd be grateful if 
anybody more familiar with maxima input-output functions could advice me 
about fixing this problem.

Best wishes,
Andrey