Function: erc--initialize-markers
erc--initialize-markers is a byte-compiled function defined in
erc.el.gz.
Signature
(erc--initialize-markers OLD-POINT CONTINUED-SESSION)
Documentation
Ensure prompt and its bounding markers have been initialized.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
;; This function doubles as a convenient helper for use in unit tests.
;; Prior to 5.6, its contents lived in `erc-open'.
(defun erc--initialize-markers (old-point continued-session)
"Ensure prompt and its bounding markers have been initialized."
;; FIXME erase assertions after code review and additional testing.
(setq erc-insert-marker (make-marker)
erc-input-marker (make-marker))
(if continued-session
(progn
;; Trust existing markers.
(set-marker erc-insert-marker
(alist-get 'erc-insert-marker continued-session))
(set-marker erc-input-marker
(alist-get 'erc-input-marker continued-session))
(set-marker-insertion-type erc-insert-marker t)
(cl-assert (= (field-end erc-insert-marker) erc-input-marker))
(goto-char old-point)
(let ((erc--hidden-prompt-overlay
(alist-get 'erc--hidden-prompt-overlay continued-session)))
(erc--unhide-prompt)))
(cl-assert (not (get-text-property (point) 'erc-prompt)))
;; In the original version from `erc-open', the snippet that
;; handled these newline insertions appeared twice close in
;; proximity, which was probably unintended. Nevertheless, we
;; preserve the double newlines here for historical reasons.
(insert "\n\n")
(set-marker erc-insert-marker (point))
(erc-display-prompt)
(set-marker-insertion-type erc-insert-marker t)
(cl-assert (= (point) (point-max)))))