Protect breakpoint persistence from print-* vars #792
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR comprises two commits:
Pitfall
The output of printing functions (including
prin1
and, by extension,format
with a%s
sequence) is affected by a set of output variables that both end-users and libraries can tweak.This is fine in the more common use of these functions to format messages, but the problem is that the same functions are also the most convenient way to serialise/persist data.
Serialisation should be robust to non-default values of
print-length
andprint-level
in particular, as setting these to small numbers can lead to accidental data loss (and in some cases unreadable output).For example, the following roundtrip returns
"(0 ...)"
instead of the expected"(0 1 2 3)"
:Starting in Emacs 29,
prin1
and co. gained a new optional argument precisely to protect against this problem. In the meantime, this PR ensures thatprint-length
andprint-level
are set to their default values during serialisation.