Function: yank-media-types--format

yank-media-types--format is a byte-compiled function defined in yank-media.el.gz.

Signature

(yank-media-types--format DATA-TYPE DATA)

Source Code

;; Defined in /usr/src/emacs/lisp/yank-media.el.gz
(defun yank-media-types--format (data-type data)
  (cond
   ((not (stringp data))
    (format "%s" data))
   ((string-match-p "\\`text/" (symbol-name data-type))
    ;; We may have utf-16, which Emacs won't detect automatically.
    (let ((coding-system (yank-media--utf-16-p data)))
      (if coding-system
          (decode-coding-string data coding-system)
        ;; Some programs add a nul character at the end of text/*
        ;; selections.  Remove that.
        (if (zerop (elt data (1- (length data))))
            (substring data 0 (1- (length data)))
          data))))
   (t
    data)))