From: tomas@tuxteam.de
To: "Björn Lindqvist" <bjourne@gmail.com>
Cc: help-gnu-emacs@gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: Font-lock of comments using comment tokens, does it work?
Date: Sun, 7 Jun 2015 13:34:49 +0200 [thread overview]
Message-ID: <20150607113448.GB32656@tuxteam.de> (raw)
In-Reply-To: <CALG+76eUe0k4JT8-F2SevQxTJS2R_cjRnLKR9ZZbJ1WYk_EJDA@mail.gmail.com>
-----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-----
next prev parent reply other threads:[~2015-06-07 11:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.4238.1433357678.904.help-gnu-emacs@gnu.org>
2015-06-03 19:11 ` Font-lock of comments using comment tokens, does it work? Stefan Monnier
2015-06-03 23:37 ` Björn Lindqvist
[not found] ` <mailman.4244.1433374628.904.help-gnu-emacs@gnu.org>
2015-06-04 3:42 ` Stefan Monnier
2015-06-04 11:10 ` Björn Lindqvist
[not found] ` <mailman.4276.1433416248.904.help-gnu-emacs@gnu.org>
2015-06-04 22:11 ` Stefan Monnier
2015-06-05 3:29 ` Björn Lindqvist
2015-06-05 6:53 ` tomas
2015-06-05 19:37 ` Björn Lindqvist
2015-06-07 3:58 ` Björn Lindqvist
2015-06-07 11:34 ` tomas [this message]
2015-06-03 16:46 Björn Lindqvist
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150607113448.GB32656@tuxteam.de \
--to=tomas@tuxteam.de \
--cc=bjourne@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.