unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Cc: Eli Zaretskii <eliz@gnu.org>
Subject: Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual
Date: Wed, 6 Jun 2018 09:13:20 -0400	[thread overview]
Message-ID: <CAM-tV-_hyHRN2RRvSjvLgrHhcB_XgSP3cVTZixu=g=VsDFpSig@mail.gmail.com> (raw)
In-Reply-To: <87fu20mkbm.fsf@gmail.com>

On 6 June 2018 at 03:43, Robert Pluim <rpluim@gmail.com> wrote:

>> And I think you'll want to give a limit
>> to the looking-back calls, otherwise they can keep searching until the
>> beginning of buffer.
>
> ((looking-back "(") should never look at more than one character.

Perhaps it shouldn't, but Emacs doesn't make that kind of optimization:

(with-temp-buffer
  (let ((last-command-event ?a))
    (dotimes (i 8)
      (self-insert-command (expt 10 i))
      (benchmark 1 '(looking-back "(")))))
Elapsed time: 0.000036s
Elapsed time: 0.000030s
Elapsed time: 0.000066s
Elapsed time: 0.000427s
Elapsed time: 0.004068s
Elapsed time: 0.040317s
Elapsed time: 0.422173s
Elapsed time: 1.514244s

(with-temp-buffer
  (let ((last-command-event ?a))
    (dotimes (i 8)
      (self-insert-command (expt 10 i))
      (benchmark 1 '(looking-back "(" (1- (point)))))))
Elapsed time: 0.000031s
Elapsed time: 0.000027s [5 times]
Elapsed time: 0.000041s
Elapsed time: 0.000045s

> I could always do (eq (char-before) ?() I suppose.

That's probably better. But wait! This time you *should* have a backslash: ?\(

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



  reply	other threads:[~2018-06-06 13:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180529073311.EEA09102DA@mailuser.nyi.internal>
     [not found] ` <876036hn2e.fsf@gmail.com>
     [not found]   ` <87tvqqd7rp.fsf@gmail.com>
     [not found]     ` <87r2lufvo9.fsf@gmail.com>
     [not found]       ` <83r2luv28h.fsf@gnu.org>
     [not found]         ` <87a7sib7ty.fsf@gmail.com>
     [not found]           ` <83in75vp8l.fsf@gnu.org>
     [not found]             ` <87wovkyv6l.fsf@gmail.com>
     [not found]               ` <83tvqmga79.fsf@gnu.org>
     [not found]                 ` <87h8mmu6jp.fsf@gmail.com>
     [not found]                   ` <83k1rifyqo.fsf@gnu.org>
     [not found]                     ` <87y3fyskns.fsf@gmail.com>
2018-06-01 13:42                       ` bug#31636: 27.0.50; lockfile syntax searchable from info manual Robert Pluim
2018-06-04  9:41                         ` Robert Pluim
2018-06-04 10:39                           ` Andreas Schwab
2018-06-04 14:02                             ` Robert Pluim
2018-06-04 16:06                               ` Eli Zaretskii
2018-06-04 15:55                           ` Eli Zaretskii
2018-06-04 17:17                             ` Robert Pluim
2018-06-05 15:07                               ` Eli Zaretskii
2018-06-05 19:51                                 ` Robert Pluim
2018-06-05 20:08                                   ` Noam Postavsky
2018-06-06  7:43                                     ` Robert Pluim
2018-06-06 13:13                                       ` Noam Postavsky [this message]
2018-06-06 13:51                                         ` Robert Pluim
2018-06-06 14:41                                           ` Noam Postavsky
2018-06-06 14:51                                             ` Robert Pluim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAM-tV-_hyHRN2RRvSjvLgrHhcB_XgSP3cVTZixu=g=VsDFpSig@mail.gmail.com' \
    --to=npostavs@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).