Subject: Re: bug#18013: 24.3.92; looking-back "[^\n]" taking a lot of time in large buffers

From: [email-masked]
Date: Sat, 25 Mar 2017 16:59:51 -0400

tags 18013 wontfix
close 18013
quit

Nicolas Richard <[email-masked]> writes:

>
> (looking-back "[^\n]") is bad code, so I totally deserve this. Still, is
> it possible to make the search smarter when the match is supposed to be
> "anchored" at point ? Otherwise let's just close this bug.

`looking-back' would have to analyse "[^\n]" to realize that it could
only match a single character.  I think this is too much effort for too
little benefit to justify implementing this.  For cases like this you
can limit the amount of searching by passing a non-nil LIMIT argument
(as described in the docstring):

    (looking-back "[^\n]" (1- (point)))