diff options
| author | Chong Yidong | 2013-04-06 15:39:48 +0800 |
|---|---|---|
| committer | Chong Yidong | 2013-04-06 15:39:48 +0800 |
| commit | cd542620197df6fefe2c2bebca1967ec84e8fa7c (patch) | |
| tree | 566cb415c07f5a61db53d079fae5027b1591a7f3 | |
| parent | 8ead390103b65c93977dd4dee419f66316a79b96 (diff) | |
| download | emacs-cd542620197df6fefe2c2bebca1967ec84e8fa7c.tar.gz emacs-cd542620197df6fefe2c2bebca1967ec84e8fa7c.zip | |
Improve Lisp manual documentation on setting faces.
* display.texi (Faces): Minor clarifications.
(Defining Faces): Clarify default vs custom face specs. Document
face-spec-set.
* display.texi (Overlay Properties):
* text.texi (Special Properties): Use the "anonymous face"
terminology. Describe foreground-color and background-color forms
as compatibility-only.
| -rw-r--r-- | doc/lispref/ChangeLog | 11 | ||||
| -rw-r--r-- | doc/lispref/display.texi | 297 | ||||
| -rw-r--r-- | doc/lispref/text.texi | 28 |
3 files changed, 192 insertions, 144 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index dc6ebb4f35c..0bc2b0880b0 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2013-04-06 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * display.texi (Faces): Minor clarifications. | ||
| 4 | (Defining Faces): Clarify default vs custom face specs. Document | ||
| 5 | face-spec-set. | ||
| 6 | |||
| 7 | * display.texi (Overlay Properties): | ||
| 8 | * text.texi (Special Properties): Use the "anonymous face" | ||
| 9 | terminology. Describe foreground-color and background-color forms | ||
| 10 | as compatibility-only. | ||
| 11 | |||
| 1 | 2013-03-24 Eli Zaretskii <eliz@gnu.org> | 12 | 2013-03-24 Eli Zaretskii <eliz@gnu.org> |
| 2 | 13 | ||
| 3 | * compile.texi (Byte-Code Objects): Add index entry. | 14 | * compile.texi (Byte-Code Objects): Add index entry. |
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index eae6af9969d..4adcfdf8f4f 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -1510,31 +1510,31 @@ of the symbol serve as defaults for the properties of the overlay. | |||
| 1510 | 1510 | ||
| 1511 | @item face | 1511 | @item face |
| 1512 | @kindex face @r{(overlay property)} | 1512 | @kindex face @r{(overlay property)} |
| 1513 | This property controls the way text is displayed---for example, which | 1513 | This property controls the appearance of the text (@pxref{Faces}). |
| 1514 | font and which colors. @xref{Faces}, for more information. | 1514 | The value of the property can be the following: |
| 1515 | |||
| 1516 | In the simplest case, the value is a face name. It can also be a list; | ||
| 1517 | then each element can be any of these possibilities: | ||
| 1518 | 1515 | ||
| 1519 | @itemize @bullet | 1516 | @itemize @bullet |
| 1520 | @item | 1517 | @item |
| 1521 | A face name (a symbol or string). | 1518 | A face name (a symbol or string). |
| 1522 | 1519 | ||
| 1523 | @item | 1520 | @item |
| 1524 | A property list of face attributes. This has the form (@var{keyword} | 1521 | An anonymous face: a property list of the form @code{(@var{keyword} |
| 1525 | @var{value} @dots{}), where each @var{keyword} is a face attribute | 1522 | @var{value} @dots{})}, where each @var{keyword} is a face attribute |
| 1526 | name and @var{value} is a meaningful value for that attribute. With | 1523 | name and @var{value} is a value for that attribute. |
| 1527 | this feature, you do not need to create a face each time you want to | ||
| 1528 | specify a particular attribute for certain text. @xref{Face | ||
| 1529 | Attributes}. | ||
| 1530 | 1524 | ||
| 1531 | @item | 1525 | @item |
| 1532 | A cons cell, of the form @code{(foreground-color . @var{color-name})} | 1526 | A list of faces. Each list element should be either a face name or an |
| 1533 | or @code{(background-color . @var{color-name})}. These elements | 1527 | anonymous face. This specifies a face which is an aggregate of the |
| 1534 | specify just the foreground color or just the background color. | 1528 | attributes of each of the listed faces. Faces occurring earlier in |
| 1529 | the list have higher priority. | ||
| 1535 | 1530 | ||
| 1536 | @code{(foreground-color . @var{color-name})} has the same effect as | 1531 | @item |
| 1537 | @code{(:foreground @var{color-name})}; likewise for the background. | 1532 | A cons cell of the form @code{(foreground-color . @var{color-name})} |
| 1533 | or @code{(background-color . @var{color-name})}. This specifies the | ||
| 1534 | foreground or background color, similar to @code{(:foreground | ||
| 1535 | @var{color-name})} or @code{(:background @var{color-name})}. This | ||
| 1536 | form is supported for backward compatibility only, and should be | ||
| 1537 | avoided. | ||
| 1538 | @end itemize | 1538 | @end itemize |
| 1539 | 1539 | ||
| 1540 | @item mouse-face | 1540 | @item mouse-face |
| @@ -1901,44 +1901,39 @@ height. | |||
| 1901 | @section Faces | 1901 | @section Faces |
| 1902 | @cindex faces | 1902 | @cindex faces |
| 1903 | 1903 | ||
| 1904 | A @dfn{face} is a collection of graphical @dfn{attributes} for | 1904 | A @dfn{face} is a collection of graphical attributes for displaying |
| 1905 | displaying text: font, foreground color, background color, optional | 1905 | text: font, foreground color, background color, optional underlining, |
| 1906 | underlining, etc. Faces control how Emacs displays text in buffers, | 1906 | etc. Faces control how Emacs displays text in buffers, as well as |
| 1907 | as well as other parts of the frame such as the mode line. | 1907 | other parts of the frame such as the mode line. |
| 1908 | 1908 | ||
| 1909 | @cindex anonymous face | 1909 | @cindex anonymous face |
| 1910 | One way to represent a face is as a property list of attributes, | 1910 | One way to represent a face is as a property list of attributes, |
| 1911 | like @code{(:foreground "red" :weight bold)}. For example, you can | 1911 | like @code{(:foreground "red" :weight bold)}. Such a list is called |
| 1912 | assign such an @dfn{anonymous face} as the value of the @code{face} | 1912 | an @dfn{anonymous face}. For example, you can assign an anonymous |
| 1913 | text property; this causes Emacs to display the underlying text with | 1913 | face as the value of the @code{face} text property, and Emacs will |
| 1914 | the specified attributes. @xref{Special Properties}. | 1914 | display the underlying text with the specified attributes. |
| 1915 | @xref{Special Properties}. | ||
| 1915 | 1916 | ||
| 1916 | @cindex face name | 1917 | @cindex face name |
| 1917 | More commonly, a face is referred to via a @dfn{face name}: a Lisp | 1918 | More commonly, a face is referred to via a @dfn{face name}: a Lisp |
| 1918 | symbol which is associated with a set of face attributes. Named faces | 1919 | symbol associated with a set of face attributes@footnote{For backward |
| 1919 | are defined using the @code{defface} macro (@pxref{Defining Faces}). | 1920 | compatibility, you can also use a string to specify a face name; that |
| 1920 | Emacs defines several standard named faces; @xref{Standard Faces,,, | 1921 | is equivalent to a Lisp symbol with the same name.}. Named faces are |
| 1921 | emacs, The GNU Emacs Manual}. | 1922 | defined using the @code{defface} macro (@pxref{Defining Faces}). |
| 1922 | 1923 | Emacs comes with several standard named faces (@pxref{Basic Faces}). | |
| 1923 | Many parts of Emacs require named faces, and do not accept anonymous | 1924 | |
| 1924 | faces. These include the functions documented in @ref{Attribute | 1925 | Many parts of Emacs required named faces, and do not accept |
| 1925 | Functions}, and the variable @code{font-lock-keywords} | 1926 | anonymous faces. These include the functions documented in |
| 1927 | @ref{Attribute Functions}, and the variable @code{font-lock-keywords} | ||
| 1926 | (@pxref{Search-based Fontification}). Unless otherwise stated, we | 1928 | (@pxref{Search-based Fontification}). Unless otherwise stated, we |
| 1927 | will use the term @dfn{face} to refer only to named faces. | 1929 | will use the term @dfn{face} to refer only to named faces. |
| 1928 | 1930 | ||
| 1929 | For backward compatibility, you can also use a string to specify a | ||
| 1930 | face name; that is equivalent to a Lisp symbol with the same name. | ||
| 1931 | |||
| 1932 | @defun facep object | 1931 | @defun facep object |
| 1933 | This function returns a non-@code{nil} value if @var{object} is a | 1932 | This function returns a non-@code{nil} value if @var{object} is a |
| 1934 | named face: a Lisp symbol or string which serves as a face name. | 1933 | named face: a Lisp symbol or string which serves as a face name. |
| 1935 | Otherwise, it returns @code{nil}. | 1934 | Otherwise, it returns @code{nil}. |
| 1936 | @end defun | 1935 | @end defun |
| 1937 | 1936 | ||
| 1938 | By default, each face name corresponds to the same set of attributes | ||
| 1939 | in all frames. But you can also assign a face name a special set of | ||
| 1940 | attributes in one frame (@pxref{Attribute Functions}). | ||
| 1941 | |||
| 1942 | @menu | 1937 | @menu |
| 1943 | * Face Attributes:: What is in a face? | 1938 | * Face Attributes:: What is in a face? |
| 1944 | * Defining Faces:: How to define a face. | 1939 | * Defining Faces:: How to define a face. |
| @@ -2178,32 +2173,47 @@ suitable for use with @code{:stipple} (see above). It returns | |||
| 2178 | @node Defining Faces | 2173 | @node Defining Faces |
| 2179 | @subsection Defining Faces | 2174 | @subsection Defining Faces |
| 2180 | 2175 | ||
| 2176 | @cindex face spec | ||
| 2181 | The usual way to define a face is through the @code{defface} macro. | 2177 | The usual way to define a face is through the @code{defface} macro. |
| 2182 | This macro defines a face name, and associates that name with a set of | 2178 | This macro associates a face name (a symbol) with a default @dfn{face |
| 2183 | face attributes. It also sets up the face so that the user can | 2179 | spec}. A face spec is a construct which specifies what attributes a |
| 2184 | customize it via the Customize interface (@pxref{Customization}). | 2180 | face should have on any given terminal; for example, a face spec might |
| 2181 | specify one foreground color on high-color terminals, and a different | ||
| 2182 | foreground color on low-color terminals. | ||
| 2183 | |||
| 2184 | People are sometimes tempted to create a variable whose value is a | ||
| 2185 | face name. In the vast majority of cases, this is not necessary; the | ||
| 2186 | usual procedure is to define a face with @code{defface}, and then use | ||
| 2187 | its name directly. | ||
| 2185 | 2188 | ||
| 2186 | @defmac defface face spec doc [keyword value]@dots{} | 2189 | @defmac defface face spec doc [keyword value]@dots{} |
| 2187 | This macro declares @var{face} as a customizable face whose default | 2190 | This macro declares @var{face} as a named face whose default face spec |
| 2188 | attributes are given by @var{spec}. You should not quote the symbol | 2191 | is given by @var{spec}. You should not quote the symbol @var{face}, |
| 2189 | @var{face}, and it should not end in @samp{-face} (that would be | 2192 | and it should not end in @samp{-face} (that would be redundant). The |
| 2190 | redundant). The argument @var{doc} is a documentation string for the | 2193 | argument @var{doc} is a documentation string for the face. The |
| 2191 | face. The additional @var{keyword} arguments have the same meanings | 2194 | additional @var{keyword} arguments have the same meanings as in |
| 2192 | as in @code{defgroup} and @code{defcustom} (@pxref{Common Keywords}). | 2195 | @code{defgroup} and @code{defcustom} (@pxref{Common Keywords}). |
| 2193 | 2196 | ||
| 2194 | When @code{defface} executes, it defines the face according to | 2197 | If @var{face} already has a default face spec, this macro does |
| 2195 | @var{spec}, then uses any customizations that were read from the | 2198 | nothing. |
| 2196 | init file (@pxref{Init File}) to override that specification. | 2199 | |
| 2197 | 2200 | The default face spec determines @var{face}'s appearance when no | |
| 2198 | When you evaluate a @code{defface} form with @kbd{C-M-x} in Emacs | 2201 | customizations are in effect (@pxref{Customization}). If @var{face} |
| 2199 | Lisp mode (@code{eval-defun}), a special feature of @code{eval-defun} | 2202 | has already been customized (via Custom themes or via customizations |
| 2200 | overrides any customizations of the face. This way, the face reflects | 2203 | read from the init file), its appearance is determined by the custom |
| 2201 | exactly what the @code{defface} says. | 2204 | face spec(s), which override the default face spec @var{spec}. |
| 2202 | 2205 | However, if the customizations are subsequently removed, the | |
| 2203 | @cindex face specification | 2206 | appearance of @var{face} will again be determined by its default face |
| 2204 | The @var{spec} argument is a @dfn{face specification}, which states | 2207 | spec. |
| 2205 | how the face should appear on different kinds of terminals. It should | 2208 | |
| 2206 | be an alist whose elements each have the form | 2209 | As an exception, if you evaluate a @code{defface} form with |
| 2210 | @kbd{C-M-x} in Emacs Lisp mode (@code{eval-defun}), a special feature | ||
| 2211 | of @code{eval-defun} overrides any custom face specs on the face, | ||
| 2212 | causing the face to reflect exactly what the @code{defface} says. | ||
| 2213 | |||
| 2214 | The @var{spec} argument is a @dfn{face spec}, which states how the | ||
| 2215 | face should appear on different kinds of terminals. It should be an | ||
| 2216 | alist whose elements each have the form | ||
| 2207 | 2217 | ||
| 2208 | @example | 2218 | @example |
| 2209 | (@var{display} . @var{plist}) | 2219 | (@var{display} . @var{plist}) |
| @@ -2275,7 +2285,8 @@ terminal must match one of the @var{value}s specified for it in | |||
| 2275 | @end table | 2285 | @end table |
| 2276 | @end defmac | 2286 | @end defmac |
| 2277 | 2287 | ||
| 2278 | Here's how the standard face @code{highlight} is defined: | 2288 | For example, here's the definition of the standard face |
| 2289 | @code{highlight}: | ||
| 2279 | 2290 | ||
| 2280 | @example | 2291 | @example |
| 2281 | (defface highlight | 2292 | (defface highlight |
| @@ -2294,65 +2305,56 @@ terminal must match one of the @var{value}s specified for it in | |||
| 2294 | :group 'basic-faces) | 2305 | :group 'basic-faces) |
| 2295 | @end example | 2306 | @end example |
| 2296 | 2307 | ||
| 2297 | Internally, Emacs stores the face's default specification in its | 2308 | Internally, Emacs stores each face's default spec in its |
| 2298 | @code{face-defface-spec} symbol property (@pxref{Symbol Properties}). | 2309 | @code{face-defface-spec} symbol property (@pxref{Symbol Properties}). |
| 2299 | The @code{saved-face} property stores the face specification saved by | 2310 | The @code{saved-face} property stores any face spec saved by the user |
| 2300 | the user, using the customization buffer; the @code{customized-face} | 2311 | using the customization buffer; the @code{customized-face} property |
| 2301 | property stores the face specification customized for the current | 2312 | stores the face spec customized for the current session, but not |
| 2302 | session, but not saved; and the @code{theme-face} property stores an | 2313 | saved; and the @code{theme-face} property stores an alist associating |
| 2303 | alist associating the active customization settings and Custom themes | 2314 | the active customization settings and Custom themes with the face |
| 2304 | with their specifications for that face. The face's documentation | 2315 | specs for that face. The face's documentation string is stored in the |
| 2305 | string is stored in the @code{face-documentation} property. But | 2316 | @code{face-documentation} property. |
| 2306 | normally you should not try to set any of these properties directly. | 2317 | |
| 2307 | @xref{Applying Customizations}, for the @code{custom-set-faces} | 2318 | Normally, a face is declared just once, using @code{defface}, and |
| 2308 | function, which is used to apply customized face settings. | 2319 | any further changes to its appearance are applied using the Customize |
| 2309 | 2320 | framework (e.g., via the Customize user interface or via the | |
| 2310 | People are sometimes tempted to create variables whose values | 2321 | @code{custom-set-faces} function; @pxref{Applying Customizations}), or |
| 2311 | specify a face to use. In the vast majority of cases, this is not | 2322 | by face remapping (@pxref{Face Remapping}). In the rare event that |
| 2312 | necessary; it is preferable to simply use faces directly. | 2323 | you need to change a face spec directly from Lisp, you can use the |
| 2324 | @code{face-spec-set} function. | ||
| 2325 | |||
| 2326 | @defun face-spec-set face spec &optional spec-type | ||
| 2327 | This function applies @var{spec} as a face spec for @code{face}. | ||
| 2328 | @var{spec} should be a face spec, as described in the above | ||
| 2329 | documentation for @code{defface}. | ||
| 2330 | |||
| 2331 | @cindex override spec @r{(for a face)} | ||
| 2332 | The argument @var{spec-type} determines which spec to set. If it is | ||
| 2333 | @code{nil} or @code{face-override-spec}, this function sets the | ||
| 2334 | @dfn{override spec}, which overrides over all other face specs on | ||
| 2335 | @var{face}. If it is @code{face-defface-spec}, this function sets the | ||
| 2336 | default face spec (the same one set by @code{defface}). If it is | ||
| 2337 | @code{reset}, this function clears out all customization specs and | ||
| 2338 | override specs from @var{face} (in this case, the value of @var{spec} | ||
| 2339 | is ignored). Any other value of @var{spec-type} is reserved for | ||
| 2340 | internal use. | ||
| 2341 | @end defun | ||
| 2313 | 2342 | ||
| 2314 | @node Attribute Functions | 2343 | @node Attribute Functions |
| 2315 | @subsection Face Attribute Functions | 2344 | @subsection Face Attribute Functions |
| 2316 | 2345 | ||
| 2317 | This section describes the functions for accessing and modifying the | 2346 | This section describes functions for directly accessing and |
| 2318 | attributes of an existing named face. | 2347 | modifying the attributes of a named face. |
| 2319 | |||
| 2320 | @defun set-face-attribute face frame &rest arguments | ||
| 2321 | This function sets one or more attributes of @var{face} for | ||
| 2322 | @var{frame}. The attributes you specify this way override whatever | ||
| 2323 | the @code{defface} says. | ||
| 2324 | |||
| 2325 | The extra arguments @var{arguments} specify the attributes to set, and | ||
| 2326 | the values for them. They should consist of alternating attribute | ||
| 2327 | names (such as @code{:family} or @code{:underline}) and values. Thus, | ||
| 2328 | |||
| 2329 | @example | ||
| 2330 | (set-face-attribute 'foo nil | ||
| 2331 | :width 'extended | ||
| 2332 | :weight 'bold) | ||
| 2333 | @end example | ||
| 2334 | |||
| 2335 | @noindent | ||
| 2336 | sets the attribute @code{:width} to @code{extended} and the attribute | ||
| 2337 | @code{:weight} to @code{bold}. | ||
| 2338 | |||
| 2339 | If @var{frame} is @code{t}, this function sets the default attributes | ||
| 2340 | for new frames. Default attribute values specified this way override | ||
| 2341 | the @code{defface} for newly created frames. | ||
| 2342 | |||
| 2343 | If @var{frame} is @code{nil}, this function sets the attributes for | ||
| 2344 | all existing frames, and the default for new frames. | ||
| 2345 | @end defun | ||
| 2346 | 2348 | ||
| 2347 | @defun face-attribute face attribute &optional frame inherit | 2349 | @defun face-attribute face attribute &optional frame inherit |
| 2348 | This returns the value of the @var{attribute} attribute of @var{face} | 2350 | This function returns the value of the @var{attribute} attribute for |
| 2349 | on @var{frame}. If @var{frame} is @code{nil}, that means the selected | 2351 | @var{face} on @var{frame}. |
| 2350 | frame (@pxref{Input Focus}). | ||
| 2351 | 2352 | ||
| 2352 | If @var{frame} is @code{t}, this returns whatever new-frames default | 2353 | If @var{frame} is @code{nil}, that means the selected frame |
| 2353 | value you previously specified with @code{set-face-attribute} for the | 2354 | (@pxref{Input Focus}). If @var{frame} is @code{t}, this function |
| 2354 | @var{attribute} attribute of @var{face}. If you have not specified | 2355 | returns the value of the specified attribute for newly-created frames |
| 2355 | one, it returns @code{nil}. | 2356 | (this is normally @code{unspecified}, unless you have specified some |
| 2357 | value using @code{set-face-attribute}; see below). | ||
| 2356 | 2358 | ||
| 2357 | If @var{inherit} is @code{nil}, only attributes directly defined by | 2359 | If @var{inherit} is @code{nil}, only attributes directly defined by |
| 2358 | @var{face} are considered, so the return value may be | 2360 | @var{face} are considered, so the return value may be |
| @@ -2411,6 +2413,36 @@ If @var{value1} is a relative value for the face attribute | |||
| 2411 | face attribute @var{attribute}, returns @var{value1} unchanged. | 2413 | face attribute @var{attribute}, returns @var{value1} unchanged. |
| 2412 | @end defun | 2414 | @end defun |
| 2413 | 2415 | ||
| 2416 | Normally, Emacs uses the face specs of each face to automatically | ||
| 2417 | calculate its attributes on each frame (@pxref{Defining Faces}). The | ||
| 2418 | function @code{set-face-attribute} can override this calculation by | ||
| 2419 | directly assigning attributes to a face, either on a specific frame or | ||
| 2420 | for all frames. This function is mostly intended for internal usage. | ||
| 2421 | |||
| 2422 | @defun set-face-attribute face frame &rest arguments | ||
| 2423 | This function sets one or more attributes of @var{face} for | ||
| 2424 | @var{frame}. The attributes specifies in this way override the face | ||
| 2425 | spec(s) belonging to @var{face}. | ||
| 2426 | |||
| 2427 | The extra arguments @var{arguments} specify the attributes to set, and | ||
| 2428 | the values for them. They should consist of alternating attribute | ||
| 2429 | names (such as @code{:family} or @code{:underline}) and values. Thus, | ||
| 2430 | |||
| 2431 | @example | ||
| 2432 | (set-face-attribute 'foo nil :weight 'bold :slant 'italic) | ||
| 2433 | @end example | ||
| 2434 | |||
| 2435 | @noindent | ||
| 2436 | sets the attribute @code{:weight} to @code{bold} and the attribute | ||
| 2437 | @code{:slant} to @code{italic}. | ||
| 2438 | |||
| 2439 | |||
| 2440 | If @var{frame} is @code{t}, this function sets the default attributes | ||
| 2441 | for newly created frames. If @var{frame} is @code{nil}, this function | ||
| 2442 | sets the attributes for all existing frames, as well as for newly | ||
| 2443 | created frames. | ||
| 2444 | @end defun | ||
| 2445 | |||
| 2414 | The following commands and functions mostly provide compatibility | 2446 | The following commands and functions mostly provide compatibility |
| 2415 | with old versions of Emacs. They work by calling | 2447 | with old versions of Emacs. They work by calling |
| 2416 | @code{set-face-attribute}. Values of @code{t} and @code{nil} for | 2448 | @code{set-face-attribute}. Values of @code{t} and @code{nil} for |
| @@ -2457,16 +2489,17 @@ This sets the @code{:inverse-video} attribute of @var{face} to | |||
| 2457 | This swaps the foreground and background colors of face @var{face}. | 2489 | This swaps the foreground and background colors of face @var{face}. |
| 2458 | @end deffn | 2490 | @end deffn |
| 2459 | 2491 | ||
| 2460 | The following functions examine the attributes of a face. If you | 2492 | The following functions examine the attributes of a face. They |
| 2461 | don't specify @var{frame}, they refer to the selected frame; @code{t} | 2493 | mostly provide compatibility with old versions of Emacs. If you don't |
| 2462 | refers to the default data for new frames. They return the symbol | 2494 | specify @var{frame}, they refer to the selected frame; @code{t} refers |
| 2463 | @code{unspecified} if the face doesn't define any value for that | 2495 | to the default data for new frames. They return @code{unspecified} if |
| 2464 | attribute. If @var{inherit} is @code{nil}, only an attribute directly | 2496 | the face doesn't define any value for that attribute. If |
| 2465 | defined by the face is returned. If @var{inherit} is non-@code{nil}, | 2497 | @var{inherit} is @code{nil}, only an attribute directly defined by the |
| 2466 | any faces specified by its @code{:inherit} attribute are considered as | 2498 | face is returned. If @var{inherit} is non-@code{nil}, any faces |
| 2467 | well, and if @var{inherit} is a face or a list of faces, then they are | 2499 | specified by its @code{:inherit} attribute are considered as well, and |
| 2468 | also considered, until a specified attribute is found. To ensure that | 2500 | if @var{inherit} is a face or a list of faces, then they are also |
| 2469 | the return value is always specified, use a value of @code{default} for | 2501 | considered, until a specified attribute is found. To ensure that the |
| 2502 | return value is always specified, use a value of @code{default} for | ||
| 2470 | @var{inherit}. | 2503 | @var{inherit}. |
| 2471 | 2504 | ||
| 2472 | @defun face-font face &optional frame | 2505 | @defun face-font face &optional frame |
| @@ -2576,13 +2609,13 @@ The value of this variable is an alist whose elements have the form | |||
| 2576 | any text having the face @var{face} with @var{remapping}, rather than | 2609 | any text having the face @var{face} with @var{remapping}, rather than |
| 2577 | the ordinary definition of @var{face}. | 2610 | the ordinary definition of @var{face}. |
| 2578 | 2611 | ||
| 2579 | @var{remapping} may be any face specification suitable for a | 2612 | @var{remapping} may be any face spec suitable for a @code{face} text |
| 2580 | @code{face} text property: either a face (i.e., a face name or a | 2613 | property: either a face (i.e., a face name or a property list of |
| 2581 | property list of attribute/value pairs), or a list of faces. For | 2614 | attribute/value pairs), or a list of faces. For details, see the |
| 2582 | details, see the description of the @code{face} text property in | 2615 | description of the @code{face} text property in @ref{Special |
| 2583 | @ref{Special Properties}. @var{remapping} serves as the complete | 2616 | Properties}. @var{remapping} serves as the complete specification for |
| 2584 | specification for the remapped face---it replaces the normal | 2617 | the remapped face---it replaces the normal definition of @var{face}, |
| 2585 | definition of @var{face}, instead of modifying it. | 2618 | instead of modifying it. |
| 2586 | 2619 | ||
| 2587 | If @code{face-remapping-alist} is buffer-local, its local value takes | 2620 | If @code{face-remapping-alist} is buffer-local, its local value takes |
| 2588 | effect only within that buffer. | 2621 | effect only within that buffer. |
| @@ -2629,7 +2662,7 @@ and @code{face-remap-reset-base} functions; it is intended for major | |||
| 2629 | modes to remap faces in the buffers they control. | 2662 | modes to remap faces in the buffers they control. |
| 2630 | 2663 | ||
| 2631 | @defun face-remap-add-relative face &rest specs | 2664 | @defun face-remap-add-relative face &rest specs |
| 2632 | This functions adds the face specifications in @var{specs} as relative | 2665 | This functions adds the face spec in @var{specs} as relative |
| 2633 | remappings for face @var{face} in the current buffer. The remaining | 2666 | remappings for face @var{face} in the current buffer. The remaining |
| 2634 | arguments, @var{specs}, should form either a list of face names, or a | 2667 | arguments, @var{specs}, should form either a list of face names, or a |
| 2635 | property list of attribute/value pairs. | 2668 | property list of attribute/value pairs. |
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index c6cbfa5b3f8..6d5a39d887a 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi | |||
| @@ -3008,27 +3008,31 @@ character. | |||
| 3008 | @item face | 3008 | @item face |
| 3009 | @cindex face codes of text | 3009 | @cindex face codes of text |
| 3010 | @kindex face @r{(text property)} | 3010 | @kindex face @r{(text property)} |
| 3011 | The @code{face} property controls the appearance of the character, | 3011 | The @code{face} property controls the appearance of the character |
| 3012 | such as its font and color. @xref{Faces}. The value of the property | 3012 | (@pxref{Faces}). The value of the property can be the following: |
| 3013 | can be the following: | ||
| 3014 | 3013 | ||
| 3015 | @itemize @bullet | 3014 | @itemize @bullet |
| 3016 | @item | 3015 | @item |
| 3017 | A face name (a symbol or string). | 3016 | A face name (a symbol or string). |
| 3018 | 3017 | ||
| 3019 | @item | 3018 | @item |
| 3020 | A property list of face attributes. This has the form (@var{keyword} | 3019 | An anonymous face: a property list of the form @code{(@var{keyword} |
| 3021 | @var{value} @dots{}), where each @var{keyword} is a face attribute | 3020 | @var{value} @dots{})}, where each @var{keyword} is a face attribute |
| 3022 | name and @var{value} is a meaningful value for that attribute. With | 3021 | name and @var{value} is a value for that attribute. |
| 3023 | this feature, you do not need to create a face each time you want to | ||
| 3024 | specify a particular attribute for certain text. | ||
| 3025 | 3022 | ||
| 3026 | @item | 3023 | @item |
| 3027 | A list of faces. This specifies a face which is an aggregate of the | 3024 | A list of faces. Each list element should be either a face name or an |
| 3025 | anonymous face. This specifies a face which is an aggregate of the | ||
| 3028 | attributes of each of the listed faces. Faces occurring earlier in | 3026 | attributes of each of the listed faces. Faces occurring earlier in |
| 3029 | the list have higher priority. Each list element must have one of the | 3027 | the list have higher priority. |
| 3030 | two above forms (i.e., either a face name or a property list of face | 3028 | |
| 3031 | attributes). | 3029 | @item |
| 3030 | A cons cell of the form @code{(foreground-color . @var{color-name})} | ||
| 3031 | or @code{(background-color . @var{color-name})}. This specifies the | ||
| 3032 | foreground or background color, similar to @code{(:foreground | ||
| 3033 | @var{color-name})} or @code{(:background @var{color-name})}. This | ||
| 3034 | form is supported for backward compatibility only, and should be | ||
| 3035 | avoided. | ||
| 3032 | @end itemize | 3036 | @end itemize |
| 3033 | 3037 | ||
| 3034 | Font Lock mode (@pxref{Font Lock Mode}) works in most buffers by | 3038 | Font Lock mode (@pxref{Font Lock Mode}) works in most buffers by |