I'm writing a lispy documentation engine with elisp and to make things easier, I'm trying to modify the following behavior
(prin1-to-string '(cons 'a 'b))
;; => "(cons (quote a) (quote b))"
to be
(prin1-to-string '(cons 'a 'b))
;; => "(cons 'a 'b)"
Is it possible to instruct prin1-to-string
to reinstate reader macros like this? Reading through the C sources, I don't think it's possible since by the time the object has been read, we've already used the reader-macro to turn 'a
into (quote a)
and that '
is lost forever. Is my only hope regex-replace?