Function: erc--refresh-prompt

erc--refresh-prompt is a byte-compiled function defined in erc.el.gz.

Signature

(erc--refresh-prompt)

Documentation

Re-render ERC's prompt when the option erc-prompt(var)/erc-prompt(fun) is a function.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc--refresh-prompt ()
  "Re-render ERC's prompt when the option `erc-prompt' is a function."
  (erc--assert-input-bounds)
  (unless (erc--prompt-hidden-p)
    (let ((erc--refresh-prompt-continue-request
           (or erc--refresh-prompt-continue-request 0)))
      (when (functionp erc-prompt)
        (save-excursion
          (goto-char (1- erc-input-marker))
          ;; Avoid `erc-prompt' (the named function), which appends a
          ;; space, and `erc-display-prompt', which propertizes all
          ;; but that space.
          (let ((s (funcall erc-prompt))
                (p (point))
                (erc--merge-prop-behind-p t))
            (erc--merge-prop 0 (length s) 'font-lock-face 'erc-prompt-face s)
            (add-text-properties 0 (length s) erc--prompt-properties s)
            (insert s)
            (delete-region erc-insert-marker p))))
      (run-hooks 'erc--refresh-prompt-hook)
      (when-let* (((> erc--refresh-prompt-continue-request 0))
                  (n erc--refresh-prompt-continue-request)
                  (erc--refresh-prompt-continue-request -1)
                  (b (current-buffer)))
        (erc-with-all-buffers-of-server erc-server-process
            (lambda () (not (eq b (current-buffer))))
          (if (= n 1)
              (run-hooks 'erc--refresh-prompt-hook)
            (erc--refresh-prompt)))))))