Function: erc-log--setup
erc-log--setup is a byte-compiled function defined in erc-log.el.gz.
Signature
(erc-log--setup)
Documentation
Perform buffer-local setup for ERC's log module.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc-log.el.gz
;; This module's differs from other global modules in that it allows for
;; effectively disabling itself in a subset of buffers by setting the
;; option `erc-enable-logging' locally to nil. Though not
;; permanent-local, this option's variable is never explicitly killed
;; when the module is disabled, such as via its mode command.
(defun erc-log--setup ()
"Perform buffer-local setup for ERC's log module."
(if erc-log-mode
(when (erc-logging-enabled)
;; If reconnecting, preserve `erc-last-saved-position' from prev
;; session and preempt `erc-initialize-log-marker' in `erc-open'.
(unless erc-last-saved-position
(when-let* ((priors (or erc--server-reconnecting erc--target-priors))
(val (alist-get 'erc-last-saved-position priors))
(_ (eq (current-buffer) (marker-buffer val))))
(setq erc-last-saved-position val)))
(auto-save-mode -1)
(setq buffer-file-name nil)
(add-hook 'write-file-functions #'erc-save-buffer-in-logs nil t)
(add-function :before (local 'erc--clear-function)
#'erc-log--save-on-clear '((depth . 50))))
(erc-log-disable-logging (current-buffer))))