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

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

Re: `looking-back' strange warning


From: Michael Heerdegen
Subject: Re: `looking-back' strange warning
Date: Fri, 02 Oct 2015 03:18:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> You can pass (point-min) for the limit if that's what you want.
> Making it optional Encourages people to think that looking-at is just
> like looking-back, with the same performance characteristic, whereas
> making it mandatory encourages people to put a reasonable limit and
> hence avoid pathological behavior at the end of large buffers.

My two cents: Even if you specify an optimal limit, `looking-back' can
still be unnecessarily slow.  For example,

   (looking-back "xy" 2)

is much slower than

    (and (> (point) 2)
         (save-excursion
           (goto-char (- (point) 2))
           (looking-at "xy")))

where "xy" stands for any plain string.


Michael.




reply via email to

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