unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Oleh Krehel <oleh.krehel@gmail.com>
To: emacs-devel@gnu.org
Subject: prin1-to-string noescape parameter
Date: Fri, 31 Oct 2014 17:15:45 +0100	[thread overview]
Message-ID: <CAJ1SQWBK6Av2f2ZZ6qNLui0utHzShAoVRJuu28bZVC_nKw9efg@mail.gmail.com> (raw)

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	other threads:[~2014-10-31 16:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-31 16:15 Oleh Krehel [this message]
2014-10-31 19:11 ` prin1-to-string noescape parameter Andreas Schwab
2014-10-31 20:11   ` Oleh Krehel
2014-10-31 20:51     ` Andreas Schwab
2014-10-31 21:24       ` Oleh Krehel
2014-11-01  7:34         ` Andreas Schwab
2014-11-01  8:28           ` Oleh Krehel
2014-11-01 10:03             ` Andreas Schwab
2014-10-31 19:54 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJ1SQWBK6Av2f2ZZ6qNLui0utHzShAoVRJuu28bZVC_nKw9efg@mail.gmail.com \
    --to=oleh.krehel@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).