X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fselect.c;h=9e6447e74cd073dd3e2d4042746a1e0d85e73bdf;hb=d3c5cd1b305a4b61e27abfc5a43d0d9f711eab8b;hp=6c1076d3b1106d317a821ac27218f2288ea937a3;hpb=59eec5f21669e81977b5b1fe9bf717cab49cf7fb;p=chise%2Fxemacs-chise.git.1 diff --git a/src/select.c b/src/select.c index 6c1076d..9e6447e 100644 --- a/src/select.c +++ b/src/select.c @@ -134,13 +134,16 @@ get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type) #endif DEFUN ("own-selection-internal", Fown_selection_internal, 2, 5, 0, /* -Assert a selection of the given NAME with the given VALUE, and -optional window-system DATA-TYPE. HOW-TO-ADD specifies how the -selection will be combined with any existing selection(s) - see -`own-selection' for more information. -NAME is a symbol, typically PRIMARY, SECONDARY, or CLIPBOARD. -VALUE is typically a string, or a cons of two markers, but may be +Give the selection SELECTION-NAME the value SELECTION-VALUE. +SELECTION-NAME is a symbol, typically PRIMARY, SECONDARY, or CLIPBOARD. +SELECTION-VALUE is typically a string, or a cons of two markers, but may be anything that the functions on selection-converter-out-alist know about. +Optional arg HOW-TO-ADD specifies how the selection will be combined +with any existing selection(s) - see `own-selection' for more +information. +Optional arg DATA-TYPE is a window-system-specific type. +Optional arg DEVICE specifies the device on which to assert the selection. +It defaults to the selected device. */ (selection_name, selection_value, how_to_add, data_type, device)) { @@ -148,6 +151,7 @@ anything that the functions on selection-converter-out-alist know about. value_list = Qnil; Lisp_Object prev_real_value = Qnil; struct gcpro gcpro1; + int owned_p = 0; CHECK_SYMBOL (selection_name); if (NILP (selection_value)) error ("selection-value may not be nil."); @@ -177,6 +181,7 @@ anything that the functions on selection-converter-out-alist know about. if (!NILP (local_selection_data)) { + owned_p = 1; /* Don't use Fdelq() as that may QUIT;. */ if (EQ (local_selection_data, Fcar (Vselection_alist))) Vselection_alist = Fcdr (Vselection_alist); @@ -198,7 +203,10 @@ anything that the functions on selection-converter-out-alist know about. prev_value = assq_no_quit (selection_name, Vselection_alist); if (!NILP (prev_value)) - value_list = XCAR (XCDR (prev_value)); + { + owned_p = 1; + value_list = XCAR (XCDR (prev_value)); + } if (!NILP (value_list)) prev_real_value = assq_no_quit (data_type, value_list); @@ -277,7 +285,7 @@ anything that the functions on selection-converter-out-alist know about. if (HAS_DEVMETH_P (XDEVICE (device), own_selection)) selection_time = DEVMETH (XDEVICE (device), own_selection, (selection_name, selection_value, - how_to_add, data_type)); + how_to_add, data_type, owned_p)); else selection_time = Qnil; @@ -441,8 +449,8 @@ If we own the named selection, then disown it (make there be no selection). } DEFUN ("selection-owner-p", Fselection_owner_p, 0, 1, 0, /* -Return t if current emacs process owns the given Selection. -The arg should be the name of the selection in question, typically one of +Return t if the current emacs process owns SELECTION. +SELECTION should be the name of the selection in question, typically one of the symbols PRIMARY, SECONDARY, or CLIPBOARD. (For convenience, the symbol nil is the same as PRIMARY, and t is the same as SECONDARY.) */ @@ -456,11 +464,11 @@ nil is the same as PRIMARY, and t is the same as SECONDARY.) } DEFUN ("selection-exists-p", Fselection_exists_p, 0, 3, 0, /* -Whether there is an owner for the given Selection. -The arg should be the name of the selection in question, typically one of +Whether there is currently an owner for SELECTION. +SELECTION should be the name of the selection in question, typically one of the symbols PRIMARY, SECONDARY, or CLIPBOARD. (For convenience, the symbol nil is the same as PRIMARY, and t is the same as SECONDARY.) -Optionally the DEVICE and the window-system DATA-TYPE may be specified. +Optionally, the window-system DATA-TYPE and the DEVICE may be specified. */ (selection, data_type, device)) { @@ -499,18 +507,18 @@ visible from Lisp. */ DEFUN ("get-selection-internal", Fget_selection_internal, 2, 3, 0, /* Return text selected from some window-system window. -SELECTION_SYMBOL is a symbol, typically PRIMARY, SECONDARY, or CLIPBOARD. -TARGET_TYPE is the type of data desired, typically STRING or COMPOUND_TEXT. +SELECTION is a symbol, typically PRIMARY, SECONDARY, or CLIPBOARD. +TARGET-TYPE is the type of data desired, typically STRING or COMPOUND_TEXT. Under Mule, if the resultant data comes back as 8-bit data in type TEXT or COMPOUND_TEXT, it will be decoded as Compound Text. */ - (selection_symbol, target_type, device)) + (selection, target_type, device)) { /* This function can GC */ Lisp_Object val = Qnil; struct gcpro gcpro1, gcpro2; GCPRO2 (target_type, val); - CHECK_SYMBOL (selection_symbol); + CHECK_SYMBOL (selection); if (NILP (device)) device = Fselected_device (Qnil); @@ -538,19 +546,19 @@ TEXT or COMPOUND_TEXT, it will be decoded as Compound Text. the device (in which case target_type would be a device-specific identifier - probably an integer) - ajh */ - val = get_local_selection (selection_symbol, target_type); + val = get_local_selection (selection, target_type); if (!NILP (val)) { /* If we get something from the local cache, we may need to convert it slightly - to do this, we call select-coerce */ - val = call3 (Qselect_coerce, selection_symbol, target_type, val); + val = call3 (Qselect_coerce, selection, target_type, val); } else if (HAS_DEVMETH_P (XDEVICE (device), get_foreign_selection)) { /* Nothing in the local cache; try the window system */ val = DEVMETH (XDEVICE (device), get_foreign_selection, - (selection_symbol, target_type)); + (selection, target_type)); } if (NILP (val)) @@ -562,12 +570,12 @@ TEXT or COMPOUND_TEXT, it will be decoded as Compound Text. the first for which a conversion succeeds gets returned. */ EXTERNAL_LIST_LOOP_2 (element, Vselection_coercible_types) { - val = get_local_selection (selection_symbol, element); + val = get_local_selection (selection, element); if (NILP (val)) continue; - val = call3 (Qselect_coerce, selection_symbol, target_type, val); + val = call3 (Qselect_coerce, selection, target_type, val); if (!NILP (val)) break;