Function: eca-chat--protect-non-prompt

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

Signature

(eca-chat--protect-non-prompt &optional FROM)

Documentation

Make the chat history, separator and task area read-only.

Apply the read-only text property from FROM (default point-min) up to the progress area so the history, the prompt separator and the task area are locked, while the progress, context and prompt input stay editable. The first protected char is front-sticky and the last is rear-nonsticky for read-only, so the locked region rejects edits while typing in the progress/context/prompt still works. No-op when eca-chat-read-only-history is nil or the boundary is absent.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
(defun eca-chat--protect-non-prompt (&optional from)
  "Make the chat history, separator and task area read-only.
Apply the `read-only' text property from FROM (default
`point-min') up to the progress area so the history, the prompt
separator and the task area are locked, while the progress,
context and prompt input stay editable.  The first protected char
is `front-sticky' and the last is `rear-nonsticky' for
`read-only', so the locked region rejects edits while typing in
the progress/context/prompt still works.  No-op when
`eca-chat-read-only-history' is nil or the boundary is absent."
  (when eca-chat-read-only-history
    (when-let* ((end (eca-chat--read-only-end-point)))
      (let ((inhibit-read-only t)
            (beg (max (point-min) (or from (point-min)))))
        (when (< beg end)
          (put-text-property beg end 'read-only t)
          (put-text-property (1- end) end 'rear-nonsticky '(read-only))
          (when (= beg (point-min))
            (put-text-property (point-min) (1+ (point-min))
                               'front-sticky '(read-only))))))))