diff options
| author | Chong Yidong | 2012-06-09 14:26:46 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-06-09 14:26:46 +0800 |
| commit | 6175e34b61bb75d18a91d4774c629fb6fb28ab32 (patch) | |
| tree | 44bc444b4c83999b3b12dae4b52b816aba3d3318 | |
| parent | d9857e534be786674818645a1c51410b4ca68cf8 (diff) | |
| download | emacs-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/ChangeLog | 7 | ||||
| -rw-r--r-- | doc/lispref/display.texi | 37 | ||||
| -rw-r--r-- | doc/lispref/text.texi | 6 | ||||
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/face-remap.el | 57 |
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 @@ | |||
| 1 | 2012-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 | |||
| 1 | 2012-06-08 Chong Yidong <cyd@gnu.org> | 8 | 2012-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}). | |||
| 2511 | The value of this variable is an alist whose elements have the form | 2511 | The 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 |
| 2513 | any text having the face @var{face} with @var{remapping}, rather than | 2513 | any text having the face @var{face} with @var{remapping}, rather than |
| 2514 | the ordinary definition of @var{face}. @var{remapping} may be any | 2514 | the ordinary definition of @var{face}. |
| 2515 | face specification suitable for a @code{face} text property: either a | 2515 | |
| 2516 | face name, or a property list of attribute/value pairs, or a list in | 2516 | @var{remapping} may be any face specification suitable for a |
| 2517 | which 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}). | 2518 | property list of attribute/value pairs), or a list of faces. For |
| 2519 | details, see the description of the @code{face} text property in | ||
| 2520 | @ref{Special Properties}. @var{remapping} serves as the complete | ||
| 2521 | specification for the remapped face---it replaces the normal | ||
| 2522 | definition of @var{face}, instead of modifying it. | ||
| 2519 | 2523 | ||
| 2520 | If @code{face-remapping-alist} is buffer-local, its local value takes | 2524 | If @code{face-remapping-alist} is buffer-local, its local value takes |
| 2521 | effect only within that buffer. | 2525 | effect only within that buffer. |
| 2522 | 2526 | ||
| 2523 | Two points bear emphasizing: | 2527 | Note: face remapping is non-recursive. If @var{remapping} references |
| 2524 | 2528 | the 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 | 2530 | reference uses the normal definition of @var{face}. For instance, if |
| 2527 | @var{remapping} serves as the complete specification for the remapped | 2531 | the @code{mode-line} face is remapped using this entry in |
| 2528 | face---it replaces the normal definition of @var{face}, instead of | 2532 | @code{face-remapping-alist}: |
| 2529 | modifying it. | ||
| 2530 | |||
| 2531 | @item | ||
| 2532 | If @var{remapping} references the same face name @var{face}, either | ||
| 2533 | directly 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 | ||
| 2537 | For instance, if the @code{mode-line} face is remapped using this | ||
| 2538 | entry 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 |
| 2543 | then the new definition of the @code{mode-line} face inherits from the | 2539 | then 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 |
| 3007 | A list, where each element uses one of the two forms listed above. | 3007 | A list of faces. This specifies a face which is an aggregate of the |
| 3008 | attributes of each of the listed faces. Faces occurring earlier in | ||
| 3009 | the list have higher priority. Each list element must have one of the | ||
| 3010 | two above forms (i.e.@: either a face name or a property list of face | ||
| 3011 | attributes). | ||
| 3008 | @end itemize | 3012 | @end itemize |
| 3009 | 3013 | ||
| 3010 | Font Lock mode (@pxref{Font Lock Mode}) works in most buffers by | 3014 | Font 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 @@ | |||
| 1 | 2012-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 | |||
| 1 | 2012-06-09 Stefan Monnier <monnier@iro.umontreal.ca> | 7 | 2012-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." | |||
| 109 | Return a cookie which can be used to delete this remapping with | 109 | Return a cookie which can be used to delete this remapping with |
| 110 | `face-remap-remove-relative'. | 110 | `face-remap-remove-relative'. |
| 111 | 111 | ||
| 112 | The remaining arguments, SPECS, should be either a list of face | 112 | The remaining arguments, SPECS, should form a list of faces. |
| 113 | names, or a property list of face attribute/value pairs. The | 113 | Each list element should be either a face name or a property list |
| 114 | remapping specified by SPECS takes effect alongside the | 114 | of face attribute/value pairs. If more than one face is listed, |
| 115 | remappings from other calls to `face-remap-add-relative', as well | 115 | that specifies an aggregate face, in the same way as in a `face' |
| 116 | as the normal definition of FACE (at lowest priority). This | 116 | text property, except for possible priority changes noted below. |
| 117 | function tries to sort multiple remappings for the same face, so | 117 | |
| 118 | that remappings specifying relative face attributes are applied | 118 | The face remapping specified by SPECS takes effect alongside the |
| 119 | after remappings specifying absolute face attributes. | 119 | remappings from other calls to `face-remap-add-relative' for the |
| 120 | same FACE, as well as the normal definition of FACE (at lowest | ||
| 121 | priority). This function tries to sort multiple remappings for | ||
| 122 | the same face, so that remappings specifying relative face | ||
| 123 | attributes are applied after remappings specifying absolute face | ||
| 124 | attributes. | ||
| 120 | 125 | ||
| 121 | The base (lowest priority) remapping may be set to something | 126 | The base (lowest priority) remapping may be set to something |
| 122 | other than the normal definition of FACE via `face-remap-set-base'." | 127 | other 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. |
| 167 | This causes the remappings specified by `face-remap-add-relative' | 172 | This causes the remappings specified by `face-remap-add-relative' |
| 168 | to apply on top of the face specification given by SPECS. SPECS | 173 | to apply on top of the face specification given by SPECS. |
| 169 | should be either a list of face names, or a property list of face | 174 | |
| 170 | attribute/value pairs. | 175 | The remaining arguments, SPECS, should form a list of faces. |
| 176 | Each list element should be either a face name or a property list | ||
| 177 | of face attribute/value pairs, like in a `face' text property. | ||
| 171 | 178 | ||
| 172 | If SPECS is empty, call `face-remap-reset-base' to use the normal | 179 | If SPECS is empty, call `face-remap-reset-base' to use the normal |
| 173 | definition of FACE as the base remapping; note that this is | 180 | definition 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. |
| 364 | SPECS can be any value suitable for the `face' text property, | 371 | Each argument in SPECS should be a face, i.e. either a face name |
| 365 | including a face name, a list of face names, or a face-attribute | 372 | or a property list of face attributes and values. If more than |
| 366 | If SPECS is nil, then `buffer-face-mode' is disabled. | 373 | one face is listed, that specifies an aggregate face, like in a |
| 367 | 374 | `face' text property. If SPECS is nil or omitted, disable | |
| 368 | This function will make the variable `buffer-face-mode-face' | 375 | `buffer-face-mode'. |
| 369 | buffer local, and set it to FACE." | 376 | |
| 377 | This function makes the variable `buffer-face-mode-face' buffer | ||
| 378 | local, 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. |
| 381 | SPECS can be any value suitable for the `face' text property, | 390 | Each argument in SPECS should be a face, i.e. either a face name |
| 382 | including a face name, a list of face names, or a face-attribute | 391 | or a property list of face attributes and values. If more than |
| 392 | one face is listed, that specifies an aggregate face, like in a | ||
| 393 | `face' text property. | ||
| 383 | 394 | ||
| 384 | If `buffer-face-mode' is already enabled, and is currently using | 395 | If `buffer-face-mode' is already enabled, and is currently using |
| 385 | the face specs SPECS, then it is disabled; if buffer-face-mode is | 396 | the face specs SPECS, then it is disabled; if buffer-face-mode is |
| @@ -402,10 +413,12 @@ buffer local, and set it to SPECS." | |||
| 402 | ARG controls whether the mode is enabled or disabled, and is | 413 | ARG controls whether the mode is enabled or disabled, and is |
| 403 | interpreted in the usual manner for minor-mode commands. | 414 | interpreted in the usual manner for minor-mode commands. |
| 404 | 415 | ||
| 405 | SPECS can be any value suitable for the `face' text property, | 416 | SPECS can be any value suitable for a `face' text property, |
| 406 | including a face name, a list of face names, or a face-attribute | 417 | including a face name, a plist of face attributes and values, or |
| 418 | a list of faces. | ||
| 407 | 419 | ||
| 408 | If INTERACTIVE is non-nil, a message will be displayed describing the result. | 420 | If INTERACTIVE is non-nil, display a message describing the |
| 421 | result. | ||
| 409 | 422 | ||
| 410 | This is a wrapper function which calls `buffer-face-set' or | 423 | This 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 |