comparison doc/lispref/display.texi @ 95457:415f68458e61

Implement face-remapping-alist feature Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1195
author Miles Bader <miles@gnu.org>
date Sun, 01 Jun 2008 05:04:24 +0000
parents 3ce489895028
children 328f63bafded
comparison
equal deleted inserted replaced
95456:b7c970f39dae 95457:415f68458e61
2363 line or a header line), and last the @code{default} face. 2363 line or a header line), and last the @code{default} face.
2364 2364
2365 When multiple overlays cover one character, an overlay with higher 2365 When multiple overlays cover one character, an overlay with higher
2366 priority overrides those with lower priority. @xref{Overlays}. 2366 priority overrides those with lower priority. @xref{Overlays}.
2367 2367
2368 @defvar face-remapping-alist
2369 This variable is used for buffer-local or global changes in the
2370 appearance of a face, for instance making the @code{default} face a
2371 variable-pitch face in a particular buffer.
2372
2373 Its value should be an alist, whose elements have the form
2374 @code{(@var{face} @var{remapping...})}. This causes Emacs to display
2375 text using the face @var{face} using @var{remapping...} instead of
2376 @var{face}'s global definition. @var{remapping...} may be any face
2377 specification suitable for a @code{face} text property, usually a face
2378 name, but also perhaps a property list of face attribute/value pairs.
2379 @xref{Special Properties}.
2380
2381 To affect display only in a single buffer,
2382 @code{face-remapping-alist} should be made buffer-local.
2383
2384 Two points bear emphasizing:
2385
2386 @enumerate
2387 @item
2388 The new definition @var{remapping...} is the complete
2389 specification of how to display @var{face}---it entirely replaces,
2390 rather than augmenting or modifying, the normal definition of that
2391 face.
2392
2393 @item
2394 If @var{remapping...} recursively references the same face name
2395 @var{face}, either directly remapping entry, or via the
2396 @code{:inherit} attribute of some other face in
2397 @var{remapping...}, then that reference uses normal frame-wide
2398 definition of @var{face} instead of the ``remapped'' definition.
2399
2400 For instance, if the @code{mode-line} face is remapped using this
2401 entry in @code{face-remapping-alist}:
2402 @example
2403 (mode-line italic mode-line)
2404 @end example
2405 @noindent
2406 then the new definition of the @code{mode-line} face inherits from the
2407 @code{italic} face, and the @emph{normal} (non-remapped) definition of
2408 @code{mode-line} face.
2409 @end enumerate
2410
2411 A typical use of the @code{face-remapping-alist} is to change a
2412 buffer's @code{default} face; for example, the following changes a
2413 buffer's @code{default} face to use the @code{variable-pitch} face,
2414 with the height doubled:
2415
2416 @example
2417 (set (make-local-variable 'face-remapping-alist)
2418 '((default variable-pitch :height 2.0)))
2419 @end example
2420
2421 @end defvar
2422
2368 @node Font Selection 2423 @node Font Selection
2369 @subsection Font Selection 2424 @subsection Font Selection
2370 2425
2371 @dfn{Selecting a font} means mapping the specified face attributes for 2426 @dfn{Selecting a font} means mapping the specified face attributes for
2372 a character to a font that is available on a particular display. The 2427 a character to a font that is available on a particular display. The