From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Fixing ill-conditioned regular expressions. Proof of concept. Date: Wed, 25 Feb 2015 10:08:34 +0000 Message-ID: <20150225100834.GA3502@acm.fritz.box> References: <20150223181205.GA2861@acm.fritz.box> <54EB85AC.1030800@cs.ucla.edu> <20150223202114.GB2861@acm.fritz.box> <54EBA757.5030901@cs.ucla.edu> <20150223224245.GC2861@acm.fritz.box> <54EBB9C4.1020505@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1424858983 7832 80.91.229.3 (25 Feb 2015 10:09:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Feb 2015 10:09:43 +0000 (UTC) Cc: emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 25 11:09:32 2015 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 1YQYuJ-0002gr-FU for ged-emacs-devel@m.gmane.org; Wed, 25 Feb 2015 11:09:31 +0100 Original-Received: from localhost ([::1]:53596 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQYuI-0000KF-OM for ged-emacs-devel@m.gmane.org; Wed, 25 Feb 2015 05:09:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53651) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQYtv-0008Ep-PJ for emacs-devel@gnu.org; Wed, 25 Feb 2015 05:09:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQYtq-0001L3-ON for emacs-devel@gnu.org; Wed, 25 Feb 2015 05:09:07 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:42748 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQYtq-0001Ka-Em for emacs-devel@gnu.org; Wed, 25 Feb 2015 05:09:02 -0500 Original-Received: (qmail 92085 invoked by uid 3782); 25 Feb 2015 10:09:00 -0000 Original-Received: from acm.muc.de (pD9519942.dip0.t-ipconnect.de [217.81.153.66]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 25 Feb 2015 11:08:59 +0100 Original-Received: (qmail 3561 invoked by uid 1000); 25 Feb 2015 10:08:34 -0000 Content-Disposition: inline In-Reply-To: <54EBB9C4.1020505@cs.ucla.edu> User-Agent: Mutt/1.5.22 (2013-10-16) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-Received-From: 193.149.48.1 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:183486 Archived-At: Hi, Paul. On Mon, Feb 23, 2015 at 03:37:40PM -0800, Paul Eggert wrote: > Alan Mackenzie wrote: > > Why not call fix-re from within > > re-search-forward/backward, looking-at, ... > I was thinking of calling it from within regexp.c itself, so that the > callers would not need to be changed; it's the same basic idea, just a > bit easier on the maintainers. regexp.c is a "pure" sort of module, not even containing the cache for the compiled regexps, so that doesn't seem the place for fix-re.el. Thinking about it, calling fix-re for every regexp search doesn't seem right. Most regexps are perfectly blameless, and filling up the fix-re cache with them is a waste of time. More to the point, it is sometimes not possible to preserve the numbering of \(...\) constructs while fixing a regexp, which would change the match-data. But in the context where one wants to call fix-re, mainly regexps constructed from user/package configuration variables, the \(...\) numbers aren't significant anyway. So, how about the following: a new variable isearch-fix-re-flag which would have to be bound to non-nil for fix-re to run, then binding this variable in the few places it's needed, such as in forward-paragraph. -- Alan Mackenzie (Nuremberg, Germany).