Function: custom-declare-face

custom-declare-face is a byte-compiled function defined in cus-face.el.gz.

Signature

(custom-declare-face FACE SPEC DOC &rest ARGS)

Documentation

Like defface, but with FACE evaluated as a normal argument.

Source Code

;; Defined in /usr/src/emacs/lisp/cus-face.el.gz
;;; cus-face.el --- customization support for faces  -*- lexical-binding: t; -*-
;;
;; Copyright (C) 1996-1997, 1999-2025 Free Software Foundation, Inc.
;;
;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
;; Keywords: help, faces
;; Package: emacs

;; This file is part of GNU Emacs.

;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:
;;
;; See `custom.el'.

;;; Code:

;;; Declaring a face.

(defun custom-declare-face (face spec doc &rest args)
  "Like `defface', but with FACE evaluated as a normal argument."
  (when (and doc
             (not (documentation-stringp doc)))
    (error "Invalid (or missing) doc string %S" doc))
  (unless (get face 'face-defface-spec)
    (face-spec-set face (purecopy spec) 'face-defface-spec)
    (push (cons 'defface face) current-load-list)
    (when doc
      (set-face-documentation face (purecopy doc)))
    (custom-handle-all-keywords face args 'custom-face)
    (run-hooks 'custom-define-hook))
  face)