Function: xselect-convert-to-filename
xselect-convert-to-filename is a byte-compiled function defined in
select.el.gz.
Signature
(xselect-convert-to-filename SELECTION TYPE VALUE)
Source Code
;; Defined in /usr/src/emacs/lisp/select.el.gz
(defun xselect-convert-to-filename (selection _type value)
(if (not (eq selection 'XdndSelection))
(when (setq value (xselect--selection-bounds value))
(xselect--encode-string 'TEXT (buffer-file-name (nth 2 value))))
(if (and (stringp value)
(file-exists-p value))
;; Motif expects this to be STRING, but it treats the data as
;; a sequence of bytes instead of a Latin-1 string.
(cons 'STRING (encode-coding-string (expand-file-name value)
(or file-name-coding-system
default-file-name-coding-system)))
(when (vectorp value)
(with-temp-buffer
(cl-loop for file across value
do (insert (expand-file-name file) "\0"))
;; Get rid of the last NULL byte.
(when (> (point) 1)
(delete-char -1))
;; Motif wants STRING.
(cons 'STRING (encode-coding-string (buffer-string)
(or file-name-coding-system
default-file-name-coding-system))))))))