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: Fri, 2 Oct 2015 14:35:03 -0700 (PDT) Message-ID: <785d8be4-1024-4635-83ff-7bc51dd4b5bf@default> 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> <190e27a5-9099-45ce-a8db-a314b9e32b35@default> <87lhblrnpe.fsf@gnu.org> 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 1443821904 6482 80.91.229.3 (2 Oct 2015 21:38:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 2 Oct 2015 21:38:24 +0000 (UTC) Cc: Michael Heerdegen , help-gnu-emacs@gnu.org To: Tassilo Horn Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 02 23:38:13 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 1Zi81m-00078y-Ki for geh-help-gnu-emacs@m.gmane.org; Fri, 02 Oct 2015 23:38:07 +0200 Original-Received: from localhost ([::1]:35302 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi81m-0006YP-0L for geh-help-gnu-emacs@m.gmane.org; Fri, 02 Oct 2015 17:38:06 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37367) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi7z4-0006GY-JL for help-gnu-emacs@gnu.org; Fri, 02 Oct 2015 17:35:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zi7z3-0002fA-Nw for help-gnu-emacs@gnu.org; Fri, 02 Oct 2015 17:35:18 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:50948) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi7yz-0002dj-Ul; Fri, 02 Oct 2015 17:35:14 -0400 Original-Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t92LZCTu024316 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 2 Oct 2015 21:35:13 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 t92LZBOY003093 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 2 Oct 2015 21:35:12 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 t92LZ5DZ017202; Fri, 2 Oct 2015 21:35:10 GMT In-Reply-To: <87lhblrnpe.fsf@gnu.org> 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: 141.146.126.69 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:107487 Archived-At: > This version is about 6 times faster in the t case and a still a bit > faster in the nil case where the char before point is already different > (which is the best case for your function). >=20 > (defun chars-before (chars) > "Return non-nil if the literal string CHARS is right before point. > This is more efficient that `looking-back' for this use case." > (let ((beg (- (point) (length chars)))) > (unless (< beg 0) > (save-excursion > =09 (goto-char beg) > =09 (looking-at (regexp-quote chars)))))) OK. Good to know. See also bug #17284, http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D17284, where this has been discussed and I and others proposed code for this. You are welcome to contribute to that (short) bug thread, or to otherwise try to get such a function added to Emacs.