Function: erc-truncate-buffer
erc-truncate-buffer is an autoloaded, interactive and byte-compiled
function defined in erc-truncate.el.gz.
Signature
(erc-truncate-buffer)
Documentation
Truncate current buffer to erc-max-buffer-size.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc-truncate.el.gz
;;;###autoload
(defun erc-truncate-buffer ()
"Truncate current buffer to `erc-max-buffer-size'."
(interactive)
;; This `save-excursion' only exists for historical reasons because
;; `erc-truncate-buffer-to-size' normally runs in a different buffer.
(save-excursion
(if (and erc--parsed-response erc--msg-props)
(when-let*
(((not erc--inhibit-clear-p))
((not (erc--memq-msg-prop 'erc--skip 'truncate)))
;; Determine here because this may be a target buffer and
;; the hook always runs in the server buffer.
(size (if (and erc-truncate--buffer-size
(> erc-truncate--buffer-size erc-max-buffer-size))
erc-truncate--buffer-size
erc-max-buffer-size))
(symbol (make-symbol "erc-truncate--buffer-deferred"))
(buffer (current-buffer)))
(fset symbol
(lambda (&rest _)
(remove-hook 'erc-timer-hook symbol t)
(erc-truncate-buffer-to-size size buffer)))
(erc-with-server-buffer (add-hook 'erc-timer-hook symbol -80 t)))
(unless erc--inhibit-clear-p
(erc-truncate-buffer-to-size erc-max-buffer-size)))))