Just found out that debug/3 does not “comment” (or rather, “prepend with %”) not all lines it prints, only the first. I understand that one would generally only print one line (until one wants to print something more complex, that is, like a nicely formatted term).
?- debug(toplevel).
?- debug(toplevel,"This is monoline: ~q",[alpha]).
% This is monoline: alpha
true.
vs.
?- debug(toplevel).
?- debug(toplevel,"This is multiline: ~q\n~q\n~q",[alpha,bravo,charlie]).
% This is multiline: alpha
bravo
charlie
true.
One might expect:
?- debug(toplevel).
?- debug(toplevel,"This is multiline: ~q\n~q\n~q",[alpha,bravo,charlie]).
% This is multiline: alpha
% bravo
% charlie
true.
Probably an issue for the SWIPL bugzilla (is there one)?