[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: c-mode syntax strings and regexp word boundaries

From: Jon Dufresne
Subject: Re: c-mode syntax strings and regexp word boundaries
Date: Fri, 6 Sep 2013 07:55:08 -0700


On Fri, Sep 6, 2013 at 7:07 AM, Stefan Monnier <address@hidden> 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).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]