emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: `unreadablep'


From: Lars Ingebrigtsen
Subject: Re: `unreadablep'
Date: Wed, 15 Dec 2021 13:35:44 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Po Lu <luangruo@yahoo.com> writes:

> The idea is that `print-unreadable-function' is called _with_ the object
> and the printcharfun (and possibly some prin1 state, but I haven't
> thought of the details yet) when prin1 encounters an unreadable object.
>
> So if you want to error something when trying to print an unreadable
> object, you can just set that to a function that throws.

Right...

Skimming print_object and friends, it seems like the vast majority of
the unprintable objects are in print_vectorlike, so I guess such a
change could be made (pretty much?) locally to that function...

So I think doing it that way should be pretty easy to implement, and
it's certainly general enough to be used in both of the cases I
sketched.  But the logic would have to be such that if
`print-unreadable-function' returns some special value, then printing
continues as normally (to implement the "just tell me if what was
printed is readable" case).

And calling out to Lisp in this case may be slower than the other
solution sketched.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

[Prev in Thread] Current Thread [Next in Thread]