From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual Date: Wed, 06 Jun 2018 15:51:02 +0200 Message-ID: <87602wm3ax.fsf@gmail.com> References: <20180529073311.EEA09102DA@mailuser.nyi.internal> <876036hn2e.fsf@gmail.com> <87tvqqd7rp.fsf@gmail.com> <87r2lufvo9.fsf@gmail.com> <83r2luv28h.fsf@gnu.org> <87a7sib7ty.fsf@gmail.com> <83in75vp8l.fsf@gnu.org> <87wovkyv6l.fsf@gmail.com> <83tvqmga79.fsf@gnu.org> <87h8mmu6jp.fsf@gmail.com> <83k1rifyqo.fsf@gnu.org> <87y3fyskns.fsf@gmail.com> <87tvqmsjww.fsf@gmail.com> <87bmcqlwhn.fsf@gmail.com> <8336y2czrp.fsf@gnu.org> <87zi0a5v4z.fsf@gmail.com> <83tvqh9sqp.fsf@gnu.org> <87lgbtm2q2.fsf@gmail.com> <87fu20mkbm.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1528292962 6009 195.159.176.226 (6 Jun 2018 13:49:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 6 Jun 2018 13:49:22 +0000 (UTC) Cc: Eli Zaretskii , Emacs developers To: Noam Postavsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 06 15:49:17 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fQYoO-0001MC-FZ for ged-emacs-devel@m.gmane.org; Wed, 06 Jun 2018 15:49:16 +0200 Original-Received: from localhost ([::1]:52567 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQYqT-0005D2-OX for ged-emacs-devel@m.gmane.org; Wed, 06 Jun 2018 09:51:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQYqF-0005BW-JS for emacs-devel@gnu.org; Wed, 06 Jun 2018 09:51:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fQYqE-0004AE-JC for emacs-devel@gnu.org; Wed, 06 Jun 2018 09:51:11 -0400 Original-Received: from mail-wr0-x22d.google.com ([2a00:1450:400c:c0c::22d]:39676) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fQYqA-00046x-38; Wed, 06 Jun 2018 09:51:06 -0400 Original-Received: by mail-wr0-x22d.google.com with SMTP id w7-v6so6390380wrn.6; Wed, 06 Jun 2018 06:51:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:mail-followup-to:mail-copies-to :gmane-reply-to-list:date:in-reply-to:message-id:mime-version :content-transfer-encoding; bh=y6SJgNx05CsBcBKtyH8SYiWmVtN7ABvYpixbdRE3Qts=; b=qH8Rvm/pcAJ4JA4PHi+sgb4xV5uIiFUra007LAqd39Q3NDdaDMRKmlVKSvgjhL6nn5 iMNBLrZ5BSXGcuZ92OTsJCCMXh6e5cU7zqzmks1JmMzicO84gb5olmaJTx8631YW0W0B ty0+TezIeZGYP9pOJHuyIxbULf6+fArnH/3nqqKCZjzvLS2xc0DgDMiwtuE/wJEfBbl7 FeKUlB607R0+XFHed7NYjzwHasxlO34TdOyUwSGZAA7yAvpHK2KyQcIV6OV/5YdpruKW vGJh1FG+HkkVAl46xJxj7JmvGl34sy1G0qoCs62A2VO7DDlwL5rOw7zsyDts4auNlDhx IruA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:mail-followup-to :mail-copies-to:gmane-reply-to-list:date:in-reply-to:message-id :mime-version:content-transfer-encoding; bh=y6SJgNx05CsBcBKtyH8SYiWmVtN7ABvYpixbdRE3Qts=; b=nZecmdoAJ+fjJFIv5Yk5cVXBTY3f+CFBCfNlx0dKW3vLM35SpEFrziKwoqTO0lGKBY C7qrXAUNe1F+PaYFNLxiRvg7Bwai2C3BrI0u8eNh0DefRDSyogxdRAwtrpHxju6o8yUV 3Os2AsFb7FqUsUHs1aEkJv8wpFwZyhMPf6HO4fc16sCX1oPVSCPKRjDkp7PBhcI4J1Rp i3fPLBLA5S1Mmj4u8Y87qTFsH+SGXo5Ice/4j/sYPtsq128gZw0KaZip5H9pQgy8s3fj Aw9NuBqalsYX999+DJ5PrvnyD840RD6wr0KblngStbyW8eLCZUL2wq5dyWOXmgJKIXOL vBDQ== X-Gm-Message-State: APt69E3arQgBfNtEcqditueeMEdayNLxBuzzga1zP+zX9EZZfJNKHbEd orEBIdfVEfqmiPYpDjrSO5lEZ9Rd4vI= X-Google-Smtp-Source: ADUXVKIVptpgzJoyIytZcTF+oFPK6OLixtkG8O8eZmcWd4F1sfQ6Lp1MXxFALv9fvhkyX3XLlqSzeQ== X-Received: by 2002:adf:e392:: with SMTP id e18-v6mr2567864wrm.94.1528293064322; Wed, 06 Jun 2018 06:51:04 -0700 (PDT) Original-Received: from rpluim ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id g75-v6sm6321946wmd.15.2018.06.06.06.51.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jun 2018 06:51:02 -0700 (PDT) Mail-Followup-To: emacs-devel@gnu.org Mail-Copies-To: never Gmane-Reply-To-List: yes In-Reply-To: (Noam Postavsky's message of "Wed, 6 Jun 2018 09:13:20 -0400") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22d X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:226063 Archived-At: Noam Postavsky writes: > On 6 June 2018 at 03:43, Robert Pluim 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= : ?\( That=CA=BCs a matter of style, no? ?( works equally well, but emacs convention appears to be ?\( >> The regexp produced by (sentence-end) looks like it=CA=BCs fairly well >> anchored. Besides, I=CA=BCm not searching for an end-of-sentence, I=CA= =BCm >> asking "Am I at end-of-sentence". > > Which is exactly why you should put a limit. I don=CA=BCt 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. Although I could limit it to (point-at-bol 0) just to be extra super sure, but my benchmarking shows no appreciable difference. Robert