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

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

Re: changind the iterator environment for display.


From: Pascal J. Bourguignon
Subject: Re: changind the iterator environment for display.
Date: Mon, 02 Feb 2009 17:09:13 +0100
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.2 (gnu/linux)

"A. Soare" <address@hidden> writes:

> How can I change the color of the display iteratively?
>
> I want to display a line XXXXXXXYYYYYYYZZZZZZZUUUUUUUVVVVVVVWWWWWW
>
> The first part XXXXXXX I want to colorize using the face A
>
> The part YYYYYYYY with face B
>
> and so on.
>
> I tried so:
>
> it.base_face_id = it.face_id =  FACE_A; 
> display_string (Str1, Qnil, Qnil, 0, 0, &it, 10, 0, 0, -1);
>
> it.base_face_id = it.face_id =  FACE_B; 
> display_string (Str2, Qnil, Qnil, 0, 0, &it, 10, 0, 0, -1);
>
> it.base_face_id = it.face_id =  FACE_C; 
> display_string (Str3, Qnil, Qnil, 0, 0, &it, 10, 0, 0, -1);

WTF?


> and it does not changes the colors as I expect to. 
>
> One method would be to reset the iterator after every display, and it would 
> work.
>
> Could someone help me?

put:

  (font-lock-add-keywords
   nil 
'(("\\(XXXXXXX\\)\\(YYYYYYY\\)\\(ZZZZZZZ\\)\\(UUUUUUU\\)\\(VVVVVVV\\)\\(WWWWWW\\)"
         (1 face-a)
         (2 face-b)
         (3 face-c)
         (4 face-d)
         (5 face-e)
         (6 face-f))))

in your ~/.emacs

You may substitute XXXXXXX by a regular expression matching any XXXXXXX, etc.
(and use the name of actual faces instead of face-a, etc.

-- 
__Pascal Bourguignon__


reply via email to

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