emacs-devel
[Top][All Lists]
Advanced

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

Re: c-mode syntax strings and regexp word boundaries


From: Stefan Monnier
Subject: Re: c-mode syntax strings and regexp word boundaries
Date: Fri, 06 Sep 2013 11:44:15 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

>> 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.

Yes, I understand.

> 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.

Depending on the particular constraints imposed on you, you might get
away with marking the character *after* END as being the string
delimiter.  But that tends to come with its own set of problems, so most
likely, you'll have to live with what you're currently using.

> Ah, ok. Understood. Is it possible to do regexp search of the buffer with
> all text properties ignored?

No.  We have `parse-sexp-lookup-properties' to control whether
syntax-table text-properties are ignored or not by parsing function
(like forward-sexp), but there's no such control for regexp matching.

> 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.

Don't rely on syntax (i.e. things like \b, \>, \<, \s), and instead use
something like "^END\\(?:[^[:alnum:]]\\|\\'\\)".


        Stefan



reply via email to

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