aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2012-06-09 14:26:46 +0800
committerChong Yidong2012-06-09 14:26:46 +0800
commit6175e34b61bb75d18a91d4774c629fb6fb28ab32 (patch)
tree44bc444b4c83999b3b12dae4b52b816aba3d3318
parentd9857e534be786674818645a1c51410b4ca68cf8 (diff)
downloademacs-6175e34b61bb75d18a91d4774c629fb6fb28ab32.tar.gz
emacs-6175e34b61bb75d18a91d4774c629fb6fb28ab32.zip
Doc improvements for face remapping.
* face-remap.el (face-remap-add-relative, face-remap-set-base) (buffer-face-set, buffer-face-toggle, buffer-face-mode-invoke): Doc fixes. * doc/lispref/display.texi (Face Remapping): Minor clarification. * doc/lispref/text.texi (Special Properties): Clarify the meaning of a list of faces in the `face' property. Fixes: debbugs:11225
-rw-r--r--doc/lispref/ChangeLog7
-rw-r--r--doc/lispref/display.texi37
-rw-r--r--doc/lispref/text.texi6
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/face-remap.el57
5 files changed, 69 insertions, 44 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 3c9f26d6a24..cbe081ca6b4 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,10 @@
12012-06-09 Chong Yidong <cyd@gnu.org>
2
3 * text.texi (Special Properties): Clarify the meaning of a list of
4 faces in the `face' property.
5
6 * display.texi (Face Remapping): Minor clarification.
7
12012-06-08 Chong Yidong <cyd@gnu.org> 82012-06-08 Chong Yidong <cyd@gnu.org>
2 9
3 * display.texi (Face Attributes): Font family does not accept 10 * display.texi (Face Attributes): Font family does not accept
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 53e800bfbf0..3725b6fd820 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -2511,39 +2511,34 @@ Scale,,, emacs, The GNU Emacs Manual}).
2511The value of this variable is an alist whose elements have the form 2511The value of this variable is an alist whose elements have the form
2512@code{(@var{face} . @var{remapping})}. This causes Emacs to display 2512@code{(@var{face} . @var{remapping})}. This causes Emacs to display
2513any text having the face @var{face} with @var{remapping}, rather than 2513any text having the face @var{face} with @var{remapping}, rather than
2514the ordinary definition of @var{face}. @var{remapping} may be any 2514the ordinary definition of @var{face}.
2515face specification suitable for a @code{face} text property: either a 2515
2516face name, or a property list of attribute/value pairs, or a list in 2516@var{remapping} may be any face specification suitable for a
2517which each element is either a face name or a property list 2517@code{face} text property: either a face (i.e.@: a face name or a
2518(@pxref{Special Properties}). 2518property list of attribute/value pairs), or a list of faces. For
2519details, see the description of the @code{face} text property in
2520@ref{Special Properties}. @var{remapping} serves as the complete
2521specification for the remapped face---it replaces the normal
2522definition of @var{face}, instead of modifying it.
2519 2523
2520If @code{face-remapping-alist} is buffer-local, its local value takes 2524If @code{face-remapping-alist} is buffer-local, its local value takes
2521effect only within that buffer. 2525effect only within that buffer.
2522 2526
2523Two points bear emphasizing: 2527Note: face remapping is non-recursive. If @var{remapping} references
2524 2528the same face name @var{face}, either directly or via the
2525@enumerate 2529@code{:inherit} attribute of some other face in @var{remapping}, that
2526@item 2530reference uses the normal definition of @var{face}. For instance, if
2527@var{remapping} serves as the complete specification for the remapped 2531the @code{mode-line} face is remapped using this entry in
2528face---it replaces the normal definition of @var{face}, instead of 2532@code{face-remapping-alist}:
2529modifying it.
2530
2531@item
2532If @var{remapping} references the same face name @var{face}, either
2533directly or via the @code{:inherit} attribute of some other face in
2534@var{remapping}, that reference uses the normal definition of
2535@var{face}. In other words, the remapping cannot be recursive.
2536 2533
2537For instance, if the @code{mode-line} face is remapped using this
2538entry in @code{face-remapping-alist}:
2539@example 2534@example
2540(mode-line italic mode-line) 2535(mode-line italic mode-line)
2541@end example 2536@end example
2537
2542@noindent 2538@noindent
2543then the new definition of the @code{mode-line} face inherits from the 2539then the new definition of the @code{mode-line} face inherits from the
2544@code{italic} face, and the @emph{normal} (non-remapped) definition of 2540@code{italic} face, and the @emph{normal} (non-remapped) definition of
2545@code{mode-line} face. 2541@code{mode-line} face.
2546@end enumerate
2547@end defvar 2542@end defvar
2548 2543
2549 The following functions implement a higher-level interface to 2544 The following functions implement a higher-level interface to
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index e2bdc707c5b..63a6d2cbab3 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -3004,7 +3004,11 @@ time you want to specify a particular attribute for certain text.
3004@xref{Face Attributes}. 3004@xref{Face Attributes}.
3005 3005
3006@item 3006@item
3007A list, where each element uses one of the two forms listed above. 3007A list of faces. This specifies a face which is an aggregate of the
3008attributes of each of the listed faces. Faces occurring earlier in
3009the list have higher priority. Each list element must have one of the
3010two above forms (i.e.@: either a face name or a property list of face
3011attributes).
3008@end itemize 3012@end itemize
3009 3013
3010Font Lock mode (@pxref{Font Lock Mode}) works in most buffers by 3014Font Lock mode (@pxref{Font Lock Mode}) works in most buffers by
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 72a9cb352a5..d75a1d52799 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12012-06-09 Chong Yidong <cyd@gnu.org>
2
3 * face-remap.el (face-remap-add-relative, face-remap-set-base)
4 (buffer-face-set, buffer-face-toggle, buffer-face-mode-invoke):
5 Doc fixes (Bug#11225).
6
12012-06-09 Stefan Monnier <monnier@iro.umontreal.ca> 72012-06-09 Stefan Monnier <monnier@iro.umontreal.ca>
2 8
3 * emacs-lisp/macroexp.el (macroexp--expand-all): Only autoload 9 * emacs-lisp/macroexp.el (macroexp--expand-all): Only autoload
diff --git a/lisp/face-remap.el b/lisp/face-remap.el
index 46dad0fca3a..be2207a993f 100644
--- a/lisp/face-remap.el
+++ b/lisp/face-remap.el
@@ -109,14 +109,19 @@ The list structure of ENTRY may be destructively modified."
109Return a cookie which can be used to delete this remapping with 109Return a cookie which can be used to delete this remapping with
110`face-remap-remove-relative'. 110`face-remap-remove-relative'.
111 111
112The remaining arguments, SPECS, should be either a list of face 112The remaining arguments, SPECS, should form a list of faces.
113names, or a property list of face attribute/value pairs. The 113Each list element should be either a face name or a property list
114remapping specified by SPECS takes effect alongside the 114of face attribute/value pairs. If more than one face is listed,
115remappings from other calls to `face-remap-add-relative', as well 115that specifies an aggregate face, in the same way as in a `face'
116as the normal definition of FACE (at lowest priority). This 116text property, except for possible priority changes noted below.
117function tries to sort multiple remappings for the same face, so 117
118that remappings specifying relative face attributes are applied 118The face remapping specified by SPECS takes effect alongside the
119after remappings specifying absolute face attributes. 119remappings from other calls to `face-remap-add-relative' for the
120same FACE, as well as the normal definition of FACE (at lowest
121priority). This function tries to sort multiple remappings for
122the same face, so that remappings specifying relative face
123attributes are applied after remappings specifying absolute face
124attributes.
120 125
121The base (lowest priority) remapping may be set to something 126The base (lowest priority) remapping may be set to something
122other than the normal definition of FACE via `face-remap-set-base'." 127other than the normal definition of FACE via `face-remap-set-base'."
@@ -165,9 +170,11 @@ to apply on top of the normal definition of FACE."
165(defun face-remap-set-base (face &rest specs) 170(defun face-remap-set-base (face &rest specs)
166 "Set the base remapping of FACE in the current buffer to SPECS. 171 "Set the base remapping of FACE in the current buffer to SPECS.
167This causes the remappings specified by `face-remap-add-relative' 172This causes the remappings specified by `face-remap-add-relative'
168to apply on top of the face specification given by SPECS. SPECS 173to apply on top of the face specification given by SPECS.
169should be either a list of face names, or a property list of face 174
170attribute/value pairs. 175The remaining arguments, SPECS, should form a list of faces.
176Each list element should be either a face name or a property list
177of face attribute/value pairs, like in a `face' text property.
171 178
172If SPECS is empty, call `face-remap-reset-base' to use the normal 179If SPECS is empty, call `face-remap-reset-base' to use the normal
173definition of FACE as the base remapping; note that this is 180definition of FACE as the base remapping; note that this is
@@ -361,12 +368,14 @@ variable `buffer-face-mode-face' is used to display the buffer text."
361;;;###autoload 368;;;###autoload
362(defun buffer-face-set (&rest specs) 369(defun buffer-face-set (&rest specs)
363 "Enable `buffer-face-mode', using face specs SPECS. 370 "Enable `buffer-face-mode', using face specs SPECS.
364SPECS can be any value suitable for the `face' text property, 371Each argument in SPECS should be a face, i.e. either a face name
365including a face name, a list of face names, or a face-attribute 372or a property list of face attributes and values. If more than
366If SPECS is nil, then `buffer-face-mode' is disabled. 373one face is listed, that specifies an aggregate face, like in a
367 374`face' text property. If SPECS is nil or omitted, disable
368This function will make the variable `buffer-face-mode-face' 375`buffer-face-mode'.
369buffer local, and set it to FACE." 376
377This function makes the variable `buffer-face-mode-face' buffer
378local, and sets it to FACE."
370 (interactive (list (read-face-name "Set buffer face"))) 379 (interactive (list (read-face-name "Set buffer face")))
371 (while (and (consp specs) (null (cdr specs))) 380 (while (and (consp specs) (null (cdr specs)))
372 (setq specs (car specs))) 381 (setq specs (car specs)))
@@ -378,8 +387,10 @@ buffer local, and set it to FACE."
378;;;###autoload 387;;;###autoload
379(defun buffer-face-toggle (&rest specs) 388(defun buffer-face-toggle (&rest specs)
380 "Toggle `buffer-face-mode', using face specs SPECS. 389 "Toggle `buffer-face-mode', using face specs SPECS.
381SPECS can be any value suitable for the `face' text property, 390Each argument in SPECS should be a face, i.e. either a face name
382including a face name, a list of face names, or a face-attribute 391or a property list of face attributes and values. If more than
392one face is listed, that specifies an aggregate face, like in a
393`face' text property.
383 394
384If `buffer-face-mode' is already enabled, and is currently using 395If `buffer-face-mode' is already enabled, and is currently using
385the face specs SPECS, then it is disabled; if buffer-face-mode is 396the face specs SPECS, then it is disabled; if buffer-face-mode is
@@ -402,10 +413,12 @@ buffer local, and set it to SPECS."
402ARG controls whether the mode is enabled or disabled, and is 413ARG controls whether the mode is enabled or disabled, and is
403interpreted in the usual manner for minor-mode commands. 414interpreted in the usual manner for minor-mode commands.
404 415
405SPECS can be any value suitable for the `face' text property, 416SPECS can be any value suitable for a `face' text property,
406including a face name, a list of face names, or a face-attribute 417including a face name, a plist of face attributes and values, or
418a list of faces.
407 419
408If INTERACTIVE is non-nil, a message will be displayed describing the result. 420If INTERACTIVE is non-nil, display a message describing the
421result.
409 422
410This is a wrapper function which calls `buffer-face-set' or 423This is a wrapper function which calls `buffer-face-set' or
411`buffer-face-toggle' (depending on ARG), and prints a status 424`buffer-face-toggle' (depending on ARG), and prints a status