Function: calendar-make-temp-face

calendar-make-temp-face is a byte-compiled function defined in calendar.el.gz.

Signature

(calendar-make-temp-face ATTRLIST)

Documentation

Return a temporary face based on the attributes in ATTRLIST.

ATTRLIST is a list with elements of the form :face face :foreground color.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/calendar.el.gz
(defun calendar-make-temp-face (attrlist)
  "Return a temporary face based on the attributes in ATTRLIST.
ATTRLIST is a list with elements of the form :face face :foreground color."
  (let ((attrs attrlist)
        faceinfo face temp-face)
    ;; Separate :face from the other attributes.  Use the last :face
    ;; if there are more than one.  FIXME is merging meaningful?
    (while attrs
      (if (eq (car attrs) :face)
          (setq face (intern-soft (cadr attrs))
                attrs (cddr attrs))
        (push (car attrs) faceinfo)
        (setq attrs (cdr attrs))))
    (or (facep face) (setq face 'default))
    (if (not faceinfo)
        ;; No attributes to apply, so just use an existing-face.
        face
      ;; FIXME should we be using numbered temp-faces, reusing where poss?
      (setq temp-face
            (make-symbol
             (concat ":caltemp"
                     (mapconcat (lambda (sym)
                                  (cond
                                   ((symbolp sym) (symbol-name sym))
                                   ((numberp sym) (number-to-string sym))
                                   (t sym)))
                                attrlist ""))))
      (make-face temp-face)
      (copy-face face temp-face)
      ;; Apply the font aspects.
      (apply #'set-face-attribute temp-face nil (nreverse faceinfo))
      temp-face)))