Function: erc-track--massage-nick-button-faces

erc-track--massage-nick-button-faces is a byte-compiled function defined in erc-track.el.gz.

Signature

(erc-track--massage-nick-button-faces SYM VAL &optional SET-FN)

Documentation

Transform VAL of face-list option SYM to remove/replace obsolete items.

Use set-compatible SET-FN when given. Record any migrations as cons cells of (OLD . NEW) in the symbol property erc-track--obsolete-faces of SYM.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-track.el.gz
;; In an emergency, users can opt out of this migration with:
;;
;;   (put 'erc-track-faces-priority-list 'erc-track--obsolete-faces t)
;;   (put 'erc-track-faces-normal-list 'erc-track--obsolete-faces t)
;;
(defun erc-track--massage-nick-button-faces (sym val &optional set-fn)
  "Transform VAL of face-list option SYM to remove/replace obsolete items.
Use `set'-compatible SET-FN when given.  Record any migrations as cons
cells of (OLD . NEW) in the symbol property `erc-track--obsolete-faces'
of SYM."
  (let* ((oldface '(erc-nick-default-face erc-default-face))
         (newface '(erc-button-nick-default-face erc-default-face))
         (migrations (get sym 'erc-track--obsolete-faces))
         (new (if migrations
                  val
                (delq nil
                      (mapcar
                       (lambda (f)
                         (if (equal f oldface)
                             (setf (alist-get oldface migrations
                                              nil nil #'equal)
                                   (and (not (member newface val)) newface))
                           f))
                       val)))))
    (when migrations
      (put sym 'erc-track--obsolete-faces migrations))
    (if set-fn (funcall set-fn sym new) (set-default sym new))))