From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jon Dufresne Newsgroups: gmane.emacs.devel Subject: Re: c-mode syntax strings and regexp word boundaries Date: Fri, 6 Sep 2013 07:55:08 -0700 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bd756d289322104e5b8399d X-Trace: ger.gmane.org 1378479314 2206 80.91.229.3 (6 Sep 2013 14:55:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 Sep 2013 14:55:14 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 06 16:55:15 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 1VHxRL-0003Nc-H8 for ged-emacs-devel@m.gmane.org; Fri, 06 Sep 2013 16:55:15 +0200 Original-Received: from localhost ([::1]:38147 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHxRL-0000Aq-7j for ged-emacs-devel@m.gmane.org; Fri, 06 Sep 2013 10:55:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56843) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHxRG-0000AI-Uc for emacs-devel@gnu.org; Fri, 06 Sep 2013 10:55:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHxRF-0006dP-Hn for emacs-devel@gnu.org; Fri, 06 Sep 2013 10:55:10 -0400 Original-Received: from mail-qe0-x22e.google.com ([2607:f8b0:400d:c02::22e]:47019) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHxRF-0006dI-Dy for emacs-devel@gnu.org; Fri, 06 Sep 2013 10:55:09 -0400 Original-Received: by mail-qe0-f46.google.com with SMTP id x7so1734456qeu.5 for ; Fri, 06 Sep 2013 07:55:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=35tA2wUUB2gIqgWMAY9BUXVLQ+w9l+s9QO/CUjtudsA=; b=OsRJQB9Vv6M/qx4gmLl8zrhYabS0DaIiL1/UW0WZesU5mKxHLZmBshlgIQSMMzCdLI +b8zsf9UaH8W5amdE2PtTvX2qdMv8OEXD4NgRqZpVwz8LKn2NzGHsaAdikEw0trKaW6g sYViTIxw+GiC4DFXA9Ck3HTUqCawLPzpK2B7IZf7henOzGhSZbq3RBJujEgS1e/9DgW7 Fadrf2xDjAxWF6rC8azzhy6679fcmVvLwBjoCCEe32xAyuCgbYbFdvgAAjsTEAXu3F7v 62Du1X0deyOYnHu60FH2euhx3YjxJHKUdhL7zKEUd4ng1ccnij3z4m5hL/UOAl+fkh5a IcFw== X-Received: by 10.49.39.161 with SMTP id q1mr3472817qek.66.1378479308875; Fri, 06 Sep 2013 07:55:08 -0700 (PDT) Original-Received: by 10.229.67.68 with HTTP; Fri, 6 Sep 2013 07:55:08 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c02::22e 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:163227 Archived-At: --047d7bd756d289322104e5b8399d Content-Type: text/plain; charset=UTF-8 Thanks. On Fri, Sep 6, 2013 at 7:07 AM, Stefan Monnier wrote: > > (re-search-forward "^END\\b") > > (put-text-property (1- (point)) (point) > > 'syntax-table (string-to-syntax "|")) > > This changes the syntax of this "D" from "w" to "|". > In this simplified example I *want* the entire string "END" to be a single end of string syntax. It is not part of the actual string, only marks the end of one. Instead, I went with only marking the "D" because marking all characters appears (to me) to create three string fences when I only want one. > > > (goto-char (point-min)) > > (message "Search forward second time") > > (re-search-forward "^END\\b")) > > The char before ";" is "D" which is not a word char any more, and the > ";" is not a word char either, so the point between the two is not > a word boundary any more. > > Ah, ok. Understood. Is it possible to do regexp search of the buffer with all text properties ignored? Or is there a better way to search for the "END" delimiter? I'll need it to work before the buffer is propertized and after the propertized buffer changed. The current implementation (as you might be able to guess) works when the buffer is first propertized, but not when the buffer is modified (as the regexp in the test example fails). Thanks, Jon --047d7bd756d289322104e5b8399d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Than= ks.

On Fri, Sep 6, 2013 at 7:07 AM,= Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> =C2=A0 (re-search-for= ward "^END\\b")
> =C2=A0 (put-text-property (1- (point)) (point)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0'syntax-table (string-to-syntax "|"))

This changes the syntax of this "D" from "w" to &= quot;|".

In this simplified exampl= e I *want* the entire string "END" to be a single end of string s= yntax. It is not part of the actual string, only marks the end of one. Inst= ead, I went with only marking the "D" because marking all charact= ers appears (to me) to create three string fences when I only want one.
=C2=A0

> =C2=A0 (goto-char (point-min))
> =C2=A0 (message "Search forward second time")
> =C2=A0 (re-search-forward "^END\\b"))

The char before ";" is "D" which is not a word ch= ar any more, and the
";" is not a word char either, so the point between the two is no= t
a word boundary any more.


Ah, ok. Understood. Is it possible to do regexp sear= ch of the buffer with all text properties ignored? Or is there a better way= to search for the "END" delimiter? I'll need it to work befo= re the buffer is propertized and after the propertized buffer changed.

The current implementation (as you might be able to guess) works when t= he buffer is first propertized, but not when the buffer is modified (as the= regexp in the test example fails).

Thanks,
Jon

--047d7bd756d289322104e5b8399d--