From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: `looking-back' strange warning Date: Sat, 03 Oct 2015 08:26:05 +0200 Message-ID: <87bncgii2q.fsf@gnu.org> 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> <785d8be4-1024-4635-83ff-7bc51dd4b5bf@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1443853596 20072 80.91.229.3 (3 Oct 2015 06:26:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 3 Oct 2015 06:26:36 +0000 (UTC) Cc: Michael Heerdegen , help-gnu-emacs@gnu.org To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Oct 03 08:26: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 1ZiGH1-0005HM-8z for geh-help-gnu-emacs@m.gmane.org; Sat, 03 Oct 2015 08:26:23 +0200 Original-Received: from localhost ([::1]:37146 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZiGH0-0008NW-9R for geh-help-gnu-emacs@m.gmane.org; Sat, 03 Oct 2015 02:26:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55597) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZiGGq-0008NP-5B for help-gnu-emacs@gnu.org; Sat, 03 Oct 2015 02:26:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZiGGm-0006qk-UX for help-gnu-emacs@gnu.org; Sat, 03 Oct 2015 02:26:12 -0400 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:33212) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZiGGm-0006qf-Ny for help-gnu-emacs@gnu.org; Sat, 03 Oct 2015 02:26:08 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id A145320C3C for ; Sat, 3 Oct 2015 02:26:08 -0400 (EDT) Original-Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Sat, 03 Oct 2015 02:26:08 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:message-id :mime-version:references:subject:to:x-sasl-enc:x-sasl-enc; s= smtpout; bh=YdwXyGI02O6IWTPnpXeZmCEJrVk=; b=RLjdVIayWc35NaFoWmfV DNZbJSAgwv421A2ZhxbOk4TcB3N1hAPL8bmytaKW0tfQjYSpIKWscK6PcaBmiuS7 fwUScmvrQ49hHgWSUC9prXR/PR7C/I++CzVTzG3e1ntJMcU+nsjtrhuCZyGURmx/ Y/gaPGrMzgjocHHf67vxtE4= X-Sasl-enc: HB1Eiouktju0Q8vfmdPpstPSOsi70uyL2tG4AzCVUmQV 1443853568 Original-Received: from thinkpad-t440p (unknown [2.160.114.254]) by mail.messagingengine.com (Postfix) with ESMTPA id 6C04DC00013; Sat, 3 Oct 2015 02:26:07 -0400 (EDT) Mail-Followup-To: Drew Adams , Michael Heerdegen , help-gnu-emacs@gnu.org User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.28 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:107493 Archived-At: Drew Adams writes: >> 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). >> >> (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 >> (goto-char beg) >> (looking-at (regexp-quote chars)))))) > > OK. Good to know. > > See also bug #17284, > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17284, > where this has been discussed and I and others proposed > code for this. Martin's version is faster than mine, so no need to propose it. > You are welcome to contribute to that (short) bug thread, > or to otherwise try to get such a function added to Emacs. I think that function is not really a viable drop-in replacement for typical `looking-back' calls. The latter is most frequently used to decide "am I behind some word or sequence of words, and I don't care about whitespace?". Bye, Tassilo