unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Adding a colon as a word boundary for syntax highlighting
Date: Mon, 18 Feb 2008 11:08:49 -0500	[thread overview]
Message-ID: <jwvodaefe5z.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: 13ri26n4913br9a@news.supernews.com

> 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)?


        Stefan


  parent reply	other threads:[~2008-02-18 16:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-18  4:27 Adding a colon as a word boundary for syntax highlighting Tim Johnson
2008-02-18 12:58 ` Johan Bockgård
2008-02-18 16:00   ` Tim Johnson
2008-02-18 16:08 ` Stefan Monnier [this message]
2008-02-18 19:23   ` Tim Johnson
2008-02-20 19:41     ` Stefan Monnier
2008-02-20 20:37       ` Tim Johnson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvodaefe5z.fsf-monnier+gnu.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).