Function: eca-chat--completion-context-from-prompt-exit-function

eca-chat--completion-context-from-prompt-exit-function is a natively compiled function defined in eca-chat-context.el.

Signature

(eca-chat--completion-context-from-prompt-exit-function ITEM STATUS)

Documentation

Add to context the selected ITEM.

Add text property to prompt text to match context. Directories are not finalized: completion keeps going inside them; typing a space turns the directory into a context.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat-context.el
(defun eca-chat--completion-context-from-prompt-exit-function (item _status)
  "Add to context the selected ITEM.
Add text property to prompt text to match context.  Directories
are not finalized: completion keeps going inside them; typing a
space turns the directory into a context."
  (if (eca-chat--completion-item-directory-p item)
      (eca-chat--completion-drill-in eca-chat-context-prefix)
    (let ((context (get-text-property 0 'eca-chat-completion-item item)))
      (let ((start-pos (save-excursion
                         (search-backward eca-chat-context-prefix (line-beginning-position) t)))
            (end-pos (point)))
        (delete-region start-pos end-pos)
        (eca-chat--insert (eca-chat--context->str context 'static))))
    (eca-chat--insert " ")))