Function: x-dnd-choose-type
x-dnd-choose-type is a byte-compiled function defined in x-dnd.el.gz.
Signature
(x-dnd-choose-type TYPES &optional KNOWN-TYPES)
Documentation
Choose which type we want to receive for the drop.
TYPES are the types the source of the drop offers, a vector of type names
as strings or symbols. Select among the types in x-dnd-known-types or
KNOWN-TYPES if given, and return that type name.
If no suitable type is found, return nil.
Source Code
;; Defined in /usr/src/emacs/lisp/x-dnd.el.gz
(defun x-dnd-choose-type (types &optional known-types)
"Choose which type we want to receive for the drop.
TYPES are the types the source of the drop offers, a vector of type names
as strings or symbols. Select among the types in `x-dnd-known-types' or
KNOWN-TYPES if given, and return that type name.
If no suitable type is found, return nil."
(let* ((known-list (or known-types x-dnd-known-types))
(first-known-type (car known-list))
(types-array types)
(found (when first-known-type
(catch 'done
(dotimes (i (length types-array))
(let* ((type (aref types-array i))
(typename (if (symbolp type)
(symbol-name type) type)))
(when (equal first-known-type typename)
(throw 'done first-known-type))))
nil))))
(if (and (not found) (cdr known-list))
(x-dnd-choose-type types (cdr known-list))
found)))