Function: erc--with-spliced-insertion
erc--with-spliced-insertion is a macro defined in erc.el.gz.
Signature
(erc--with-spliced-insertion MARKER-OR-POS &rest BODY)
Documentation
In BODY, ensure erc-insert-line inserts messages at MARKER-OR-POS.
If MARKER-OR-POS is a marker, let it advance normally (and permanently)
with each insertion. Allow modules to influence insertion by binding
erc--insert-line-function to erc--insert-line-splice-function around
BODY. Note that as of ERC 5.6, this macro cannot handle multiple
successive calls to erc-insert-line in BODY, such as when replaying
a history backlog.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defmacro erc--with-spliced-insertion (marker-or-pos &rest body)
"In BODY, ensure `erc-insert-line' inserts messages at MARKER-OR-POS.
If MARKER-OR-POS is a marker, let it advance normally (and permanently)
with each insertion. Allow modules to influence insertion by binding
`erc--insert-line-function' to `erc--insert-line-splice-function' around
BODY. Note that as of ERC 5.6, this macro cannot handle multiple
successive calls to `erc-insert-line' in BODY, such as when replaying
a history backlog."
(declare (indent 1))
(let ((marker (make-symbol "marker")))
`(progn
(cl-assert (= ?\n (char-before ,marker-or-pos)))
(cl-assert (null erc--insert-line-function))
(let* ((,marker (and (not (markerp ,marker-or-pos))
(copy-marker ,marker-or-pos)))
(erc--insert-marker (or ,marker ,marker-or-pos))
(erc--insert-line-function erc--insert-line-splice-function))
(prog1 (progn ,@body)
(when ,marker (set-marker ,marker nil)))))))