Function: eca-chat-media--save-clipboard-image

eca-chat-media--save-clipboard-image is a natively compiled function defined in eca-chat-context.el.

Signature

(eca-chat-media--save-clipboard-image TYPE DATA)

Documentation

Write clipboard image DATA of mime TYPE to a temp file.

Returns the path to the written file, or nil (after reporting the failure via eca-error) when writing fails. Shared by the eca chat buffer and the compose buffer clipboard-paste handlers.

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-media--save-clipboard-image (type data)
  "Write clipboard image DATA of mime TYPE to a temp file.
Returns the path to the written file, or nil (after reporting the
failure via `eca-error') when writing fails.  Shared by the eca
chat buffer and the compose buffer clipboard-paste handlers."
  (let* ((extension (eca-chat-media--extension-for-type type))
         (output-path (make-temp-file "eca-screenshot-" nil (concat "." extension))))
    (condition-case err
        (progn
          (let ((coding-system-for-write 'no-conversion))
            (write-region data nil output-path nil 'silent))
          (and (f-exists? output-path) output-path))
      (error
       (eca-error "Failed to save yanked image: %s" (error-message-string err))
       nil))))