emacs-devel
[Top][All Lists]
Advanced

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

Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual


From: Noam Postavsky
Subject: Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual
Date: Wed, 6 Jun 2018 10:41:14 -0400

On 6 June 2018 at 09:51, Robert Pluim <address@hidden> wrote:

>>> I could always do (eq (char-before) ?() I suppose.
>>
>> That's probably better. But wait! This time you *should* have a backslash: 
>> ?\(
>
> Thatʼs a matter of style, no? ?( works equally well, but emacs
> convention appears to be ?\(

Mostly yes, but see also Bug#20852.

>>> The regexp produced by (sentence-end) looks like itʼs fairly well
>>> anchored. Besides, Iʼm not searching for an end-of-sentence, Iʼm
>>> asking "Am I at end-of-sentence".
>>
>> Which is exactly why you should put a limit.
>
> I donʼt understand that conclusion. If I have
>
> some words.  some other words
>              ^
>
> with point at '^', (looking-back (sentence-end)) will match. If point is
> not at an end of sentence, looking-back won't go backwards through the
> buffer attempting to find one.

Even worse, it will go backwards through the buffer attempting to find
a sentence that ends at point.

(with-temp-buffer
  (dotimes (i 7)
    (dotimes (_ (expt 10 i))
      (insert "Lorem ipsum dolor sit amet, consectetur adipiscing
elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua.  Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat.  Duis
aute irure dolor in reprehenderit in voluptate velit esse cillum
dolore eu fugiat nulla pariatur.  Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt mollit
anim id est laborum."))
    (insert "  Sentence doesn't end here")
    (benchmark 1 '(looking-back (sentence-end)))))
Elapsed time: 0.000000s [3 times]
Elapsed time: 0.023000s
Elapsed time: 0.101000s
Elapsed time: 0.902000s
Elapsed time: 8.872000s



reply via email to

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