[Top][All Lists]

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

Re: Adding a colon as a word boundary for syntax highlighting

From: Stefan Monnier
Subject: Re: Adding a colon as a word boundary for syntax highlighting
Date: Mon, 18 Feb 2008 11:08:49 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

> I'm using the following regex subexpression:
> "\\<\\("
> As the left-hand word boundary for syntax highlighting in
> a lisp-style programming language.

> "\\(" adds the opening parenthesis as a word boundary.

No, it doesn't.  "\\(" is a regexp element that marks the beginning of
a sub-regexp.  It needs a closing "\\)" before the regexp is valid.
It does nothing to parenthesis characters.

Emacs doesn't know "word boundary characters".  All it knows is that
some characters are word-constituents and others aren't.  And "\\<" is
a regexp that matches an empty string on the condition that the char on
the left is a non-word-constituent and the char on the right is
a word-constituent.

: by default is not considered as a word-constituent.  I'm not sure what
you mean by "adding a colon as a word boundary".

> On a related note, I believe that there is an emacs add-on that
> allows the user to test elisp regexes, but for the life of me,
> I can't remember where to find it.

M-x regexp-builder (bundled with Emacs-22)?


reply via email to

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