Function: eca-chat-compose-mode

eca-chat-compose-mode is an interactive and natively compiled function defined in eca-chat-compose.el.

Signature

(eca-chat-compose-mode)

Documentation

Major mode for composing a prompt destined for an ECA chat.

The target chat is captured when the buffer is created by eca-chat-compose. Yanking a clipboard image inserts an @file mention pointing at a temporary screenshot file, mirroring the eca chat buffer behavior.

<tab> eca-chat-compose-tab
C-c C-c eca-chat-compose-send
C-c C-k eca-chat-compose-cancel
C-y eca-chat-compose-yank
TAB eca-chat-compose-tab

In addition to any hooks its parent mode gfm-mode might have run, this mode runs the hook eca-chat-compose-mode-hook, as the final or penultimate step during initialization.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat-compose.el
(eca-chat-define-derived-mode eca-chat-compose-mode "eca-chat-compose"
  "Major mode for composing a prompt destined for an ECA chat.
The target chat is captured when the buffer is created by
`eca-chat-compose'.  Yanking a clipboard image inserts an @file
mention pointing at a temporary screenshot file, mirroring the
eca chat buffer behavior.

\\{eca-chat-compose-mode-map}"
  (setq header-line-format
        (substitute-command-keys
         "Compose prompt: \\[eca-chat-compose-send] to send, \
\\[eca-chat-compose-cancel] to cancel"))
  ;; ECA server completion for @contexts and #filepaths, mirroring the
  ;; chat prompt setup including its completion-style overrides.
  (setq-local completion-at-point-functions (list #'eca-chat-completion-at-point))
  (setq-local completion-category-defaults
              (cons '(eca-capf (styles basic substring))
                    completion-category-defaults))
  (setq-local completion-ignore-case t)
  (eca-chat--setup-item-stickiness)
  (add-hook 'after-change-functions
            #'eca-chat--auto-show-image-thumbnails-after-change nil t)
  ;; Paste image from clipboard support, mirroring eca-chat-mode: drop
  ;; the handlers inherited from markdown-mode (which insert markdown
  ;; image links) and register the @file mention handler.
  (when (fboundp 'yank-media-handler)
    (setq-local yank-media--registered-handlers nil)
    (yank-media-handler "image/png" #'eca-chat-compose--yank-image-handler)
    (yank-media-handler "image/jpeg" #'eca-chat-compose--yank-image-handler)
    (yank-media-handler "image/jpg" #'eca-chat-compose--yank-image-handler)
    (yank-media-handler "image/gif" #'eca-chat-compose--yank-image-handler)
    (yank-media-handler "image/webp" #'eca-chat-compose--yank-image-handler)))