Function: x-dnd-convert-to-offix
x-dnd-convert-to-offix is a byte-compiled function defined in
x-dnd.el.gz.
Signature
(x-dnd-convert-to-offix TARGETS LOCAL-SELECTION)
Documentation
Convert local selection data to OffiX data.
TARGETS should be the list of targets currently available in
XdndSelection. Return a list of an OffiX type, and data
suitable for passing to x-change-window-property, or nil if the
data could not be converted.
LOCAL-SELECTION should be the local selection data describing the
selection data to convert.
Source Code
;; Defined in /usr/src/emacs/lisp/x-dnd.el.gz
(defun x-dnd-convert-to-offix (targets local-selection)
"Convert local selection data to OffiX data.
TARGETS should be the list of targets currently available in
`XdndSelection'. Return a list of an OffiX type, and data
suitable for passing to `x-change-window-property', or nil if the
data could not be converted.
LOCAL-SELECTION should be the local selection data describing the
selection data to convert."
(let ((x-treat-local-requests-remotely t)
file-name-data string-data)
(cond
((and (member "FILE_NAME" targets)
(setq file-name-data
(x-get-local-selection local-selection 'FILE_NAME)))
(if (string-match-p "\0" file-name-data)
;; This means there are multiple file names in
;; XdndSelection. Convert the file name data to a format
;; that OffiX understands.
(cons 'DndTypeFiles (concat file-name-data "\0\0"))
(cons 'DndTypeFile (concat file-name-data "\0"))))
((and (member "STRING" targets)
(setq string-data
(x-get-local-selection local-selection 'STRING)))
(cons 'DndTypeText (encode-coding-string string-data
'latin-1))))))