emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fixing ill-conditioned regular expressions. Proof of concept.


From: Alan Mackenzie
Subject: Re: Fixing ill-conditioned regular expressions. Proof of concept.
Date: Wed, 25 Feb 2015 10:08:34 +0000
User-agent: Mutt/1.5.22 (2013-10-16)

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).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]