-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix PrintFormattingStatus
and SetPrintFormattingStatus
for the standard output (i.e., when the first argument is "*stdout*"
and add a variant that deals with the current output (whatever that may be), reachable by using "*current*"
as first argument
#4555
Fix PrintFormattingStatus
and SetPrintFormattingStatus
for the standard output (i.e., when the first argument is "*stdout*"
and add a variant that deals with the current output (whatever that may be), reachable by using "*current*"
as first argument
#4555
Conversation
914a221
to
8dc10c4
Compare
Thanks a lot for pushing this! I just tried it and now |
I am not sure what makes you think that, could you elaborate? Ohh, I see: any new stdout will still use a fixed default value. So we also need to store the value somewhere (maybe reintroduce BTW, so far all other
Ah right, my bad, I was confused about the content of your issue. I'd like to leave it open for now. |
Exactly! A specific example/use case is: I want to disable the print formatting for all stdouts by putting
I don't understand this statement. Consider the following code:
The problem with my issue is that the "observed behavior" is actually correct :D Should I rename it to "Feature Request: Allow to disable line wrapping but keep indentation when printing functions"? |
The meaning of "open" I had in mind is: active on GAP's stack of output streams. Which it is not: only I'll fix this PR to make the formatting status for stdout persistent. Now I wonder if it should also affect errout; or if perhaps errout should have a separate persistent state, and |
Ah, thanks for the explanation! Yes, I see no application where this would matter (for me).
I don't use |
Break loops use errout |
Ah, sorry, I should have guessed that. One reason why I want to disable the line wrapping is to make GAP not break and insert backspaces in filenames in stack traces, which is of course highly relevant in break loops. So with that new piece of information I think having the possibility to set the line wrapping of |
if str = "*stdout*" then | ||
return PRINT_FORMATTING_STDOUT(); | ||
elif str = "*current*" then | ||
return PRINT_FORMATTING_CURRENT(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we were discussing also handling *errout*
, perhaps there should be a single pair of kernel function (SET_)PRINT_FORMATTING_STATUS(name, ...)
which handles *stdout*
/*errout*
/*current*
plus future additions?
Ah well, I guess it's not really important whether we do it one way or another shrug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good, there are some small typos I've referenced, but nothing serious.
Here are a number of comments:
|
8dc10c4
to
f056364
Compare
@frankluebeck some replies re 1: understood; note that this PR does not change how we treat re 3: how about re 6: then we agree re 7: maybe? I am fine either way (I rarely use GAP with stdout different from errout) re 8: again: maybe? we are setting the rules here. I wondered about it, too, but decided that I should keep the changes to a minimum; in that spirit, I'd prefer if such a change to re 9: |
SetPrintFormattingStatus
and PrintFormattingStatus
for *stdout*
, and add a variant for the "current output"
55f40f7
to
e34c530
Compare
I've added I'll add support for setting the print formatting status for As such, I'd like to merge this as soon as CI passes; we can make further tweaks later. |
re re 1: Yes my "side remark" was concerning PR #4540. re re 3: re re 7 and 8: Agreed, this can be done in a different PR. |
re re re 3: agree, renamed to |
- add PRINT_FORMATTING_STDOUT to query the current state - use that to remove GAPInfo.FormattingStatusStdout (this way we only track this piece of state once, in the kernel; tracking something twice always carries the risk of getting out of sync) - add a test to check that all of these work correctly
This is useful for modifying the formatting status in test files Also useful for code that wants to print to whatever the current output is without formatting, but which does not control what the current output is (e.g. methods for `Print`).
`PrintWithoutFormatting` is a new helper function which calls `(Set)PrintFormattingStatus("*current*")` suitably to temporarily modify the formatting status for the currently active output stream. This requires adjusting one test for `Info`, which printed a notice about `InfoGlobal` which was in turn caused by a call to `IsBoundGlobal` removed by this patch.
e34c530
to
4a326aa
Compare
SetPrintFormattingStatus
and PrintFormattingStatus
for *stdout*
, and add a variant for the "current output"PrintFormattingStatus
and SetPrintFormattingStatus
for the standard output (i.e., when the first argument is "*stdout*"
and add a variant that deals with the current output (whatever that may be), reachable by using "*current*"
as first argument
Extracted from PR #4540 -- these are the hopefully unproblematic bits.
Fixes issue #4486(UPDATE: no it doesn't) (CC @zickgraf)Description
Text for release notes
Fix
PrintFormattingStatus
andSetPrintFormattingStatus
for the standard output (i.e., when the first argument is"*stdout*"
and add a variant that deals with the current output (whatever that may be), reachable by using"*current*"
as first argument(End of text for release notes)