From: Lennart Borgman <lennart.borgman@gmail.com>
To: Drew Adams <drew.adams@oracle.com>
Cc: 6390@debbugs.gnu.org
Subject: bug#6390: Should not regexp-quote quote newline?
Date: Thu, 10 Jun 2010 17:34:46 +0200 [thread overview]
Message-ID: <AANLkTikv3or1QOUqr_gSLe7oCQS-IbheDXPIWz13CsvJ@mail.gmail.com> (raw)
In-Reply-To: <2312722CD01C4D5BAA9DF0A3DA9377DC@us.oracle.com>
On Thu, Jun 10, 2010 at 5:22 PM, Drew Adams <drew.adams@oracle.com> wrote:
>> (setq x (regexp-quote "a
>> b"))
>> (message "length x=%d" (length x))
>>
>> The length of x will be 3 because the string returned
>> by regexp-quote includes a newline.
>> Would it not be more practical if the result was "a\nb"?
>
> I, for one, do not understand you.
Yes, I saw that Andreas probably did not get either what I wanted to say.
I checked the length because looking at x is a bit frustrating because
of the translations between newline <-> \n that might occur.
> (setq y "a
> b")
> (setq x (regexp-quote y))
> (setq z "a\nb")
> (equal x y) = (equal x z) = t
> (length x) = (length z) = 3
>
> What are you trying to say?
That the regexp-quoted string includes the new line character instead
of the two chararcers \n.
The latter is more practical in many situations since this is a regexp.
> And what does it mean to "quote newline"?
Replacing newline char with \n.
You can of course do that yourself, but I really see no reason why
regexp-quote should not do it. (Yes, the regexp works just as well
with newline in it as the two chars \n in it.)
Perhaps people wants it this way, but then I would suggest that the
doc strings tells about the current behaviour.
Maybe there should be a function `string-quote' that does replacements
of newline => \n etc?
> Please try to explain clearly what the problem is that you see, or what you are
> trying to do that does not succeed as you expect.
>
>
next prev parent reply other threads:[~2010-06-10 15:34 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-10 14:42 bug#6390: Should not regexp-quote quote newline? Lennart Borgman
2010-06-10 15:01 ` Andreas Schwab
2010-06-10 15:02 ` Lennart Borgman
2010-06-10 15:34 ` Drew Adams
2010-06-10 16:08 ` Andreas Schwab
2010-06-10 16:11 ` Lennart Borgman
2010-06-10 16:22 ` Andreas Schwab
2010-06-10 16:46 ` Lennart Borgman
2010-06-10 17:03 ` Andreas Schwab
2010-06-10 18:07 ` Lennart Borgman
2010-06-10 23:11 ` Lennart Borgman
2010-06-11 0:44 ` Lennart Borgman
2010-06-10 15:22 ` Drew Adams
2010-06-10 15:34 ` Lennart Borgman [this message]
2010-06-10 16:28 ` Juanma Barranquero
2010-06-10 16:47 ` Lennart Borgman
2010-06-10 16:56 ` Andreas Schwab
2010-06-10 17:00 ` Lennart Borgman
2010-06-11 4:19 ` MON KEY
2010-06-11 4:43 ` Lennart Borgman
2010-06-11 20:09 ` MON KEY
2010-06-11 20:37 ` Lennart Borgman
2010-06-12 6:18 ` MON KEY
2010-06-12 13:28 ` Lennart Borgman
2010-06-14 3:00 ` MON KEY
2010-06-14 5:33 ` Lennart Borgman
2010-06-12 6:51 ` Kevin Rodgers
2010-06-12 13:37 ` Lennart Borgman
2011-07-09 5:30 ` Glenn Morris
2011-07-09 10:03 ` Lennart Borgman
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=AANLkTikv3or1QOUqr_gSLe7oCQS-IbheDXPIWz13CsvJ@mail.gmail.com \
--to=lennart.borgman@gmail.com \
--cc=6390@debbugs.gnu.org \
--cc=drew.adams@oracle.com \
/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).