Function: buffer-face-set

buffer-face-set is an autoloaded, interactive and byte-compiled function defined in face-remap.el.gz.

Signature

(buffer-face-set &rest SPECS)

Documentation

Enable buffer-face-mode(var)/buffer-face-mode(fun), using face specs SPECS.

Each argument in SPECS should be a face, i.e. either a face name or a property list of face attributes and values. If more than one face is listed, that specifies an aggregate face, like in a face text property. If SPECS is nil or omitted, disable buffer-face-mode(var)/buffer-face-mode(fun).

If SPECS needs to specify a font, it should be either a list whose car is :font and whose cdr is a font-spec object, or the return value of font-face-attributes called with a font object, font spec, or font entity corresponding to the desired font.

This function makes the variable buffer-face-mode-face buffer local, and sets it to FACE.

Probably introduced at or before Emacs version 23.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/face-remap.el.gz
;;;###autoload
(defun buffer-face-set (&rest specs)
  "Enable `buffer-face-mode', using face specs SPECS.
Each argument in SPECS should be a face, i.e. either a face name
or a property list of face attributes and values.  If more than
one face is listed, that specifies an aggregate face, like in a
`face' text property.  If SPECS is nil or omitted, disable
`buffer-face-mode'.

If SPECS needs to specify a font, it should be either a list
whose car is `:font' and whose cdr is a font-spec object,
or the return value of `font-face-attributes' called with a font
object, font spec, or font entity corresponding to the desired font.

This function makes the variable `buffer-face-mode-face' buffer
local, and sets it to FACE."
  (interactive (list (read-face-name "Set buffer face" (face-at-point t))))
  (while (and (consp specs) (null (cdr specs)))
    (setq specs (car specs)))
  (if (null specs)
      (buffer-face-mode 0)
    (setq-local buffer-face-mode-face specs)
    (buffer-face-mode t)))