Next: , Previous: , Up: Specifiers   [Contents][Index]


48.1 Introduction to Specifiers

Perhaps the most useful way to explain specifiers is via an analogy. SXEmacs Lisp programmers are used to buffer-local variables Buffer-Local Variables. For example, the variable modeline-format, which controls the format of the modeline, can have different values depending on the particular buffer being edited. The variable has a default value which most modes will use, but a specialized package such as Calendar might change the variable so as to tailor the modeline to its own purposes. Other variables are perhaps best thought of as “mode local,” such as font-lock keywords, but they are implemented as buffer locals.

Other properties (such as those that can be changed by the modify-frame-parameters function, for example the color of the text cursor) can have frame-local values, although it might also make sense for them to have buffer-local values. In other cases, you might want the property to vary depending on the particular window within the frame that applies (e.g. the top or bottom window in a split frame), the device type that that frame appears on (X or tty), etc. Perhaps you can envision some more complicated scenario where you want a particular value in a specified buffer, another value in all other buffers displayed on a particular frame, another value in all other buffers displayed in all other frames on any mono (two-color, e.g. black and white only) displays, and a default value in all other circumstances.

Specifiers generalize both buffer- and frame-local properties. Specifiers vary according to the display context. Font-lock keywords in a buffer will be the same no matter which window the buffer is displayed in, but windows on TTY devices will simply not be capable of the flexibility that windows on modern GUI devices are. Specifiers provide a way for the programmer to declare that an emphasized text should be italic on GUI devices and inverse video on TTYs. They also provide a way for the programmer to declare fallbacks, so that a color specified as “chartreuse” where possible can fall back to “yellow” on devices where only ANSI (4-bit) color is available. The complex calculations and device querying are transparent to both user and programmer. You ask for what you want; it’s up to SXEmacs to provide it, or a reasonable approximation.

We call such a declaration a specification. A specification applies in a particular locale, which is a window, buffer, frame, device, or the global locale. The value part of the specification is called an instantiator. The process of determining the value in a particular context, or domain, is called instantiation or instancing. A domain is a window, frame, or device.

The difference between locale and domain is somewhat subtle. You may think of a locale as a class of domains, which may span different devices. Since the specification is abstract (a Lisp form), you can state it without reference to a device. On the other hand, when you instantiate a specification, you must know the type of the device. It is useless to specify that “blue means emphasis” on a monochrome device. Thus instantiation requires specification of the device on which it will be rendered.

Thus a specifier allows a great deal of flexibility in controlling exactly what value a property has in which circumstances. Specifiers are most commonly used for display properties, such as an image or the foreground color of a face. As a simple example, you can specify that the foreground of the default face be

As a more complicated example, you could specify that the foreground of the default face be


Next: , Previous: , Up: Specifiers   [Contents][Index]