Function: eca-chat--key-pressed-kill

eca-chat--key-pressed-kill is a natively compiled function defined in eca-chat.el.

Signature

(eca-chat--key-pressed-kill KILL-FN &rest ARGS)

Documentation

Apply KILL-FN with ARGS confined to the prompt field.

Inside the prompt field the buffer is narrowed to the field, so kill motions clamp at the field start instead of crossing the prompt/context markup above it and corrupting it (see #305). Above the prompt field the kill is blocked like other deletions.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
(defun eca-chat--key-pressed-kill (kill-fn &rest args)
  "Apply KILL-FN with ARGS confined to the prompt field.
Inside the prompt field the buffer is narrowed to the field, so
kill motions clamp at the field start instead of crossing the
prompt/context markup above it and corrupting it (see #305).
Above the prompt field the kill is blocked like other deletions."
  (if (derived-mode-p 'eca-chat-mode)
      (let ((prompt-start (eca-chat--prompt-field-start-point)))
        (cond
         ((null prompt-start) (apply kill-fn args))
         ((< (point) prompt-start) (ding))
         (t (save-restriction
              (narrow-to-region prompt-start (point-max))
              (apply kill-fn args)))))
    (apply kill-fn args)))