From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.devel Subject: Re: rx.el sexp regexp syntax Date: Fri, 25 May 2018 11:01:50 -0700 Message-ID: <87r2lzd375.fsf@ericabrahamsen.net> References: <87h8mw3yoc.fsf@gmail.com> <20180525155126.GA4096@ACM> <87lgc7hebk.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1527271381 22279 195.159.176.226 (25 May 2018 18:03:01 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 25 May 2018 18:03:01 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 25 20:02:57 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fMH3I-0005hh-Gz for ged-emacs-devel@m.gmane.org; Fri, 25 May 2018 20:02:56 +0200 Original-Received: from localhost ([::1]:46245 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fMH5P-0003WU-PH for ged-emacs-devel@m.gmane.org; Fri, 25 May 2018 14:05:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46742) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fMH5G-0003WE-LR for emacs-devel@gnu.org; Fri, 25 May 2018 14:04:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fMH5D-0000qT-HW for emacs-devel@gnu.org; Fri, 25 May 2018 14:04:58 -0400 Original-Received: from [195.159.176.226] (port=33024 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fMH5D-0000q0-9T for emacs-devel@gnu.org; Fri, 25 May 2018 14:04:55 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fMH2z-0005Hi-5F for emacs-devel@gnu.org; Fri, 25 May 2018 20:02:37 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 31 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:BBClIpRJBuZPKDGr+iIgwztdgLc= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:225719 Archived-At: Pierre Neidhardt writes: > Alan Mackenzie writes: > >>> rx.el is one of the best concepts I've discovered in a long time. >>> It's another instance of "Don't come up with a new (mini)language when >>> Lisp can do better": it's easier to learn, more flexible, easier to >>> write, much easier to read and as a consequence much more maintainable. >> >> Much easier than what? Than the putative mini-language that doesn't get >> written? > > I meant that in my opinion rx is easier to write than regexps. That it > is not popular is the root of the question here. Slightly off-topic: I wouldn't ever use rx unless I was writing a really brutal regexp, but what I *would* use all day long would be a macro that un-escaped backslashes for me. Ideally: (string-match (rx-unescape "turn (left|right)") "turn right") => 0 But even this would be an improvement: (string-match (rx-unescape "turn \(left\|right\)") "turn right") => 0 I looked in the repos, but didn't see any packages that do this. As an aside, this thread led me to find the rx pcase matcher, something I'd daydreamed about before, so I'm already pretty happy :) Eric