From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: [elpa] externals/xr e77aa97: Postfix ops are literal after ^ but not after \(?:^\) Date: Tue, 19 Feb 2019 22:05:52 +0100 Message-ID: <4F49EFF3-C19A-4998-8686-DC528539D3B4@acm.org> References: <20190219201441.31417.54763@vcs0.savannah.gnu.org> <20190219201444.721BF20477@vcs0.savannah.gnu.org> Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="181022"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 19 22:08:22 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gwCcn-000kv3-Ni for ged-emacs-devel@m.gmane.org; Tue, 19 Feb 2019 22:08:22 +0100 Original-Received: from localhost ([127.0.0.1]:55022 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwCcm-0002Dv-OD for ged-emacs-devel@m.gmane.org; Tue, 19 Feb 2019 16:08:20 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:57359) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwCac-0001D2-60 for emacs-devel@gnu.org; Tue, 19 Feb 2019 16:06:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gwCaa-0007lQ-TE for emacs-devel@gnu.org; Tue, 19 Feb 2019 16:06:05 -0500 Original-Received: from mail76c50.megamailservers.eu ([91.136.10.86]:35164 helo=mail70c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gwCaX-0007Ob-VZ for emacs-devel@gnu.org; Tue, 19 Feb 2019 16:06:04 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1550610356; bh=k8qqvmtvr/eqZRstXDAm3D6t2YocHdaHxkK5pHqxyu0=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=fDAeNagqLmGo7sl50SNgUo9wiN3V16H//28cjMgZoNFHr98XdJY8GNgd0cFB6WFy1 xg1O+ET/4VmgInLR5xV1c/V+UjESMGT46tE0sTKe4euf7EhwUhJcsMI53uZtZvy1bd NUbq2Pl5jxiZnc6tHg/fZrLsqnPM8quPHuzKcDsA= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.1.65] (c-e636e253.032-75-73746f71.bbcust.telenor.se [83.226.54.230]) (authenticated bits=0) by mail70c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x1JL5r0D025572; Tue, 19 Feb 2019 21:05:55 +0000 In-Reply-To: X-Mailer: Apple Mail (2.3445.102.3) X-CTCH-RefID: str=0001.0A0B020B.5C6C6FB4.0009, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=ILcs9DnG c=1 sm=1 tr=0 a=M+GU/qJco4WXjv8D6jB2IA==:117 a=M+GU/qJco4WXjv8D6jB2IA==:17 a=kj9zAlcOel0A:10 a=iRZporoAAAAA:8 a=8JoRgpsY9YjL9MTgwwIA:9 a=CjuIK1q_8ugA:10 a=NOBgFS-JBQ2l-kSd6-zu:22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 91.136.10.86 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:233474 Archived-At: 19 feb. 2019 kl. 21.29 skrev Stefan Monnier : >=20 >> Postfix ops are literal after ^ but not after \(?:^\) >=20 > BTW, some of those details of the syntax of regexps are really > undesirable. Would it be possible for xr to flag them somehow to try > and discourage their use? >=20 > Of course, even better would be to flag such uses not only in xr but > more generally. I'm thinking for example of a regexp that starts with > a postfix operator or that backslash-escapes a non-special character. The xr machinery could probably be reused for that sort of linting, yes, = but whether it's a good place depends on how we want to use it. It could = be used in static linting of regexps in elisp string literals, but with = false positives and negatives. Putting it in regex-emacs.c would allow = for exact detection but only of those actually used during execution. By the way, the reason for fixing this rather minor bug in xr, apart = from general perfectionism, was a bug in rx: bol and eol are = unconditionally translated to ^ and $ no matter where they occur. For = example: (rx "a" bol "b" eol "c") =3D> "a^b$c" (which means literally "a^b$c") (rx (zero-or-more bol)) =3D> "^*" (which means literally "^*") rx should bracket the ^$ stuff and generate something like = "a\\(?:^\\)b\\(?:$\\)c" and "\\(?:^\\)*".