[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Font-lock of comments using comment tokens, does it work?
From: |
tomas |
Subject: |
Re: Font-lock of comments using comment tokens, does it work? |
Date: |
Sun, 7 Jun 2015 13:34:49 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sun, Jun 07, 2015 at 05:58:45AM +0200, Björn Lindqvist wrote:
> Ok so I finally almost figured it out. The key part was that you must
> invert the logic so that instead of "unmarking" in
> syntax-propertize-rules, you use a regexp that adds the comment
> starter property "<" to the matched strings. Something is bugged with
> the unmarking approach, it's like it stops looking when it found the
> comment character. Anyway:
>
> (syntax-propertize-rules
> ("\\(^\\| \\|\t\\)\\(FOO\\|BAR\\)\\($\\| \\|\t\\)" (2 "< ")))
Got it.
> Does almost exactly what I want. Amusingly enough the matching is
> case-INsensitive so bAR, Bar, foo, etc matches the regexp. But it's a
> small flaw which I can live with.
This is most probably related to the (buffer local) variable case-fold-search,
which controls whether the regexp search functions are case sensitive or not.
By default, it's set to t (that's what you usually expect interactively).
You could try to set this variable to nil and see whether it works better.
Alas, there doesn't seem to be a way to control that in the simple
syntax-propertize-rules -- possibly you'll have to go the way of
defining a syntax-propertize-function, where you can set this variable
dynamically for the relevant call.
Ducking around, here's a little snippet which might help to get you
started:
<http://www.lunaryorn.com/feed.atom#hooking-into-syntactic-analyses>
HTH, regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAlV0LFgACgkQBcgs9XrR2kaEvwCcCR5xyTagZ/ihFBj7iv9keKTl
pVAAnjRjsvahbfSW4+1sJ0UEconY1lz2
=5Ywn
-----END PGP SIGNATURE-----
- Font-lock of comments using comment tokens, does it work?, Björn Lindqvist, 2015/06/03
- Re: Font-lock of comments using comment tokens, does it work?, Stefan Monnier, 2015/06/03
- Re: Font-lock of comments using comment tokens, does it work?, Björn Lindqvist, 2015/06/03
- Message not available
- Re: Font-lock of comments using comment tokens, does it work?, Stefan Monnier, 2015/06/03
- Re: Font-lock of comments using comment tokens, does it work?, Björn Lindqvist, 2015/06/04
- Message not available
- Re: Font-lock of comments using comment tokens, does it work?, Stefan Monnier, 2015/06/04
- Re: Font-lock of comments using comment tokens, does it work?, Björn Lindqvist, 2015/06/04
- Re: Font-lock of comments using comment tokens, does it work?, tomas, 2015/06/05
- Re: Font-lock of comments using comment tokens, does it work?, Björn Lindqvist, 2015/06/05
- Re: Font-lock of comments using comment tokens, does it work?, Björn Lindqvist, 2015/06/06
- Re: Font-lock of comments using comment tokens, does it work?,
tomas <=