Function: erc-track-select-mode-line-face

erc-track-select-mode-line-face is a byte-compiled function defined in erc-track.el.gz.

Signature

(erc-track-select-mode-line-face CUR-FACE NEW-FACES)

Documentation

Return the face to use in the mode line.

CUR-FACE is the face currently used in the mode line (for the current buffer). NEW-FACES is the list of new faces that have just been seen (in the current buffer).

Initially, the selected face is the one with highest priority in erc-track-faces-priority-list (i.e., the one closest to the front of the list) among CUR-FACE and NEW-FACES. If nothing matches (including if erc-track-faces-priority-list is not set), the default mode-line faces will be used (NIL is returned).

If the selected face is still CUR-FACE (highest priority), and the highest priority face in NEW-FACES alone is different (which necessarily means it has lower priority than CUR-FACE), and both are in erc-track-faces-normal-list, then the latter is selected instead. This has the effect of allowing the current mode line face, if a member of erc-track-faces-normal-list, to be replaced with another with lower priority face from NEW-FACES, if that face with highest priority in NEW-FACES is also a member of erc-track-faces-normal-list.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-track.el.gz
(defun erc-track-select-mode-line-face (cur-face new-faces)
  "Return the face to use in the mode line.

CUR-FACE is the face currently used in the mode line (for the
current buffer).  NEW-FACES is the list of new faces that have
just been seen (in the current buffer).

Initially, the selected face is the one with highest priority in
`erc-track-faces-priority-list' (i.e., the one closest to the
front of the list) among CUR-FACE and NEW-FACES.  If nothing
matches (including if `erc-track-faces-priority-list' is not
set), the default mode-line faces will be used (NIL is returned).

If the selected face is still CUR-FACE (highest priority), and
the highest priority face in NEW-FACES alone is different (which
necessarily means it has lower priority than CUR-FACE), and both
are in `erc-track-faces-normal-list', then the latter is selected
instead.  This has the effect of allowing the current mode line
face, if a member of `erc-track-faces-normal-list', to be
replaced with another with lower priority face from NEW-FACES, if
that face with highest priority in NEW-FACES is also a member of
`erc-track-faces-normal-list'."
  (let ((choice (catch 'face
                  (dolist (candidate erc-track-faces-priority-list)
                    (when (or (equal candidate cur-face)
                              (member candidate new-faces))
                      (throw 'face candidate))))))
    (when choice
      (if (and (equal choice cur-face)
               (member choice erc-track-faces-normal-list))
          (let ((only-in-new
                 (catch 'face
                   (dolist (candidate erc-track-faces-priority-list)
                     (when (member candidate new-faces)
                       (throw 'face candidate))))))
            (if (member only-in-new erc-track-faces-normal-list)
                only-in-new
              choice))
        choice))))