With a elisp piece of code:
(message "%s" (read-from-string "(setq a \"a string here\" )"))
I got result:
((setq a a string here) . 25)
But I want result is:
((setq a "a string here") . xxx )
I can't find in document info to do this
%s means print a string argument. Actually, prints any object, with ‘princ’.
%S means print any object as an s-expression (using ‘prin1’).
Hence:
(message "%S" (read-from-string "(setq a \"a string here\" )"))
=> "((setq a \"a string here\") . 25)"
I.e. The read-from-string
return value was fine already; it was just the way you were printing it; princ
vs prin1
.
25
orxxx
as cdr. And none of the code you said you tried does that. Please clarify the questions.