[Top][All Lists]

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

Re: Faces don't work in overlays

From: Pascal Wassong
Subject: Re: Faces don't work in overlays
Date: 18 Jul 2001 01:13:47 -0700

"Stefan Monnier" <monnier+gnu.emacs.bug/news/@RUM.cs.yale.edu> wrote:

> Anyway, using my crystal ball, I suspect that the face is correctly
> applied to the text between arg and arg+1 but that you'd like it to apply
> to the after-string instead.  If so, then you want to do
>    (let ((ol (make-overlay arg (1+ arg)))
>          (str "some text"))
>      (put-text-property 0 (length str) 'face 'font-lock-comment-face str)
>      (overlay-put ol 'after-string str))

In my first attempts, the text was always in the default face (I
probably messed things up).  By default face, I mean black on white,
like if I had not changed the face property.

Now I am able to have the text (the character between arg and arg+1
and the after-string) in the comment face.  The character where I add
the overlay is a `}' in a C, C++ or java file.

But I only want the after-string to be in the font-lock-comment-face.

The above code doesn't give the correct result : all the text is in
the default face.  Like if put-text-property was completely ommited.

Thank you for the help,
Pascal Wassong

reply via email to

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