wxMaxima-developers / wxmaxima

A gui for the computer algebra system Maxima built with wxWidgets
https://wxMaxima-developers.github.io/wxmaxima/
Other
461 stars 96 forks source link

There does not seem to be a function to_lisp() #1785

Open richardgobeli opened 1 year ago

richardgobeli commented 1 year ago

My program just hangs up at this point.

image

image

If you don't disable the prompt for lisp-quiet, can you let WxMaxima just ignore the text that comes back from lisp-quiet?

daute commented 1 year ago

There is no to_maxima(). One can switch to Lisp-mode with to_lisp() and return to the "Maxima-mode" using (to-maxima) (a function call in Lisp notation), e.g. - change to Lisp, add 4+4 (in Lisp notation), return to Maxima. Here a sample from command line Maxima.

(%i1) to_lisp();
Type (to-maxima) to restart, ($quit) to quit Maxima.

MAXIMA> (+ 4 4)
8
MAXIMA> (to-maxima)
Returning to Maxima
(%o1)                                true

But it seems not work in a current wxMaxima, you are right. And it seemed to work in older version (19.07.0, included in Ubuntu 20.04).

richardgobeli commented 1 year ago

This is because the lisp-quiet function turns off the prompt. The lisp-quiet function is called sometime during the printing of a cell. Until the lisp-quiet works to restore the prompt at the end, the other lisp and debug functions should always turn the prompt back on before they start in Maxima so they will end correctly.

richardgobeli commented 9 months ago

I got the to_lisp () function to work when I added the following lines of code at the start of to_lisp. The function is in the source file init-cl. lisp so I needed to make a dummy function like this. (defun $to_lis () (if (string= mread-prompt "") (setq mread-prompt lisp-quiet-suppressed-prompt)) ($to_lisp ))

However, the lisp-quiet function may still cause issues with follow-up statements in Wxmaxima.

richardgobeli commented 9 months ago

The lisp-quiet function needs to be replaced with a bit bucket in the WxMaxima program and just leave the prompt on. This would allow all other functions to work correctly.

gunterkoenigsmann commented 9 months ago

I still hope that one day the Maxima project will make that function work correctly: If we leave the prompt on the input and output label numbers will be a bit unpredictable.

richardgobeli commented 9 months ago

Couldn't you make it just ignore the return text and also ignore the changing of the cell number for the input and output cell labels? Wxmaxima knows when it sends a LISP command the should be quiet so it can ignore everything for that function when it comes back including changing the cell label numbers. I think this could be done all in the Wxmaxima program.

This would not work if the label count is done in Maxima, but I guess a flag could also be sent to Maxima to not change the cell number.

gunterkoenigsmann commented 9 months ago

If wxMaxima would display a different label number tha.n the one Maxima assigns to a label users who use the label numbers would complain that %i13 delivers something different to %i13 and that % returns not the last line bit the output from some lisp command.

...and Maxima has a flag that tells not to advance the label numbers and not to remember the current command's output. It is named ,:lisp-quiet and unfortunately is currently broken.