From: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org, bug-cc-mode@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 08:00:42 +0000 (GMT) [thread overview]
Message-ID: <Pine.LNX.3.96.1050310065836.284A-100000@acm.acm> (raw)
In-Reply-To: <jwvpsy8sbcm.fsf-monnier+emacs@gnu.org>
Hi, Stefan.
On Wed, 9 Mar 2005, Stefan Monnier wrote:
>> [The discussion is about a font-locking problem reported in CC Mode: The
>> user types the start of a C function, but puts a NL in the middle:
>> void function
>> (int x);
>> The second line gets incorrectly fontified, because in its
>> after-change-functions, font-lock considers only that line in and of
>> itself.]
>[...]
>> However: I did complain about this shortcoming of font-lock on
>> gnu.emacs.bug way back, on Friday 10th May 2002 (Subject: Font-lock:
>> Major mode should be able to specify region to fontify. Message-Id:
>> <r77hba.r5.ln@acm.acm>), and that post of mine contained a patch to add
>> the facility to font-lock. Nobody apart from Kim Storm (who objected
>> (quite reasonably) to the prolix function names I'd used) responded to
>> the post at the time, and nothing happened. That's when I decided that
>> advising font-lock was the least bad way of solving the problem.
>Hmm... I can't remember such a post and I have a hard time imagining why
>I wouldn't have jumped on it.
We talked about it in bug-cc-mode just after CC Mode 5.30 had been
released. (Subject: Advising in cc-awk.el and namespace Date: Wed, 09
Jul 2003 13:20:20 -0400). I drew attention then (Jul 2003) to the patch
I had submitted in 2002, which you acknowledged. However, the topic of
conversation drifted onto why jit-lock consumed so much processor power.
>Could you explain some more about your two cases (the one in awk and the
>one in the subject of this article):
>- how do they use your new before-font-lock-after-change-function hook?
The one in AWK is with a string like this:
print "multi-l\
ine\
string
^
|
point
The opening quote has been given warning font, since it is an unmated
quote. When the closing quote is typed, the opening quote's face gets
changed to string face. This is done by the advice on
font-lock-after-change-function (or the jit-lock thingy ...) amending the
BEGIN parameter to point to the start of the "print" line, before passing
this into font-lock.
The C example at the top is essentially the same; the single line
containing "(int x);" currently gets fontified by after-change in
isolation; correct fontification requires that it be fontified with the
previous line as a unit.
The patch I proposed would achieve this result via a user supplied
function.
>- why can't they use the font-lock-multiline property?
I couldn't find any documentation for the facility back in 2002, and I
couldn't figure out from the source code exactly what it did. I've now
got it working for me in Texinfo mode, though.
Also, font-lock-multiline doesn't (yet?) exist in XEmacs, so I'd need to
implement a second solution for XEmacs if f-l-multiline was used. CC
Mode still supports Emacs 20.x, and I think I found that f-l-multiline
was introduced later than 20.1 (though I can't remember exactly).
>- why can't they use the jit-lock-defer-multiline property?
I'll have to look at that one. But presumably that doesn't exist in both
of XEmacs and Emacs 20.x either.
>This will allow us the better judge which is the better course of
>action. Using advice on font-lock functions from awk-mode is pretty
>ugly, so it's important we come up with a better way to solve this
>issue.
Agreed on all points. I think, as I have done since 2002, that the
major-mode should be able to supply functions to determine the start and
end of the region to be fontified. It seems a natural and idiomatic
Emacsy way of doing things.
Even so, it would be several years before major modes could start using
it in earnest, due to the need to continue supporting older Emacs
versions. (CC Mode 5.30 gave up support for 19.34 by starting to use
text properties.) How long is it going to be before 22.1 becomes the
oldest Emacs version supported by a major mode?
> Stefan
--
Alan Mackenzie (Munich, Germany)
-------------------------------------------------------
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 8:00 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 [this message]
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
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=Pine.LNX.3.96.1050310065836.284A-100000@acm.acm \
--to=acm@muc.de \
--cc=bug-cc-mode@gnu.org \
--cc=emacs-devel@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.