From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Andrus Newsgroups: gmane.emacs.devel Subject: Re: Raw strings (experimental patches inside) Date: Sat, 4 Aug 2012 16:38:02 +0200 Message-ID: <651F6603-F798-4381-929E-7D86A28DBC4D@gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1344091096 19143 80.91.229.3 (4 Aug 2012 14:38:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 4 Aug 2012 14:38:16 +0000 (UTC) Cc: =?iso-8859-1?Q?Aur=E9lien_Aptel?= , Emacs development discussions To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 04 16:38:15 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SxfUa-0003RD-KY for ged-emacs-devel@m.gmane.org; Sat, 04 Aug 2012 16:38:12 +0200 Original-Received: from localhost ([::1]:49516 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxfUa-0008Bb-0r for ged-emacs-devel@m.gmane.org; Sat, 04 Aug 2012 10:38:12 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxfUW-0008B0-JC for emacs-devel@gnu.org; Sat, 04 Aug 2012 10:38:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SxfUU-0000XO-Ca for emacs-devel@gnu.org; Sat, 04 Aug 2012 10:38:08 -0400 Original-Received: from mail-wi0-f171.google.com ([209.85.212.171]:38199) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxfUU-0000XB-4p for emacs-devel@gnu.org; Sat, 04 Aug 2012 10:38:06 -0400 Original-Received: by wibhq4 with SMTP id hq4so294943wib.12 for ; Sat, 04 Aug 2012 07:38:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; bh=BsKehCPXWVAtzAYpj3yatEpdgqpxXKaM4JKgcaC/Fj8=; b=G4LWrCnFSwydeMtMDJ8O8YmsKq+2kYLiNBLpz9r76bTwHVXqRm4s+wSj9rjXuI4y89 VexogBKeFkM8iUZVUW3gYJeEztczH9bpqPs00pCnlxToWc6MTLdwCpNItZsgS3m5CmAa WGwLGfC5gSBOuvIYcjlQythSXCWXoekrkqVSky2s6igJwKLglCzmBt/09A6oPcPTvkg5 hEf0Xm+lFqwSiWEBXXqXraujn5WwsOHqnUdAdR09GEu+BQcwlTqoqsrStI4POI08QLGU A0WuKtLuGf0hSdjnzY1q8nK/dYKCsIhgER3q8HLT/T/JI7yDcfX+XGiTx/YCgV6z47MD TDsA== Original-Received: by 10.216.147.199 with SMTP id t49mr2598788wej.54.1344091084930; Sat, 04 Aug 2012 07:38:04 -0700 (PDT) Original-Received: from [10.0.2.25] (catv-80-99-177-93.catv.broadband.hu. [80.99.177.93]) by mx.google.com with ESMTPS id ef5sm5564982wib.3.2012.08.04.07.38.03 (version=SSLv3 cipher=OTHER); Sat, 04 Aug 2012 07:38:03 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.1084) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.212.171 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:152172 Archived-At: 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. >=20 > 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. >=20 > 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). >=20 > 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. =20 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=