help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: search-backward returning matches which end after point


From: Stefan Monnier
Subject: Re: search-backward returning matches which end after point
Date: Mon, 26 Aug 2024 12:54:15 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

>> You could write a `while + looking-at` loop to do that, but if you want
>> something faster, you'll need to change the C code.
>> I don't expect it would be a difficult change, tho (it should not require
>> any significant change in the regexp engine, for example).
> I'm happy to do that, if this is an addition which is likely to be
> accepted into Emacs.

It's hard for me to judge.  OT1H it should be rather unintrusive, but
OTOH it's unsatisfying because doing the same in the other direction
(i.e. when searching forward) is much harder.

> Should the API be a new flag in
> search-backward/re-search-backward/looking-back?  Or should it maybe
> be a new special variable?

Or new functions?  It's a toss-up (I'm rather against special variables).

> In my case this is tricky though because the thing I'm searching for
> *can* contain a newline, so it's not totally trivial to determin what
> small step is correct to take...

A common other approach is to do a `search-forward` after the
`search-backward` to detect when `search-backward` went "too far".


        Stefan




reply via email to

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