* Printing and reading special objects
@ 2017-03-13 1:36 Stefan Monnier
0 siblings, 0 replies; only message in thread
From: Stefan Monnier @ 2017-03-13 1:36 UTC (permalink / raw)
To: emacs-devel
I think we should introduce two new variables:
- print-readably-function: a variable holding the function to call to
print those objects which aren't usually printable in a way that's
`read`able (e.g. those objects normally printed as #<...>).
- read-special-function: function called when encountering an unknown
# thingy.
The second makes it possible to add a kind of reader-macro feature, but
the immediate intent would be to use those two variables via let-binding
rather than via globally setting them. Together they would make it possible
to take a data-structure holding things like markers, obarrays, and
windows, print it via `princ` and then read it back via `read` (and
providing ad-hoc ways to print&read those special objects). I think the
`print-readably-function` should be fairly easy. I haven't looked at
the potential implementation difficulty of `read-special-function`.
Any taker?
Stefan
PS: The print-readably-function would also be useful without
read-special-function in a few cases. E.g. it could be used in
savehist to burp when part of the history contains unreadable data
such as markers. And it could be used in the byte-compiler to
slightly simply the printing of the bytecode where we currently do
some of it by hand in order to be able to write the "#$" special
thingy since there's no object that prints as "#$".
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-03-13 1:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-13 1:36 Printing and reading special objects Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.