Re: ediprolog -- Emacs does Interactive Prolog



"Richard Szopa" <ryszard.szopa@xxxxxxxxx> writes:

For example, if I write in a buffer something like this:

?- reverse([1,2,3], X).
and press <f10>
it outputs
%@% X = [3, 2, 1]

and directly enters the debugger (as I understand, this isn't an
intended behavior).

That's indeed not intended -- F10 on

?- reverse([1,2,3], X).

gives:

?- reverse([1,2,3], X).
%@% X = [3, 2, 1]

You then interact as on a terminal. Pressing ";" gives:

?- reverse([1,2,3], X).
%@% X = [3, 2, 1] ;
%@% No more solutions.

Does this work for you? What did you do to enter debug mode?


example
?- reveraaaaaaaaaaaaaaaaaaaaaaaaaaase([1,2,3], X).
it says
%@% Error: Undefined procedure: reveraaaaaaaaaaaaaaaaaaaaaaaaaaase/2
gives the message `press h for help.', but now Emacs is hanged, at
least until I manually kill the Prolog process.

You can always get out of such hangs with Ctrl + g in Emacs. While a
restart of the Prolog process isn't necessary in this case (since SWI
is already on the toplevel again, see below), you can always terminate
the background process with Ctrl+0 F10 (numeric argument zero for F10)
and automatically get a new one with the next press of F10.

Reason for the hang: Such an error takes SWI back to the toplevel,
whereas ediprolog thinks the output is just the result of your query
and waits for key presses (like ";" and "a") that are then sent to SWI
and meaningless to it on the toplevel. I currently don't check for
"Error:" in query output since it's prone to false positives. If
anyone needs a more specialised version for teaching environments, I
will provide one.

and on some other line press <f10> two times, then emacs hangs, and
killing prolog doesn't help much. What is more, I figured out that

I could reproduce this and have made a change that fixes the problem
for me. Please try the latest version from

http://stud4.tuwien.ac.at/~e0225855/ediprolog/ediprolog.html

Thank you for your feedback, and best wishes!
Markus Triska

.