--- Ryan Bowman <[EMAIL PROTECTED]> wrote:

> 
> --- Stefan Monnier <[EMAIL PROTECTED]> wrote:
> 
> > > How can I change the fontification of one (or the
> > > other) to use a different face?
> > 
> > Try C-h v font-lock-syntactic-face-function.
> > 
> > 
> >         Stefan
> 
> ;; from font-lock.el
> (defvar font-lock-syntactic-face-function
>   (lambda (state)
>     (if (nth 3 state) font-lock-string-face
> font-lock-comment-face))
>   "Function to determine which face to use when
> fontifying syntactically.
> The function is called with a single parameter (the
> state as returned by
> `parse-partial-sexp' at the beginning of the region to
> highlight) and
> should return a face.")
> 
> So as I understand it
> font-lock-syntactic-face-function will return the face
> with which to highlight something: -string-face if
> it's a string, -comment-face otherwise.
> 
> Following the link to parse-partial-sexp item #7 of
> the return value looks somewhat helpful:
> 
>  7. t if in a comment of style b; symbol
> `syntax-table' if the comment
>     should be terminated by a generic comment
> delimiter.
> 
> but I don't quite understand it.  What is a comment of
> style b?  I assume that if the symbol `syntax-table'
> is returned it means that the comment must be
> terminated by the comment delimiter defined in the
> syntax table for the current mode, is that correct? 
> In Java would the latter then be '*/' and a comment of
> style b be a comment started with '//'?
> 

Apparently, I didn't follow my train of ignorance far enough.  I dug up the
syntax table chapter in the emacs lisp manual and found out what a 'b' style
comment is - in c++ (and I assume by extension, java) a b-style comment is the
line comment '//' that I was looking for.  So, I could redefine
font-lock-syntactic-face-function

(setq font-lock-syntactic-face-function
      (lambda (state)
        (if (nth 3 state) font-lock-string-face
          (if (nth 7 state) font-lock-other-comment-face
            font-lock-comment-face))))

and that should do what I want.  Though on first attempt it doesn't seem to.

----
Ryan Bowman

There is no vi there is only Emacs
----


                
__________________________________ 
Discover Yahoo! 
Find restaurants, movies, travel and more fun for the weekend. Check it out! 
http://discover.yahoo.com/weekend.html 



_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to