- (let ((text
- (if (consp data-type)
- (condition-case err
- (get-selection-internal type (car data-type))
- (selection-conversion-error
- (if (cdr data-type)
- (get-selection type (cdr data-type))
- (signal (car err) (cdr err)))))
- (get-selection-internal type data-type))))
- text))
+ (if (consp data-type)
+ (condition-case err
+ (get-selection-internal type (car data-type))
+ (selection-conversion-error
+ (if (cdr data-type)
+ (get-selection type (cdr data-type))
+ (signal (car err) (cdr err)))))
+ (get-selection-internal type data-type)))
+
+(defun get-selection-foreign (&optional type data-type)
+ "Return the value of a window-system selection, or nil if XEmacs owns it.
+The argument TYPE (default `PRIMARY') says which selection,
+and the argument DATA-TYPE (default `STRING', or `COMPOUND_TEXT' under Mule)
+says how to convert the data. If there is no selection an error is signalled.
+See `interprogram-paste-function' for more information."
+ (unless (selection-owner-p type)
+ (get-selection type data-type)))