Function: eca-chat--insert-prompt

eca-chat--insert-prompt is a natively compiled function defined in eca-chat.el.

Signature

(eca-chat--insert-prompt TEXT)

Documentation

Insert TEXT to latest chat prompt point unless point is already in prompt.

A space goes before TEXT on an empty line or when TEXT would be glued to the word before it. Return the position after TEXT.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
(defun eca-chat--insert-prompt (text)
  "Insert TEXT to latest chat prompt point unless point is already in prompt.
A space goes before TEXT on an empty line or when TEXT would be
glued to the word before it.  Return the position after TEXT."
  (save-excursion
    (unless (eca-chat--point-at-prompt-field-p)
      (goto-char (eca-chat--prompt-field-start-point))
      (goto-char (line-end-position)))
    (when (or (= (line-beginning-position) (line-end-position))
              (not (memq (char-before) '(nil ?\s ?\t ?\n))))
      (eca-chat--insert " "))
    (eca-chat--insert text)
    (point)))