unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Stephen J. Turnbull" <stephen@xemacs.org>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: Vr Rm <vrrm00@gmail.com>,
	Emacs development discussions <emacs-devel@gnu.org>
Subject: Re: Raw strings (experimental patches inside)
Date: Sat, 11 Aug 2012 16:27:19 +0900	[thread overview]
Message-ID: <87boihsxbc.fsf@uwakimon.sk.tsukuba.ac.jp> (raw)
In-Reply-To: <jwvzk62d1qj.fsf-monnier+emacs@gnu.org>

Stefan Monnier writes:

 > > You still need to *double*-backslash-escape, backslash-escaping is
 > > insufficient.
 > 
 > If the special chars don't need to be backslash escaped, then you don't
 > need to double escape either, obviously.

Of course they need to be backslash-escaped, fairly frequently.  I
often search for things like '(foo' and '?\' in Lisp, '{' and '}' in
Python or C, '*' in ReST, etc, because I want to find something in a
particular syntactic context.  There's a reason why basic REs
backslashed some of the basic operators, it wasn't just an epidemic of
early-onset Alzheimer's at Bell Labs.  They were wrong to put weight
on that reason, of course, but they realized their mistake a lot
faster than we Emacs developers did. :-(

It's true that a saner regexp syntax would reduce the need, but only
rawstrings can help with stuff like the regexp needed to find an
end-of-row in LaTeX arrays: "\\\\\\\\".  Those of us with a bit of
astigmatism can't even be sure that's 8 backslashes without careful
counting.

 > I don't have rawstring phobia.  I just think it's a workaround which
 > makes Elisp's syntax more complex without fixing the real problem.

Off-by-one error!  The point is that there are *two* problems here.

I don't know if it's a good idea, but you could even fix both with one
syntax.  Ie, when you read a rawstring, the resulting string is
automatically given a "if-you-use-me-as-a-regex-use-pcre-syntax-please"
property.

 > Could it make the syntax slightly better?  Yes.  Would the difference
 > be significant?  I doubt it.

Works-for-me is not a good way to design an Emacs for other people.

BTW, I was -0.5 on rawstrings when they were introduced in XEmacs.  I
was wrong then, and I had better reasons (ie, Emacs compatibility) for
being negative.




  reply	other threads:[~2012-08-11  7:27 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-03  2:02 Raw strings (experimental patches inside) Aurélien Aptel
2012-08-03  9:45 ` Pascal J. Bourguignon
2012-08-03 17:45   ` Aurélien Aptel
2012-08-04 19:41     ` Pascal J. Bourguignon
2012-08-05  0:16       ` Aurélien Aptel
2012-08-05 11:36         ` Pascal J. Bourguignon
2012-08-05  7:13       ` Lars Brinkhoff
2012-08-06  1:55       ` Stefan Monnier
2012-08-06 10:55         ` Pascal J. Bourguignon
2012-08-06 16:16           ` Stefan Monnier
2012-08-06 16:40             ` Pascal J. Bourguignon
2012-08-03 22:43 ` Stefan Monnier
2012-08-04 14:38   ` Ivan Andrus
2012-08-04 23:47     ` Stefan Monnier
2012-08-05  0:13       ` Aurélien Aptel
2012-08-06 16:17         ` Stefan Monnier
2012-08-10  1:33       ` Vr Rm
2012-08-10  5:08         ` Stephen J. Turnbull
2012-08-10 15:13           ` Stefan Monnier
2012-08-10 17:28             ` Stephen J. Turnbull
2012-08-10 18:50               ` Stefan Monnier
2012-08-11  7:27                 ` Stephen J. Turnbull [this message]
2012-08-11 11:05                 ` Dmitri Paduchikh
2012-08-12  0:29                   ` Stephen J. Turnbull
2012-08-10 21:11           ` Vr Rm
2012-08-10 23:03             ` Davis Herring
2012-08-10 23:24               ` Learning Emacs regexp (was: Re: Raw strings (experimental patches inside)) chad
2012-08-11  7:39             ` Raw strings (experimental patches inside) Stephen J. Turnbull
  -- strict thread matches above, loose matches on Subject: below --
2012-08-10 22:33 Dmitry Gutov
2012-08-11  7:49 ` Stephen J. Turnbull
2012-08-11 17:05   ` Dmitry Gutov
2012-08-11 17:57     ` Andreas Schwab
2012-08-11 18:22       ` Dmitry Gutov
2012-08-12  0:23     ` Stephen J. Turnbull
2012-08-11 13:30 ` 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=87boihsxbc.fsf@uwakimon.sk.tsukuba.ac.jp \
    --to=stephen@xemacs.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    --cc=vrrm00@gmail.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).