help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble fontifying /** ... */


From: Alan Mackenzie
Subject: Re: Trouble fontifying /** ... */
Date: Tue, 27 Jan 2009 09:19:08 +0000
User-agent: Mutt/1.5.9i

'Evening, Davin!

On Tue, Jan 27, 2009 at 03:04:58PM +1300, Davin Pearson wrote:
> 2009/1/27 Alan Mackenzie <address@hidden>:
> > "/*****..... " (minimum 2 stars) might look a bit like:
> > "/\\*\\*+"
> >

> The following Elisp code only matches a single line comment
> 
>      ("/\\*\\*+.*\\*/" 0 'font-lock-doc-face t)
                                               ^
                                               |

> and erroneously fontifies

>        a = "/** foo */";

> in font-lock-doc-face when it should be font-lock-string-face.

Ah!  I see it now.  The last element of that list, t, is the OVERRIDE
parameter which means "apply this fontification even if this piece of
buffer has already been fontified" (See page "Search-based
Fontification" in the Elisp manual).  Of course, the string had already
been fontified with font-lock-string-face before that got overridden.

So, you asked for it, you got it!

If that t kind of sneaked in by accident while you weren't watching,
just take it out.  If it was put there for a reason, well, you'll have
to jiggle things around, somehow - change the order of the elements in
font-lock-keywords, something like that.  There'll be some way of making
it work, just like there's always a way of pressing the wallpaper flat
without the bubble of paste oozing up somewhere else.  ;-)

> -------------------------------------------------------------------

> Click below for my Elisp code: (please note that I have updated the code)

> http://h1.ripway.com/davin/sjs.el

> Click below for a program fragment:

> http://h1.ripway.com/davin/a.sjs

Just as an aside, it's very helpful, really enourmously helpful, for
there to be a code fragment (as concise as possible, like the one above)
and relevant bits of Elisp (again concise, like the one above) actually
in the post in the mailing list.  It encourages people to answer your
post rather than getting another cup of coffee.  Downloading these from
a URL is more of a drag than you'd believe.  ;-)

> Sincerely and kindest regards, Davin.
> Davin Pearson    http://www.davinpearson.com

And all the best to yourself, too!  Hope you get it sorted out.

-- 
Alan Mackenzie (Nuremberg, Germany).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]