Next: , Previous: The details, Up: Attributes

4.8.2 attr-on! vs attr-set!

Then what is the difference between attr-on! and attr-set!? attr-set! sets the attributes of a window whereas attr-on! just switches on the attribute given to it. So attr-set! fully overrides whatever attributes the window previously had and sets it to the new attribute(s). Similarly, attr-off! just switches off the attributes(s) given to it as an argument. This gives us the flexibility of managing attributes easily. But, if you use them carelessly, you may lose track of what attributes the window has and garble the display. This is especially true while managing menus with colors and highlighting. So decide on a consistent policy and stick to it. You can always use standend! which is equivalent to (attr-set! win A_NORMAL) which turns off all attributes and brings you back to normal mode.