rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

Maxima does not work with WxMaxima so the the Debugger is usable. #318

Open rtoy opened 2 months ago

rtoy commented 2 months ago

Imported from SourceForge on 2024-07-02 16:27:35 Created by richardgobeli on 2022-12-24 18:00:54 Original: https://sourceforge.net/p/maxima/bugs/4063


Example type :help in WxMaima. The command never ends because the communication between Maxima and the front end WxMaxima is somehow not completing.

As reporrted inWxMaxima bug report #1705. https://github.com/wxMaxima-developers/wxmaxima/issues/1705 Also report in maxima discussion list from Gunter Königsman. https://sourceforge.net/p/maxima/mailman/message/37696010/

rtoy commented 2 months ago

Imported from SourceForge on 2024-07-02 16:27:36 Created by richardgobeli on 2022-12-31 21:24:58 Original: https://sourceforge.net/p/maxima/bugs/4063/#1452


This also does not work to run lisp code in WxMaxima by calling the following function to_lisp();

WxMaxima does not get back an indication for a lisp prompt just like in debug mode. So the the lisp call (to-maxima) would return to maxima coding. The attached file shows it works in command line mode, but not in Wxmaxima.

Attachments:

rtoy commented 2 months ago

Imported from SourceForge on 2024-07-02 16:27:39 Created by peterpall on 2022-12-31 21:51:15 Original: https://sourceforge.net/p/maxima/bugs/4063/#1452/96f9


For normal prompts wxMaxima sets prompt-prefix and prompt-suffix to "<prompt"> and "". Ideally I would also like to be able to replace any & inside the prompt text by a &, any < inside the prompt text by a < and am > inside the prompt text by an >, which would mean that there is no way to set outchar to something that breaks the prompt detection.

But Maxima currently seems to offer no real way to determine if this is an ordinary or a question prompt and there is no good way, currently, to detect lisp or debugger prompts

rtoy commented 2 months ago

Imported from SourceForge on 2024-07-02 16:27:41 Created by richardgobeli on 2023-01-02 23:56:07 Original: https://sourceforge.net/p/maxima/bugs/4063/#9832


@peterpall Gunter I think I found the issue in mdebug.lisp. A part of the file is below.

lisp-quiet saves the mread-prompt in lisp-quiet-suppressed-prompt before lisp-quiet is executed. It does not restore it afterwards.

It only gets restored after a lisp-eval function is called of the form in WxMaxima as :lisp ( atom $t); This is the only debugger function that works.

All of the other debugger functions the mread-prompt is nil, because after each input statement WxMaxima calls list-quiet which clears it again. There needs to be a bunch of statements like this added to restore it.

(if (string= *mread-prompt* "")
      (setq *mread-prompt* *lisp-quiet-suppressed-prompt*)) 

Or better yet, when list-quiet is done the statement to restore mread-prompt to be enetered as above.

# This here is part of file mdebug.lisp in src

(defmacro lisp-quiet (&rest l)
  (if (not (string= *mread-prompt* ""))
      (setq *lisp-quiet-suppressed-prompt* *mread-prompt*))
  (setq *mread-prompt* "")
  (eval (cons 'progn l))
  nil)

(def-break :lisp-quiet 'lisp-quiet 
  "Evaluate the lisp form without printing a prompt")

(def-break :lisp 'lisp-eval 
  "Evaluate the lisp form following on the line")

(defmacro lisp-eval (&rest l)
  (if (string= *mread-prompt* "")
      (setq *mread-prompt* *lisp-quiet-suppressed-prompt*))
rtoy commented 2 months ago

Imported from SourceForge on 2024-07-02 16:27:43 Created by richardgobeli on 2023-01-03 00:02:25 Original: https://sourceforge.net/p/maxima/bugs/4063/#46f1


I see this got changed in 2019 as follows;

Attachments:

rtoy commented 2 months ago

Imported from SourceForge on 2024-07-02 16:27:45 Created by richardgobeli on 2023-01-11 19:16:13 Original: https://sourceforge.net/p/maxima/bugs/4063/#3cb9


Would this patch restore the Prompt after the list-quiet was finished so that all other debug functions will work?

diff --git a/src/mdebug.lisp b/src/mdebug.lisp
index 5385547..e498cda 100644
--- a/src/mdebug.lisp
+++ b/src/mdebug.lisp
@@ -640,6 +640,9 @@
       (setq *lisp-quiet-suppressed-prompt* *mread-prompt*))
   (setq *mread-prompt* "")
   (eval (cons 'progn l))
+  (finish-output)  ; wait and finish lisp-quiet output
+  (if (string= *mread-prompt* "")   ; restore prompt
+      (setq *mread-prompt* *lisp-quiet-suppressed-prompt*))
   nil)

 (def-break :lisp-quiet 'lisp-quiet 

Attachments: