From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?B?QW5kcmVhcyBSw7ZobGVy?= Newsgroups: gmane.emacs.devel Subject: Re: c-mode syntax strings and regexp word boundaries Date: Fri, 06 Sep 2013 14:21:07 +0200 Message-ID: <5229C8B3.5060800@online.de> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1378469971 20881 80.91.229.3 (6 Sep 2013 12:19:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 Sep 2013 12:19:31 +0000 (UTC) Cc: Jon Dufresne To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 06 14:19:33 2013 Return-path: Envelope-to: ged-emacs-devel@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 1VHv0e-0007zB-8I for ged-emacs-devel@m.gmane.org; Fri, 06 Sep 2013 14:19:32 +0200 Original-Received: from localhost ([::1]:37201 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHv0d-00042T-QY for ged-emacs-devel@m.gmane.org; Fri, 06 Sep 2013 08:19:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44480) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHv0T-00042H-SM for emacs-devel@gnu.org; Fri, 06 Sep 2013 08:19:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHv0K-0002w3-E1 for emacs-devel@gnu.org; Fri, 06 Sep 2013 08:19:21 -0400 Original-Received: from moutng.kundenserver.de ([212.227.126.171]:57975) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHv0K-0002vo-4L for emacs-devel@gnu.org; Fri, 06 Sep 2013 08:19:12 -0400 Original-Received: from purzel.sitgens (brln-4db90e96.pool.mediaWays.net [77.185.14.150]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MCx2B-1V9QoI3byV-009EFw; Fri, 06 Sep 2013 14:19:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 In-Reply-To: X-Provags-ID: V02:K0:FYFaz5SfxmZNqgvAOgAi+q3IZTZFHUOiFU81gRsBsYH i5czIJfu7cgAKnOK3LxZxya+BSTjP0uWYF0C+H9PAeyPKSzQS8 WXctt6dUgAQQHYe1sf77aR0MdHBfkTpYjFTbomEemtmqDReF5M 3NQ+Hycj8g1OrLW0/84YwU2pYGzbrsuT1HoFij2oZlHDVK6Udz LWkDeWhelHW6MYde7lPx3tWhff3ciQEER60jD1kdVTWVB4LtPC hLMS4UZKe+tDjQYEC30yBJ+8Ty1TE+8Rh8FiKJfcX0eztks9pA xrzSC2JXgUFOcLyBV1V3o/bo+0inzE1Cq1BMky1RBeGBgCiTWS 5HX6a1lLcFDV+VjeaEhA= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.126.171 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:163220 Archived-At: Am 06.09.2013 07:14, schrieb Jon Dufresne: > Hi, > > I am trying to modify a major mode derived from c-mode. I am adding support > for an alternative string syntax (PHP heredoc). To do this I am using > "syntax-propertize-function" and > "syntax-propertize-extend-region-functions". (As an aside I am not sure > this is the best approach, but it is best I have come up with so far.) > > When trying to extend the propertize region, a regexp fails, but I am not > clear as to why. I have isolated the problem with the following test case. > > --- > (with-temp-buffer > (c-mode) > (insert "END;\n") > (goto-char (point-min)) > (message "Search forward first time") > (re-search-forward "^END\\b") > (put-text-property (1- (point)) (point) > 'syntax-table (string-to-syntax "|")) > (goto-char (point-min)) > (message "Search forward second time") > (re-search-forward "^END\\b")) > --- > > Running this give me the output: > > Search forward first time > Search forward second time > Search failed: "^END\\b" > > I do not understand why the second regexp fails. I suppose it has to do > with the text property string boundary. What is the correct way to look for > the boundary in this case? > > Thanks for any help. > For me it's strange too. Second (re-search-forward "^END\\s.") matches that way. Can't see why the word-boundary isn't recognised any more. Andreas