Subject: bug#56773: 29.0.50; (readablep UNREADABLE) causes strange things

From: Lars Ingebrigtsen <[email-masked]>
Date: Wed, 27 Jul 2022 11:30:13 +0200

Lars Ingebrigtsen <[email-masked]> writes:

> Yes -- look at the call sequence from prin1-to-string and down to where
> we're calling the function.  The buffer that was current when
> prin1-to-string was called is not available from print_vectorlike, as
> far as I can see.

That is -- there's two things that have to be fixed.  The first thing
(which I was talking about here) is that the current_buffer has to be
made available way down in print_vectorlike, so that we don't call the
callback from the " prin1" buffer, because that's really confusing.  I
think we can accomplish that by specbinding some variable in
PRINTPREPARE.

The other thing is that we have to ensure that the stuff in PRINTFINISH
is actually done when we have a non-local exit, and putting that stuff
in an unwind_protect should fix that.  I.e., PRINTPREPARE sets up the
unwind_protect, of course.

And when doing that, we might as well get rid of the macros altogether
and do this more traditionally via functions.

Does anybody see any obvious disadvantages to doing it this way?  I
guess it could potentially make calls to `prin1' (etc) slower, but I
don't know whether that'd be noticeable.