Temporarily turn off portray but only in the graphical debugger?

I’m using: SWI-Prolog version 8.1.9.

Is there a way to toggle on and off the graphical debugger’s use of the portray/1 call during a debugging session? I love that feature in most cases. But some of my portray implementations split the display of a list into showing one element in a list per line. As you can imagine, this makes the Variable unusable if a variable is of that portray class and the contained list is of any significant length, because every variable listed after the portrayed list variable is pushed many lines down in the Variable pane.


It’s probably way too hard to implement, but a future version of portray that let you specify what output contexts should use portray would be amazing. I’m guessing it’s too hard because you’d have to do some serious modifications to print/1 itself, but I’d figured I’d put the idea out there.

For example:

% portray/2
portray(term_something(SomeVar), [debugger, console, file]) :-
...

Which would tell the compiler to use the portray call in the debugger, the console window, and when outputting to a file.

Please do not scream. The GUI tracer writes answers using write_term/3, getting the options from the Prolog flag answer_write_options. There might be some value in providing either the context or intend, in that case most likely as a global variable or Prolog flag. There are quite a few different contexts though as well as quite a few possible intends. I mostly leave portray alone and use print_term/2 or portray_clause/1,2 for details.

2 Likes

Fixed. Sorry Jan, that happened due to some weird fluke in this forum’s page rendering engine. If you look at the edit logs, the only thing I did to get rid of that large, bold font was to add a line feed before the triple dash line I used to create a horizontal line after the offending paragraph.

Yes, good old markdown. If you have a “line” (which is sometimes a paragraph over multiple lines, but without double hard line breaks) and you underline it, it becomes a header.

The purpose of lorem ipsum is to create a natural looking
block of text (sentence, paragraph, page, etc.) that doesn't
distract from the layout. A practice not without controversy,
laying out pages with meaningless filler text can be very
useful when the focus is meant to be on design, not content.
---
Text immediately after is the first paragraph of this section.

… and this looks like that:

The purpose of lorem ipsum is to create a natural looking
block of text (sentence, paragraph, page, etc.) that doesn’t
distract from the layout. A practice not without controversy,
laying out pages with meaningless filler text can be very
useful when the focus is meant to be on design, not content.

Text immediately after is the first paragraph of this section.

1 Like