From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: `looking-back' strange warning Date: Thu, 1 Oct 2015 22:13:01 -0700 (PDT) Message-ID: References: <560B9C7F.2060301@easy-emacs.de> <560CD7CE.4010404@yandex.ru> <6524c81a-949c-40d1-b990-d214d6ee5b60@default> <560D73DF.8040403@yandex.ru> <560D7A68.8040404@easy-emacs.de> <560D8289.6010409@yandex.ru> <560D8F96.5040200@easy-emacs.de> <877fn66pag.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1443762818 4933 80.91.229.3 (2 Oct 2015 05:13:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 2 Oct 2015 05:13:38 +0000 (UTC) To: Michael Heerdegen , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 02 07:13:26 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Zhseq-0004TR-Sn for geh-help-gnu-emacs@m.gmane.org; Fri, 02 Oct 2015 07:13:25 +0200 Original-Received: from localhost ([::1]:57546 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zhseq-0008FS-1J for geh-help-gnu-emacs@m.gmane.org; Fri, 02 Oct 2015 01:13:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhseZ-0008Cg-Pa for help-gnu-emacs@gnu.org; Fri, 02 Oct 2015 01:13:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhseW-0002h4-K0 for help-gnu-emacs@gnu.org; Fri, 02 Oct 2015 01:13:07 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:42667) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhseW-0002g2-Dw for help-gnu-emacs@gnu.org; Fri, 02 Oct 2015 01:13:04 -0400 Original-Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t925D3a2027976 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 2 Oct 2015 05:13:03 GMT Original-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t925D3Bi016968 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 2 Oct 2015 05:13:03 GMT Original-Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t925D2Jn009821; Fri, 2 Oct 2015 05:13:03 GMT In-Reply-To: <877fn66pag.fsf@web.de> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6691.5000 (x86)] X-Source-IP: userv0021.oracle.com [156.151.31.71] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:107455 Archived-At: > > 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. >=20 > 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. Definitely. And this is in fact a typical case of the misuse: the string to check is often a literal, so its length is known. This is the first thing to mention about `looking-back', in terms of performance: avoid it altogether, if you can.