From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Alan Mackenzie <acm@muc.de>,
emacs-devel@gnu.org, Richard Stallman <rms@gnu.org>
Subject: Re: [sigra@home.se: C++-mode: Syntax highlighting: wrong color for function identifier depending on the kind of whitespace that follows]
Date: Thu, 10 Mar 2005 17:59:26 -0500 [thread overview]
Message-ID: <jwvfyz36sr9.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <5bk6of409s.fsf@lister.roxen.com> (Martin Stjernholm's message of "Thu, 10 Mar 2005 23:13:51 +0100")
>> - why can't they use the font-lock-multiline property?
>> - why can't they use the jit-lock-defer-multiline property?
> One argument for a hook alternative to these things is that it might
> not be efficient/convenient to spread text properties all over the
> place:
You misunderstood: I'm not particularly happy about either of the
*-multiline text-properties. I wrote both of them, but neither of them is
satisfactory, really.
But I want to better understand the limitations and strength of each
approach before adding a new hook.
When I added the jit-lock-defer-multiline property (mostly for perl-mode),
I first considered adding a hook somewhat like Alan's but it turns out that
it's pretty damn difficult to write this hook:
The problem is: how to get font-lock to refontify
s[foo]{
bar
}x
when it's changed to
s[foo]{
bar
}xe
since the first `bar' should be treated like a string whereas the second
should be treated like code.
Now, when I'm in the middle of font-locking, I've done the work of figuring
out that I'm in an s/foo/bar/ expression and I can easily add
a text-property on the whole thing. OTOH using something like Alan's hook,
I'm stuck because if I see "}xe" I don't even know if I'm within code, or
within a string, let along if the } happens to be closing the second arg of
an `s' operation. It can be done, of course, but it's a fair bit of
redundant work especially since you have to make sure it's not too slow
in the "usual" case (where the hook shouldn't do anything).
I suspect that in the case mentioned in the subject the problem might
be similar.
> o Text properties stay behind when the buffer changes, and so they
> might become invalid. Adding code to correctly remove them before
> that can be tricky.
font-lock (and jit-lock) should take care of that for you.
> o Putting text properties in place and handling stickiness etc
> properly is decidedly more complex than just returning a region
> from a hook.
I haven't seen code that bothers with stickiness when handling *-multiline,
so it doesn't seem complex.
I do agree that for the awk-mode case, Alan's hook is probably one of the
most straightforward solution. But I must also say I'm not convinced by the
resulting behavior in awk-mode (or c-mode for that matter). After all, it
catches the problem of forgetting a \, so the warning face should be applied
to the \n char where the \ is missing, not to the opening/closing quote.
This would tie in with another "todo" feature: provide font-lock-keywords
specific to a particular syntatic context: you could thus have separate
keywords highlighted in comments and in strings. Quite handy for
Javadoc thingies.
Stefan
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
next prev parent reply other threads:[~2005-03-10 22:59 UTC|newest]
Thread overview: 103+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1D94Wo-0006AP-W2@fencepost.gnu.org>
2005-03-09 21:18 ` [sigra@home.se: C++-mode: Syntax highlighting: wrong color for function identifier depending on the kind of whitespace that follows] Alan Mackenzie
2005-03-09 22:35 ` Stefan Monnier
2005-03-10 8:00 ` Alan Mackenzie
2005-03-10 13:01 ` Stefan Monnier
2005-03-10 15:16 ` D. R. E. Moonfire
2005-03-10 17:01 ` Stefan Monnier
2005-03-10 20:09 ` Alan Mackenzie
2005-03-10 20:53 ` Stefan Monnier
2005-03-10 22:42 ` Alan Mackenzie
2005-03-11 20:28 ` Richard Stallman
2005-03-11 1:48 ` Richard Stallman
2005-03-11 19:43 ` Alan Mackenzie
2005-03-10 22:13 ` Martin Stjernholm
2005-03-10 22:59 ` Stefan Monnier [this message]
2005-03-11 20:27 ` Richard Stallman
2005-03-13 16:19 ` Martin Stjernholm
2005-03-14 1:07 ` Stefan Monnier
2005-03-19 22:23 ` Martin Stjernholm
2005-03-19 22:30 ` Stefan Monnier
2005-03-11 1:47 ` Richard Stallman
2005-03-11 4:47 ` Stefan Monnier
2005-03-12 0:56 ` Richard Stallman
2005-03-12 1:00 ` Stefan Monnier
2005-03-13 15:30 ` Richard Stallman
2005-03-11 1:46 ` Richard Stallman
2005-03-11 1:46 ` Richard Stallman
2006-02-12 13:06 ` Ralf Angeli
2006-02-12 16:20 ` Stefan Monnier
2006-02-12 22:58 ` Ralf Angeli
2006-02-13 22:10 ` Stefan Monnier
2006-02-14 7:53 ` martin rudalics
2006-02-14 19:00 ` Stefan Monnier
2006-02-14 20:13 ` martin rudalics
2006-02-14 21:08 ` Stefan Monnier
2006-02-15 10:17 ` martin rudalics
2006-02-15 10:38 ` Ralf Angeli
2006-02-15 14:20 ` martin rudalics
2006-02-15 14:56 ` Ralf Angeli
2006-02-15 16:40 ` martin rudalics
2006-02-15 17:03 ` Ralf Angeli
2006-02-16 11:10 ` Alan Mackenzie
2006-02-16 11:54 ` Vivek Dasmohapatra
2006-02-16 15:21 ` Stefan Monnier
2006-02-16 23:28 ` David Kastrup
2006-02-17 14:19 ` Stefan Monnier
2006-02-16 17:21 ` martin rudalics
2006-02-15 20:44 ` Alan Mackenzie
2006-02-16 0:40 ` Stefan Monnier
2006-02-15 20:56 ` Alan Mackenzie
2006-02-16 8:56 ` martin rudalics
2006-02-15 20:13 ` Alan Mackenzie
2006-02-16 9:02 ` martin rudalics
2006-02-14 8:18 ` Werner LEMBERG
2006-02-14 8:49 ` Ralf Angeli
2006-02-14 19:05 ` Stefan Monnier
2006-02-14 21:12 ` Ralf Angeli
2006-02-15 13:35 ` Stefan Monnier
2006-02-15 14:05 ` Ralf Angeli
2006-02-15 14:21 ` Ralf Angeli
2006-02-15 20:33 ` Alan Mackenzie
2006-02-15 21:13 ` Stefan Monnier
2006-02-15 21:59 ` Alan Mackenzie
2006-02-16 14:59 ` Kim F. Storm
2006-02-16 16:37 ` Stefan Monnier
2006-02-15 19:07 ` Alan Mackenzie
2006-02-15 21:42 ` Ralf Angeli
2006-02-16 11:20 ` Alan Mackenzie
2006-02-16 11:54 ` Ralf Angeli
2006-02-16 15:12 ` Alan Mackenzie
2006-02-17 7:56 ` martin rudalics
2006-02-17 11:32 ` Ralf Angeli
2006-02-17 13:22 ` martin rudalics
2006-02-17 13:33 ` Ralf Angeli
2006-02-16 16:32 ` Stefan Monnier
2006-02-16 0:38 ` Stefan Monnier
2006-02-16 9:51 ` Alan Mackenzie
2006-02-16 16:27 ` Stefan Monnier
2006-02-17 7:48 ` martin rudalics
2006-02-17 14:36 ` Stefan Monnier
2006-02-16 18:46 ` martin rudalics
2006-02-16 9:09 ` martin rudalics
2006-02-13 4:40 ` Richard M. Stallman
2006-02-13 5:25 ` Stefan Monnier
2006-02-14 0:39 ` Richard M. Stallman
2006-03-14 19:23 ` Alan Mackenzie
2006-03-14 22:11 ` Stefan Monnier
2006-03-15 8:52 ` martin rudalics
2006-03-15 9:02 ` Ralf Angeli
2006-03-15 10:22 ` Stefan Monnier
2006-03-15 11:40 ` Alan Mackenzie
2006-03-15 16:16 ` Stefan Monnier
2006-03-15 20:20 ` Richard Stallman
2006-03-20 8:16 ` font-lock-extend-region (was: [sigra@home.se: C++-mode: Syntax highlighting: wrong color for function identifier depending on the kind of whitespace that follows]) Stefan Monnier
2006-03-20 13:01 ` Alan Mackenzie
2006-03-20 17:18 ` font-lock-extend-region Stefan Monnier
2006-03-21 16:05 ` font-lock-extend-region Alan Mackenzie
2006-03-21 21:32 ` font-lock-extend-region Stefan Monnier
2006-03-23 15:23 ` font-lock-extend-region Alan Mackenzie
2006-03-23 16:18 ` font-lock-extend-region Stefan Monnier
2006-02-15 19:34 ` [sigra@home.se: C++-mode: Syntax highlighting: wrong color for function identifier depending on the kind of whitespace that follows] Alan Mackenzie
2006-02-16 9:07 ` Ralf Angeli
2006-02-16 9:07 ` martin rudalics
[not found] <E1CsBPC-0004xn-8P@fencepost.gnu.org>
2005-02-19 0:03 ` Martin Stjernholm
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=jwvfyz36sr9.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=acm@muc.de \
--cc=emacs-devel@gnu.org \
--cc=rms@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.
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.