unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ivan Andrus <darthandrus@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: "Aurélien Aptel" <aurelien.aptel+emacs@gmail.com>,
	"Emacs development discussions" <emacs-devel@gnu.org>
Subject: Re: Raw strings (experimental patches inside)
Date: Sat, 4 Aug 2012 16:38:02 +0200	[thread overview]
Message-ID: <651F6603-F798-4381-929E-7D86A28DBC4D@gmail.com> (raw)
In-Reply-To: <jwv628z1u35.fsf-monnier+emacs@gnu.org>

On Aug 4, 2012, at 12:43 AM, Stefan Monnier wrote:

>> When I type a regex I'm always annoyed by the amount of escaping
>> I have to do.  I've always wished Emacs Lisp had raw strings
>> ie. a syntax to type litteral text without interpretation.
> 
> AFAIK, the only real use-case is indeed regexp, and for them a better
> solution would be to not escape the parentheses at all.

That doesn't handle the horror that is searching for backslashes...

>> I've made 2 patch for the reader (src/lread.c). There are proofs of
>> concepts, they should work on correct input but don't expect much.
> 
> Adapting the reader is only one part, since you also need to adapt the
> elisp-mode syntax-tables accordingly (and check that the edebug reader
> doesn't need matching changes).
> 
> As mentioned above, I'm not too excited by the idea of raw strings and
> would prefer solving the underlying root cause of dissatisfaction.
> Actually, we already have such a thing with `rx', but admittedly,
> a strings representation of regexps tends to be more concise, so maybe
> we also need some other trick like maybe a (re-escape "(?:foo)") which
> would return "\\(?:foo\\)".

It would also be nice to have a function which takes a string representation and converts it to an `rx' representation, which I couldn't find in rx when I looked.  I would like to convert some old libraries to use rx, but I'd rather not have to retype them all with the possibility of making mistakes etc.  

I think pcre2el [1] has such a thing, though I haven't tried it yet.  Is that on your radar for things to potentially include in Emacs?

-Ivan

[1] https://github.com/joddie/pcre2el


  reply	other threads:[~2012-08-04 14:38 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 [this message]
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
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=651F6603-F798-4381-929E-7D86A28DBC4D@gmail.com \
    --to=darthandrus@gmail.com \
    --cc=aurelien.aptel+emacs@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).