Function: erc-track--setup

erc-track--setup is a byte-compiled function defined in erc-track.el.gz.

Signature

(erc-track--setup)

Documentation

Initialize a buffer for use with the track module.

If this is a server buffer or erc-track-faces-normal-list is locally bound, create a new erc-track--normal-faces for the current buffer. Otherwise, set the local value to the server buffer's.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-track.el.gz
(defun erc-track--setup ()
  "Initialize a buffer for use with the `track' module.
If this is a server buffer or `erc-track-faces-normal-list' is
locally bound, create a new `erc-track--normal-faces' for the
current buffer.  Otherwise, set the local value to the server
buffer's."
  (if erc-track-mode
      (let ((existing (erc-with-server-buffer erc-track--normal-faces))
            (localp (and erc--target
                         (local-variable-p 'erc-track-faces-normal-list)))
            (opts '(erc-track-faces-normal-list erc-track-faces-priority-list))
            warnp table)
        ;; Don't bother warning users who've disabled `button'.
        (unless (or erc--target (not (or (bound-and-true-p erc-button-mode)
                                         (memq 'button erc-modules))))
          (when (or localp (local-variable-p 'erc-track-faces-priority-list))
            (dolist (opt opts)
              (erc-track--massage-nick-button-faces opt (symbol-value opt)
                                                    #'set)))
          (dolist (opt opts)
            (when (get opt 'erc-track--obsolete-faces)
              (push opt warnp)
              (put opt 'erc-track--obsolete-faces nil)))
          (when warnp
            (erc--warn-once-before-connect 'erc-track-mode
              (if (cdr warnp) "Options " "Option ")
              (mapconcat (lambda (o) (format "`%S'" o)) warnp " and ")
              (if (cdr warnp) " contain" " contains")
              " an obsolete item, %S, intended to match buttonized nicknames."
              " ERC has changed it to %S for the current session."
              " Please save the current value to silence this message."
              '(erc-nick-default-face erc-default-face)
              '(erc-button-nick-default-face erc-default-face))))
        (when (or (null existing) localp)
          (setq table (map-into (mapcar (lambda (f) (cons f f))
                                        erc-track-faces-normal-list)
                                '(hash-table :test equal :weakness value))))
        (setq erc-track--normal-faces (or table existing))
        (unless (or localp existing)
          (erc-with-server-buffer (setq erc-track--normal-faces table))))
    (kill-local-variable 'erc-track--normal-faces)))