aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2012-09-18 13:14:42 +0800
committerChong Yidong2012-09-18 13:14:42 +0800
commited1f0bd388e83e5ee065f7dde0f52bbfe9031933 (patch)
tree7b0251ea23f7191194f5f0739ae43975e56c3db6
parenta11035b8cd0ef80bc118cc97be53373b36475da0 (diff)
downloademacs-ed1f0bd388e83e5ee065f7dde0f52bbfe9031933.tar.gz
emacs-ed1f0bd388e83e5ee065f7dde0f52bbfe9031933.zip
Doc fixes for defface and friends.
* lisp/cus-edit.el (custom-unlispify-remove-prefixes): Add warning. * lisp/custom.el (defface): Doc fix. * doc/lispref/customize.texi (Customization): Define customization more carefully. (Common Keywords): Add xref to Constant Variables. * doc/lispref/display.texi (Faces): Discuss anonymous faces. (Face Attributes): Tweak intro. (Defining Faces): Move after the Face Attributes node. Copyedits. (Displaying Faces): Describe role of inheritance. * doc/lispref/variables.texi (Defining Variables): Link to defcustom's node instead of the higher-level Customization chapter. Fixes: debbugs:11440
-rw-r--r--doc/lispref/ChangeLog14
-rw-r--r--doc/lispref/customize.texi73
-rw-r--r--doc/lispref/display.texi376
-rw-r--r--doc/lispref/elisp.texi2
-rw-r--r--doc/lispref/text.texi11
-rw-r--r--doc/lispref/variables.texi3
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/cus-edit.el5
-rw-r--r--lisp/custom.el110
9 files changed, 331 insertions, 269 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index ce99c81a912..329c194f45a 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,17 @@
12012-09-18 Chong Yidong <cyd@gnu.org>
2
3 * display.texi (Faces): Discuss anonymous faces.
4 (Face Attributes): Tweak intro.
5 (Defining Faces): Move after the Face Attributes node. Copyedits.
6 (Displaying Faces): Describe role of inheritance.
7
8 * customize.texi (Customization): Define customization more
9 carefully (Bug#11440).
10 (Common Keywords): Add xref to Constant Variables.
11
12 * variables.texi (Defining Variables): Link to defcustom's node
13 instead of the higher-level Customization chapter.
14
12012-09-11 Paul Eggert <eggert@cs.ucla.edu> 152012-09-11 Paul Eggert <eggert@cs.ucla.edu>
2 16
3 Simplify, document, and port floating-point (Bug#12381). 17 Simplify, document, and port floating-point (Bug#12381).
diff --git a/doc/lispref/customize.texi b/doc/lispref/customize.texi
index 38dfc949264..c9d22851ed2 100644
--- a/doc/lispref/customize.texi
+++ b/doc/lispref/customize.texi
@@ -6,13 +6,30 @@
6@chapter Customization Settings 6@chapter Customization Settings
7 7
8@cindex customization item 8@cindex customization item
9 This chapter describes how to declare customizable variables and 9 Users of Emacs can customize variables and faces without writing
10customization groups for classifying them. We use the term 10Lisp code, by using the Customize interface. @xref{Easy
11@dfn{customization item} to include customizable variables, 11Customization,,, emacs, The GNU Emacs Manual}. This chapter describes
12customization groups, as well as faces. 12how to define @dfn{customization items} that users can interact with
13 13through the Customize interface.
14 @xref{Defining Faces}, for the @code{defface} macro, which is used 14
15for declaring customizable faces. 15 Customization items include customizable variables, which are
16defined with the
17@ifinfo
18@code{defcustom} macro (@pxref{Variable Definitions});
19@end ifinfo
20@ifnotinfo
21@code{defcustom} macro;
22@end ifnotinfo
23customizable faces, which are defined with @code{defface} (described
24separately in @ref{Defining Faces}); and @dfn{customization groups},
25defined with
26@ifinfo
27@code{defgroup} (@pxref{Group Definitions}),
28@end ifinfo
29@ifnotinfo
30@code{defgroup},
31@end ifnotinfo
32which act as containers for groups of related customization items.
16 33
17@menu 34@menu
18* Common Keywords:: Common keyword arguments for all kinds of 35* Common Keywords:: Common keyword arguments for all kinds of
@@ -29,9 +46,10 @@ for declaring customizable faces.
29 46
30@cindex customization keywords 47@cindex customization keywords
31 The customization declarations that we will describe in the next few 48 The customization declarations that we will describe in the next few
32sections (@code{defcustom}, @code{defgroup}, etc.) all accept keyword 49sections---@code{defcustom}, @code{defgroup}, etc.---all accept
33arguments for specifying various information. This section describes 50keyword arguments (@pxref{Constant Variables}) for specifying various
34keywords that apply to all types of customization declarations. 51information. This section describes keywords that apply to all types
52of customization declarations.
35 53
36 All of these keywords, except @code{:tag}, can be used more than once 54 All of these keywords, except @code{:tag}, can be used more than once
37in a given item. Each use of the keyword has an independent effect. 55in a given item. Each use of the keyword has an independent effect.
@@ -188,14 +206,14 @@ choice is the official name of the package, such as MH-E or Gnus.
188@cindex define customization group 206@cindex define customization group
189@cindex customization groups, defining 207@cindex customization groups, defining
190 208
191 Each Emacs Lisp package should have one main customization group which 209 Each Emacs Lisp package should have one main customization group
192contains all the options, faces and other groups in the package. If the 210which contains all the options, faces and other groups in the package.
193package has a small number of options and faces, use just one group and 211If the package has a small number of options and faces, use just one
194put everything in it. When there are more than twelve or so options and 212group and put everything in it. When there are more than twenty or so
195faces, then you should structure them into subgroups, and put the 213options and faces, then you should structure them into subgroups, and
196subgroups under the package's main customization group. It is OK to 214put the subgroups under the package's main customization group. It is
197put some of the options and faces in the package's main group alongside 215OK to put some of the options and faces in the package's main group
198the subgroups. 216alongside the subgroups.
199 217
200 The package's main or only group should be a member of one or more of 218 The package's main or only group should be a member of one or more of
201the standard customization groups. (To display the full list of them, 219the standard customization groups. (To display the full list of them,
@@ -251,7 +269,17 @@ confusing names for options and faces.
251@node Variable Definitions 269@node Variable Definitions
252@section Defining Customization Variables 270@section Defining Customization Variables
253@cindex define customization options 271@cindex define customization options
254@cindex customization variables, how to define 272@cindex customizable variables, how to define
273@cindex user options, how to define
274
275 @dfn{Customizable variables}, also called @dfn{user options}, are
276global Lisp variables whose values can be set through the Customize
277interface. Unlike other global variables, which are defined with
278@code{defvar} (@pxref{Defining Variables}), customizable variables are
279defined using the @code{defcustom} macro. In addition to calling
280@code{defvar} as a subroutine, @code{defcustom} states how the
281variable should be displayed in the Customize interface, the values it
282is allowed to take, etc.
255 283
256@defmac defcustom option standard doc [keyword value]@dots{} 284@defmac defcustom option standard doc [keyword value]@dots{}
257This macro declares @var{option} as a user option (i.e.@: a 285This macro declares @var{option} as a user option (i.e.@: a
@@ -291,13 +319,14 @@ has not been assigned the right value yet. In that case, use
291standard value after Emacs starts up. 319standard value after Emacs starts up.
292@end defmac 320@end defmac
293 321
294 @code{defcustom} accepts the following additional keywords: 322 In addition to the keywords listed in @ref{Common Keywords}, this
323macro accepts the following keywords:
295 324
296@table @code 325@table @code
297@item :type @var{type} 326@item :type @var{type}
298Use @var{type} as the data type for this option. It specifies which 327Use @var{type} as the data type for this option. It specifies which
299values are legitimate, and how to display the value. 328values are legitimate, and how to display the value
300@xref{Customization Types}, for more information. 329(@pxref{Customization Types}).
301 330
302@item :options @var{value-list} 331@item :options @var{value-list}
303@kindex options@r{, @code{defcustom} keyword} 332@kindex options@r{, @code{defcustom} keyword}
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 64aa891e56b..11a86f3c1c5 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -1863,20 +1863,36 @@ height.
1863 1863
1864 A @dfn{face} is a collection of graphical @dfn{attributes} for 1864 A @dfn{face} is a collection of graphical @dfn{attributes} for
1865displaying text: font, foreground color, background color, optional 1865displaying text: font, foreground color, background color, optional
1866underlining, and so on. Faces control how Emacs displays text in 1866underlining, etc. Faces control how Emacs displays text in buffers,
1867buffers, as well as other parts of the frame such as the mode line. 1867as well as other parts of the frame such as the mode line.
1868@xref{Standard Faces,,, emacs, The GNU Emacs Manual}, for the list of 1868
1869faces Emacs normally comes with. 1869@cindex anonymous face
1870 1870 One way to represent a face is as a property list of attributes,
1871@cindex face id 1871like @code{(:foreground "red" :weight bold)}. For example, you can
1872 For most purposes, you refer to a face in Lisp programs using its 1872assign such an @dfn{anonymous face} as the value of the @code{face}
1873@dfn{face name}, which is usually a Lisp symbol. For backward 1873text property; this causes Emacs to display the underlying text with
1874compatibility, a face name can also be a string, which is equivalent 1874the specified attributes. @xref{Special Properties}.
1875to a Lisp symbol of the same name. 1875
1876@cindex face name
1877 More commonly, a face is referred to via a @dfn{face name}: a Lisp
1878symbol which is associated with a set of face attributes. Named faces
1879are defined using the @code{defface} macro (@pxref{Defining Faces}).
1880Emacs defines several standard named faces; @xref{Standard Faces,,,
1881emacs, The GNU Emacs Manual}.
1882
1883 Many parts of Emacs require named faces, and do not accept anonymous
1884faces. These include the functions documented in @ref{Attribute
1885Functions}, and the variable @code{font-lock-keywords}
1886(@pxref{Search-based Fontification}). Unless otherwise stated, we
1887will use the term @dfn{face} to refer only to named faces.
1888
1889 For backward compatibility, you can also use a string to specify a
1890face name; that is equivalent to a Lisp symbol with the same name.
1876 1891
1877@defun facep object 1892@defun facep object
1878This function returns a non-@code{nil} value if @var{object} is a Lisp 1893This function returns a non-@code{nil} value if @var{object} is a
1879symbol or string that names a face. Otherwise, it returns @code{nil}. 1894named face: a Lisp symbol or string which serves as a face name.
1895Otherwise, it returns @code{nil}.
1880@end defun 1896@end defun
1881 1897
1882 By default, each face name corresponds to the same set of attributes 1898 By default, each face name corresponds to the same set of attributes
@@ -1884,8 +1900,8 @@ in all frames. But you can also assign a face name a special set of
1884attributes in one frame (@pxref{Attribute Functions}). 1900attributes in one frame (@pxref{Attribute Functions}).
1885 1901
1886@menu 1902@menu
1887* Defining Faces:: How to define a face.
1888* Face Attributes:: What is in a face? 1903* Face Attributes:: What is in a face?
1904* Defining Faces:: How to define a face.
1889* Attribute Functions:: Functions to examine and set face attributes. 1905* Attribute Functions:: Functions to examine and set face attributes.
1890* Displaying Faces:: How Emacs combines the faces specified for a character. 1906* Displaying Faces:: How Emacs combines the faces specified for a character.
1891* Face Remapping:: Remapping faces to alternative definitions. 1907* Face Remapping:: Remapping faces to alternative definitions.
@@ -1900,161 +1916,21 @@ attributes in one frame (@pxref{Attribute Functions}).
1900* Low-Level Font:: Lisp representation for character display fonts. 1916* Low-Level Font:: Lisp representation for character display fonts.
1901@end menu 1917@end menu
1902 1918
1903@node Defining Faces
1904@subsection Defining Faces
1905
1906 The @code{defface} macro defines a face and specifies its default
1907appearance. The user can subsequently customize the face using the
1908Customize interface (@pxref{Customization}).
1909
1910@defmac defface face spec doc [keyword value]@dots{}
1911This macro declares @var{face} as a customizable face whose default
1912attributes are given by @var{spec}. You should not quote the symbol
1913@var{face}, and it should not end in @samp{-face} (that would be
1914redundant). The argument @var{doc} is a documentation string for the
1915face. The additional @var{keyword} arguments have the same meanings
1916as in @code{defgroup} and @code{defcustom} (@pxref{Common Keywords}).
1917
1918When @code{defface} executes, it defines the face according to
1919@var{spec}, then uses any customizations that were read from the
1920init file (@pxref{Init File}) to override that specification.
1921
1922When you evaluate a @code{defface} form with @kbd{C-M-x} in Emacs
1923Lisp mode (@code{eval-defun}), a special feature of @code{eval-defun}
1924overrides any customizations of the face. This way, the face reflects
1925exactly what the @code{defface} says.
1926
1927@cindex face specification
1928The @var{spec} argument is a @dfn{face specification}, which states
1929how the face should appear on different kinds of terminals. It should
1930be an alist whose elements each have the form
1931
1932@example
1933(@var{display} . @var{plist})
1934@end example
1935
1936@noindent
1937@var{display} specifies a class of terminals (see below), while
1938@var{plist} is a property list of face attributes and their values,
1939specifying how the face appears on such terminals
1940@iftex
1941(see the next section for details about face attributes).
1942@end iftex
1943@ifnottex
1944(@pxref{Face Attributes}, for details about face attributes).
1945@end ifnottex
1946
1947The @var{display} part of an element of @var{spec} determines which
1948frames the element matches. If more than one element of @var{spec}
1949matches a given frame, the first element that matches is the one used
1950for that frame. There are three possibilities for @var{display}:
1951
1952@table @asis
1953@item @code{default}
1954This element of @var{spec} doesn't match any frames; instead, it
1955specifies defaults that apply to all frames. This element, if used,
1956must be the first element of @var{spec}. Each of the following
1957elements can override any or all of these defaults.
1958
1959@item @code{t}
1960This element of @var{spec} matches all frames. Therefore, any
1961subsequent elements of @var{spec} are never used. Normally
1962@code{t} is used in the last (or only) element of @var{spec}.
1963
1964@item a list
1965If @var{display} is a list, each element should have the form
1966@code{(@var{characteristic} @var{value}@dots{})}. Here
1967@var{characteristic} specifies a way of classifying frames, and the
1968@var{value}s are possible classifications which @var{display} should
1969apply to. Here are the possible values of @var{characteristic}:
1970
1971@table @code
1972@item type
1973The kind of window system the frame uses---either @code{graphic} (any
1974graphics-capable display), @code{x}, @code{pc} (for the MS-DOS console),
1975@code{w32} (for MS Windows 9X/NT/2K/XP), or @code{tty}
1976(a non-graphics-capable display).
1977@xref{Window Systems, window-system}.
1978
1979@item class
1980What kinds of colors the frame supports---either @code{color},
1981@code{grayscale}, or @code{mono}.
1982
1983@item background
1984The kind of background---either @code{light} or @code{dark}.
1985
1986@item min-colors
1987An integer that represents the minimum number of colors the frame
1988should support. This matches a frame if its
1989@code{display-color-cells} value is at least the specified integer.
1990
1991@item supports
1992Whether or not the frame can display the face attributes given in
1993@var{value}@dots{} (@pxref{Face Attributes}). @xref{Display Face
1994Attribute Testing}, for more information on exactly how this testing
1995is done.
1996@end table
1997
1998If an element of @var{display} specifies more than one @var{value} for a
1999given @var{characteristic}, any of those values is acceptable. If
2000@var{display} has more than one element, each element should specify a
2001different @var{characteristic}; then @emph{each} characteristic of the
2002frame must match one of the @var{value}s specified for it in
2003@var{display}.
2004@end table
2005@end defmac
2006
2007 Here's how the standard face @code{highlight} is defined:
2008
2009@example
2010(defface highlight
2011 '((((class color) (min-colors 88) (background light))
2012 :background "darkseagreen2")
2013 (((class color) (min-colors 88) (background dark))
2014 :background "darkolivegreen")
2015 (((class color) (min-colors 16) (background light))
2016 :background "darkseagreen2")
2017 (((class color) (min-colors 16) (background dark))
2018 :background "darkolivegreen")
2019 (((class color) (min-colors 8))
2020 :background "green" :foreground "black")
2021 (t :inverse-video t))
2022 "Basic face for highlighting."
2023 :group 'basic-faces)
2024@end example
2025
2026 Internally, Emacs stores the face's default specification in its
2027@code{face-defface-spec} symbol property (@pxref{Property Lists}).
2028The @code{saved-face} property stores the face specification saved by
2029the user, using the customization buffer; the @code{customized-face}
2030property stores the face specification customized for the current
2031session, but not saved; and the @code{theme-face} property stores an
2032alist associating the active customization settings and Custom themes
2033with their specifications for that face. The face's documentation
2034string is stored in the @code{face-documentation} property. But
2035normally you should not try to set any of these properties directly.
2036@xref{Applying Customizations}, for the @code{custom-set-faces}
2037function, which is used to apply customized face settings.
2038
2039 People are sometimes tempted to create variables whose values
2040specify a face to use. In the vast majority of cases, this is not
2041necessary; it is preferable to simply use faces directly.
2042
2043@node Face Attributes 1919@node Face Attributes
2044@subsection Face Attributes 1920@subsection Face Attributes
2045@cindex face attributes 1921@cindex face attributes
2046 1922
2047 The effect of using a face is determined by a fixed set of @dfn{face 1923 @dfn{Face attributes} determine the visual appearance of a face.
2048attributes}. This table lists all the face attributes, their possible 1924The following table lists all the face attributes, their possible
2049values, and their effects. You can specify more than one face for a 1925values, and their effects.
2050given piece of text; Emacs merges the attributes of all the faces to
2051determine how to display the text. @xref{Displaying Faces}.
2052 1926
2053 In addition to the values given below, each face attribute can also 1927 Apart from the values given below, each face attribute can have the
2054have the value @code{unspecified}. This special value means the face 1928value @code{unspecified}. This special value means that the face
2055doesn't specify that attribute. In face merging, when the first face 1929doesn't specify that attribute directly. An @code{unspecified}
2056fails to specify a particular attribute, the next face gets a chance. 1930attribute tells Emacs to refer instead to a parent face (see the
2057However, the @code{default} face must specify all attributes. 1931description @code{:inherit} attribute below); or, failing that, to an
1932underlying face (@pxref{Displaying Faces}). The @code{default} face
1933must specify all attributes.
2058 1934
2059 Some of these attributes are meaningful only on certain kinds of 1935 Some of these attributes are meaningful only on certain kinds of
2060displays. If your display cannot handle a certain attribute, the 1936displays. If your display cannot handle a certain attribute, the
@@ -2063,7 +1939,7 @@ attribute is ignored.
2063@table @code 1939@table @code
2064@item :family 1940@item :family
2065Font family or fontset (a string). @xref{Fonts,,, emacs, The GNU 1941Font family or fontset (a string). @xref{Fonts,,, emacs, The GNU
2066Emacs Manual}, for more information about font families; the function 1942Emacs Manual}, for more information about font families. The function
2067@code{font-family-list} (see below) returns a list of available family 1943@code{font-family-list} (see below) returns a list of available family
2068names. @xref{Fontsets}, for information about fontsets. 1944names. @xref{Fontsets}, for information about fontsets.
2069 1945
@@ -2083,9 +1959,8 @@ The height of the font. In the simplest case, this is an integer in
2083units of 1/10 point. 1959units of 1/10 point.
2084 1960
2085The value can also be a floating point number or a function, which 1961The value can also be a floating point number or a function, which
2086specifies the height relative to an @dfn{underlying face} (i.e., a 1962specifies the height relative to an @dfn{underlying face}
2087face that has a lower priority in the list described in 1963(@pxref{Displaying Faces}). If the value is a floating point number,
2088@ref{Displaying Faces}). If the value is a floating point number,
2089that specifies the amount by which to scale the height of the 1964that specifies the amount by which to scale the height of the
2090underlying face. If the value is a function, that function is called 1965underlying face. If the value is a function, that function is called
2091with one argument, the height of the underlying face, and returns the 1966with one argument, the height of the underlying face, and returns the
@@ -2261,11 +2136,147 @@ suitable for use with @code{:stipple} (see above). It returns
2261@code{nil} otherwise. 2136@code{nil} otherwise.
2262@end defun 2137@end defun
2263 2138
2139@node Defining Faces
2140@subsection Defining Faces
2141
2142 The usual way to define a face is through the @code{defface} macro.
2143This macro defines a face name, and associates that name with a set of
2144face attributes. It also sets up the face so that the user can
2145customize it via the Customize interface (@pxref{Customization}).
2146
2147@defmac defface face spec doc [keyword value]@dots{}
2148This macro declares @var{face} as a customizable face whose default
2149attributes are given by @var{spec}. You should not quote the symbol
2150@var{face}, and it should not end in @samp{-face} (that would be
2151redundant). The argument @var{doc} is a documentation string for the
2152face. The additional @var{keyword} arguments have the same meanings
2153as in @code{defgroup} and @code{defcustom} (@pxref{Common Keywords}).
2154
2155When @code{defface} executes, it defines the face according to
2156@var{spec}, then uses any customizations that were read from the
2157init file (@pxref{Init File}) to override that specification.
2158
2159When you evaluate a @code{defface} form with @kbd{C-M-x} in Emacs
2160Lisp mode (@code{eval-defun}), a special feature of @code{eval-defun}
2161overrides any customizations of the face. This way, the face reflects
2162exactly what the @code{defface} says.
2163
2164@cindex face specification
2165The @var{spec} argument is a @dfn{face specification}, which states
2166how the face should appear on different kinds of terminals. It should
2167be an alist whose elements each have the form
2168
2169@example
2170(@var{display} . @var{plist})
2171@end example
2172
2173@noindent
2174@var{display} specifies a class of terminals (see below). @var{plist}
2175is a property list of face attributes and their values, specifying how
2176the face appears on such terminals. For backward compatibility, you
2177can also write an element as @code{(@var{display} @var{plist})}.
2178
2179The @var{display} part of an element of @var{spec} determines which
2180terminals the element matches. If more than one element of @var{spec}
2181matches a given terminal, the first element that matches is the one
2182used for that terminal. There are three possibilities for
2183@var{display}:
2184
2185@table @asis
2186@item @code{default}
2187This element of @var{spec} doesn't match any terminal; instead, it
2188specifies defaults that apply to all terminals. This element, if
2189used, must be the first element of @var{spec}. Each of the following
2190elements can override any or all of these defaults.
2191
2192@item @code{t}
2193This element of @var{spec} matches all terminals. Therefore, any
2194subsequent elements of @var{spec} are never used. Normally @code{t}
2195is used in the last (or only) element of @var{spec}.
2196
2197@item a list
2198If @var{display} is a list, each element should have the form
2199@code{(@var{characteristic} @var{value}@dots{})}. Here
2200@var{characteristic} specifies a way of classifying terminals, and the
2201@var{value}s are possible classifications which @var{display} should
2202apply to. Here are the possible values of @var{characteristic}:
2203
2204@table @code
2205@item type
2206The kind of window system the terminal uses---either @code{graphic}
2207(any graphics-capable display), @code{x}, @code{pc} (for the MS-DOS
2208console), @code{w32} (for MS Windows 9X/NT/2K/XP), or @code{tty} (a
2209non-graphics-capable display). @xref{Window Systems, window-system}.
2210
2211@item class
2212What kinds of colors the terminal supports---either @code{color},
2213@code{grayscale}, or @code{mono}.
2214
2215@item background
2216The kind of background---either @code{light} or @code{dark}.
2217
2218@item min-colors
2219An integer that represents the minimum number of colors the terminal
2220should support. This matches a terminal if its
2221@code{display-color-cells} value is at least the specified integer.
2222
2223@item supports
2224Whether or not the terminal can display the face attributes given in
2225@var{value}@dots{} (@pxref{Face Attributes}). @xref{Display Face
2226Attribute Testing}, for more information on exactly how this testing
2227is done.
2228@end table
2229
2230If an element of @var{display} specifies more than one @var{value} for
2231a given @var{characteristic}, any of those values is acceptable. If
2232@var{display} has more than one element, each element should specify a
2233different @var{characteristic}; then @emph{each} characteristic of the
2234terminal must match one of the @var{value}s specified for it in
2235@var{display}.
2236@end table
2237@end defmac
2238
2239 Here's how the standard face @code{highlight} is defined:
2240
2241@example
2242(defface highlight
2243 '((((class color) (min-colors 88) (background light))
2244 :background "darkseagreen2")
2245 (((class color) (min-colors 88) (background dark))
2246 :background "darkolivegreen")
2247 (((class color) (min-colors 16) (background light))
2248 :background "darkseagreen2")
2249 (((class color) (min-colors 16) (background dark))
2250 :background "darkolivegreen")
2251 (((class color) (min-colors 8))
2252 :background "green" :foreground "black")
2253 (t :inverse-video t))
2254 "Basic face for highlighting."
2255 :group 'basic-faces)
2256@end example
2257
2258 Internally, Emacs stores the face's default specification in its
2259@code{face-defface-spec} symbol property (@pxref{Property Lists}).
2260The @code{saved-face} property stores the face specification saved by
2261the user, using the customization buffer; the @code{customized-face}
2262property stores the face specification customized for the current
2263session, but not saved; and the @code{theme-face} property stores an
2264alist associating the active customization settings and Custom themes
2265with their specifications for that face. The face's documentation
2266string is stored in the @code{face-documentation} property. But
2267normally you should not try to set any of these properties directly.
2268@xref{Applying Customizations}, for the @code{custom-set-faces}
2269function, which is used to apply customized face settings.
2270
2271 People are sometimes tempted to create variables whose values
2272specify a face to use. In the vast majority of cases, this is not
2273necessary; it is preferable to simply use faces directly.
2274
2264@node Attribute Functions 2275@node Attribute Functions
2265@subsection Face Attribute Functions 2276@subsection Face Attribute Functions
2266 2277
2267 This section describes the functions for accessing and modifying the 2278 This section describes the functions for accessing and modifying the
2268attributes of an existing face. 2279attributes of an existing named face.
2269 2280
2270@defun set-face-attribute face frame &rest arguments 2281@defun set-face-attribute face frame &rest arguments
2271This function sets one or more attributes of @var{face} for 2282This function sets one or more attributes of @var{face} for
@@ -2467,8 +2478,12 @@ This function returns the @code{:inverse-video} attribute of face @var{face}.
2467@node Displaying Faces 2478@node Displaying Faces
2468@subsection Displaying Faces 2479@subsection Displaying Faces
2469 2480
2470 Here is how Emacs determines the face to use for displaying any 2481 When Emacs displays a given piece of text, the visual appearance of
2471given piece of text: 2482the text may be determined by faces drawn from different sources. If
2483these various sources together specify more than one face for a
2484particular character, Emacs merges the attributes of the various
2485faces. Here is the order in which Emacs merges the faces, from
2486highest to lowest priority:
2472 2487
2473@itemize @bullet 2488@itemize @bullet
2474@item 2489@item
@@ -2482,11 +2497,11 @@ Manual}.
2482 2497
2483@item 2498@item
2484If the text lies within an overlay with a non-@code{nil} @code{face} 2499If the text lies within an overlay with a non-@code{nil} @code{face}
2485property, Emacs applies the face or face attributes specified by that 2500property, Emacs applies the face(s) specified by that property. If
2486property. If the overlay has a @code{mouse-face} property and the 2501the overlay has a @code{mouse-face} property and the mouse is ``near
2487mouse is ``near enough'' to the overlay, Emacs applies the face or 2502enough'' to the overlay, Emacs applies the face or face attributes
2488face attributes specified by the @code{mouse-face} property instead. 2503specified by the @code{mouse-face} property instead. @xref{Overlay
2489@xref{Overlay Properties}. 2504Properties}.
2490 2505
2491When multiple overlays cover one character, an overlay with higher 2506When multiple overlays cover one character, an overlay with higher
2492priority overrides those with lower priority. @xref{Overlays}. 2507priority overrides those with lower priority. @xref{Overlays}.
@@ -2508,11 +2523,12 @@ If any given attribute has not been specified during the preceding
2508steps, Emacs applies the attribute of the @code{default} face. 2523steps, Emacs applies the attribute of the @code{default} face.
2509@end itemize 2524@end itemize
2510 2525
2511 If these various sources together specify more than one face for a 2526 At each stage, if a face has a valid @code{:inherit} attribute,
2512particular character, Emacs merges the attributes of the various faces 2527Emacs treats any attribute with an @code{unspecified} value as having
2513specified. For each attribute, Emacs tries using the above order 2528the corresponding value drawn from the parent face(s). @pxref{Face
2514(i.e.@: first the face of any special glyph; then the face for region 2529Attributes}. Note that the parent face(s) may also leave the
2515highlighting, if appropriate; and so on). 2530attribute unspecified; in that case, the attribute remains unspecified
2531at the next level of face merging.
2516 2532
2517@node Face Remapping 2533@node Face Remapping
2518@subsection Face Remapping 2534@subsection Face Remapping
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index caa5185dec3..db770616820 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -1366,8 +1366,8 @@ Overlays
1366 1366
1367Faces 1367Faces
1368 1368
1369* Defining Faces:: How to define a face.
1370* Face Attributes:: What is in a face? 1369* Face Attributes:: What is in a face?
1370* Defining Faces:: How to define a face.
1371* Attribute Functions:: Functions to examine and set face attributes. 1371* Attribute Functions:: Functions to examine and set face attributes.
1372* Displaying Faces:: How Emacs combines the faces specified for 1372* Displaying Faces:: How Emacs combines the faces specified for
1373 a character. 1373 a character.
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index fe7f24e42cd..a5910ea921b 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -2999,12 +2999,11 @@ can be the following:
2999A face name (a symbol or string). 2999A face name (a symbol or string).
3000 3000
3001@item 3001@item
3002A property list of face attributes. This has the 3002A property list of face attributes. This has the form (@var{keyword}
3003form (@var{keyword} @var{value} @dots{}), where each @var{keyword} is a 3003@var{value} @dots{}), where each @var{keyword} is a face attribute
3004face attribute name and @var{value} is a meaningful value for that 3004name and @var{value} is a meaningful value for that attribute. With
3005attribute. With this feature, you do not need to create a face each 3005this feature, you do not need to create a face each time you want to
3006time you want to specify a particular attribute for certain text. 3006specify a particular attribute for certain text.
3007@xref{Face Attributes}.
3008 3007
3009@item 3008@item
3010A list of faces. This specifies a face which is an aggregate of the 3009A list of faces. This specifies a face which is an aggregate of the
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index c5b66757ace..1c0abcb8e66 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -403,7 +403,8 @@ unconditionally initializes the variable, whereas @code{defvar}
403initializes it only if it is originally void. 403initializes it only if it is originally void.
404 404
405 To define a customizable variable, you should use @code{defcustom} 405 To define a customizable variable, you should use @code{defcustom}
406(which calls @code{defvar} as a subroutine). @xref{Customization}. 406(which calls @code{defvar} as a subroutine). @xref{Variable
407Definitions}.
407 408
408@defspec defvar symbol [value [doc-string]] 409@defspec defvar symbol [value [doc-string]]
409This special form defines @var{symbol} as a variable. Note that 410This special form defines @var{symbol} as a variable. Note that
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c1c9e5ee1c8..7ed5f6af14b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12012-09-18 Chong Yidong <cyd@gnu.org>
2
3 * custom.el (defface): Doc fix.
4
5 * cus-edit.el (custom-unlispify-remove-prefixes): Add warning.
6
12012-09-18 Martin Blais <blais@furius.ca> (tiny change) 72012-09-18 Martin Blais <blais@furius.ca> (tiny change)
2 8
3 * progmodes/compile.el (compilation-start): Use compilation-always-kill 9 * progmodes/compile.el (compilation-start): Use compilation-always-kill
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 86a19131569..2e6f2b14625 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -526,7 +526,10 @@ WIDGET is the widget to apply the filter entries of MENU on."
526 :type 'boolean) 526 :type 'boolean)
527 527
528(defcustom custom-unlispify-remove-prefixes nil 528(defcustom custom-unlispify-remove-prefixes nil
529 "Non-nil means remove group prefixes from option names in buffer." 529 "Non-nil means remove group prefixes from option names in buffer.
530Discarding prefixes often leads to confusing names for options
531and faces in Customize buffers, so do not set this to a non-nil
532value unless you are sure you know what it does."
530 :group 'custom-menu 533 :group 'custom-menu
531 :group 'custom-buffer 534 :group 'custom-buffer
532 :type 'boolean) 535 :type 'boolean)
diff --git a/lisp/custom.el b/lisp/custom.el
index 01b0e6d1650..dfc8e631152 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -350,68 +350,62 @@ FACE does not need to be quoted.
350 350
351Third argument DOC is the face documentation. 351Third argument DOC is the face documentation.
352 352
353If FACE has been set with `custom-set-faces', set the face attributes 353If FACE has been set with `custom-set-faces', set the face
354as specified by that function, otherwise set the face attributes 354attributes as specified by that function, otherwise set the face
355according to SPEC. 355attributes according to SPEC.
356
357The remaining arguments should have the form
358
359 [KEYWORD VALUE]...
360 356
357The remaining arguments should have the form [KEYWORD VALUE]...
361For a list of valid keywords, see the common keywords listed in 358For a list of valid keywords, see the common keywords listed in
362`defcustom'. 359`defcustom'.
363 360
364SPEC should be an alist of the form ((DISPLAY ATTS)...). 361SPEC should be an alist of the form
365 362
366In the first element, DISPLAY can be `default'. The ATTS in that 363 ((DISPLAY . ATTS)...)
367element then act as defaults for all the following elements. 364
368 365where DISPLAY is a form specifying conditions to match certain
369Aside from that, DISPLAY specifies conditions to match some or 366terminals and ATTS is a property list (ATTR VALUE ATTR VALUE...)
370all frames. For each frame, the first element of SPEC where the 367specifying face attributes and values for frames on those
371DISPLAY conditions are satisfied is the one that applies to that 368terminals. On each terminal, the first element with a matching
372frame. The ATTRs in this element take effect, and the following 369DISPLAY specification takes effect, and the remaining elements in
373elements are ignored, on that frame. 370SPEC are disregarded.
374 371
375In the last element, DISPLAY can be t. That element applies to a 372As a special exception, in the first element of SPEC, DISPLAY can
376frame if none of the previous elements (except the `default' if 373be the special value `default'. Then the ATTS in that element
377any) did. 374act as defaults for all the following elements.
378 375
379ATTS is a list of face attributes followed by their values: 376For backward compatibility, elements of SPEC can be written
380 (ATTR VALUE ATTR VALUE...) 377as (DISPLAY ATTS) instead of (DISPLAY . ATTS).
381 378
382The possible attributes are `:family', `:width', `:height', `:weight', 379Each DISPLAY can have the following values:
383`:slant', `:underline', `:overline', `:strike-through', `:box', 380 - `default' (only in the first element).
384`:foreground', `:background', `:stipple', `:inverse-video', and `:inherit'. 381 - The symbol t, which matches all terminals.
385 382 - An alist of conditions. Each alist element must have the form
386DISPLAY can be `default' (only in the first element), the symbol 383 (REQ ITEM...). A matching terminal must satisfy each
387t (only in the last element) to match all frames, or an alist of 384 specified condition by matching one of its ITEMs. Each REQ
388conditions of the form \(REQ ITEM...). For such an alist to 385 must be one of the following:
389match a frame, each of the conditions must be satisfied, meaning 386 - `type' (the terminal type).
390that the REQ property of the frame must match one of the 387 Each ITEM must be one of the values returned by
391corresponding ITEMs. These are the defined REQ values: 388 `window-system'. Under X, additional allowed values are
392 389 `motif', `lucid', `gtk' and `x-toolkit'.
393`type' (the value of `window-system') 390 - `class' (the terminal's color support).
394 Under X, in addition to the values `window-system' can take, 391 Each ITEM should be one of `color', `grayscale', or `mono'.
395 `motif', `lucid', `gtk' and `x-toolkit' are allowed, and match when 392 - `background' (what color is used for the background text)
396 the Motif toolkit, Lucid toolkit, GTK toolkit or any X toolkit is in use. 393 Each ITEM should be one of `light' or `dark'.
397 394 - `min-colors' (the minimum number of supported colors)
398`class' (the frame's color support) 395 Each ITEM should be an integer, which is compared with the
399 Should be one of `color', `grayscale', or `mono'. 396 result of `display-color-cells'.
400 397 - `supports' (match terminals supporting certain attributes).
401`background' (what color is used for the background text) 398 Each ITEM should be a list of face attributes. See
402 Should be one of `light' or `dark'. 399 `display-supports-face-attributes-p' for more information on
403 400 exactly how testing is done.
404`min-colors' (the minimum number of colors the frame should support) 401
405 Should be an integer, it is compared with the result of 402In the ATTS property list, possible attributes are `:family',
406 `display-color-cells'. 403`:width', `:height', `:weight', `:slant', `:underline',
407 404`:overline', `:strike-through', `:box', `:foreground',
408`supports' (only match frames that support the specified face attributes) 405`:background', `:stipple', `:inverse-video', and `:inherit'.
409 Should be a list of face attributes. See the documentation for 406
410 the function `display-supports-face-attributes-p' for more 407See Info node `(elisp) Faces' in the Emacs Lisp manual for more
411 information on exactly how testing is done. 408information."
412
413See Info node `(elisp) Customization' in the Emacs Lisp manual
414for more information."
415 (declare (doc-string 3)) 409 (declare (doc-string 3))
416 ;; It is better not to use backquote in this file, 410 ;; It is better not to use backquote in this file,
417 ;; because that makes a bootstrapping problem 411 ;; because that makes a bootstrapping problem