emacs-devel
[Top][All Lists]
Advanced

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

prin1-to-string noescape parameter


From: Oleh Krehel
Subject: prin1-to-string noescape parameter
Date: Fri, 31 Oct 2014 17:15:45 +0100

Hi all,

I'm trying to write some code that formats/restructures Elisp source
files (a la Paredit).  But instead of using text manipulation,
I want to read the object in, manipulate it and print it
out.

One issue that I'm facing is:

    (prin1-to-string (read "(foo.bar baz?)"))
    => "(foo\\.bar baz\\?)"

I tried to overcome this with:

    (prin1-to-string (read "(foo.bar baz?)") t)
    => "(foo.bar baz?)"

But another problem resurfaces instead:

    (prin1-to-string (read "(foo \"bar\")") t)
    => "(foo bar)"

Even worse:

     (prin1-to-string (read "(foo \";bar\")") t)
     => "(foo ;bar)"

I think a fix to the issue would be to split the `escapeflag'
parameter of the `print_object' C function into two parts. Currently a
single bool flag decides if to escape strings or not, and if to escape
certain characters or not.

Any other suggestions to overcome this issue are welcome as well, so
far I've tried setting `print-quoted', `print-escape-multibyte', and
`print-escape-nonascii'.

regards,
Oleh



reply via email to

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