Function: ghostel--yank-media-data

ghostel--yank-media-data is a natively compiled function defined in ghostel.el.

Signature

(ghostel--yank-media-data MIMETYPE DATA)

Documentation

Write clipboard DATA of MIMETYPE to a temp file and paste its path.

The file is created in the temp directory of the host the shell runs on. The shell receives the shell-quoted path followed by a space.

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel--yank-media-data (mimetype data)
  "Write clipboard DATA of MIMETYPE to a temp file and paste its path.
The file is created in the temp directory of the host the shell runs on.
The shell receives the shell-quoted path followed by a space."
  (unless (process-live-p ghostel--process)
    (user-error "Terminal has no live process"))
  (let* ((ext (pcase (cadr (split-string (symbol-name mimetype) "/"))
                ("svg+xml" "svg")
                (subtype subtype)))
         (coding-system-for-write 'binary)
         (temp (make-temp-file
                (expand-file-name "ghostel-clipboard-"
                                  (temporary-file-directory))
                nil (concat "." ext) data)))
    (ghostel--dnd-send-files
     (list (or (file-remote-p temp 'localname) temp)))))