comparison src/select.c @ 444:576fb035e263 r21-2-37

Import from CVS: tag r21-2-37
author cvs
date Mon, 13 Aug 2007 11:36:19 +0200
parents abe6d1db359e
children e7ef97881643
comparison
equal deleted inserted replaced
443:a8296e22da4e 444:576fb035e263
132 return pairs; 132 return pairs;
133 } 133 }
134 #endif 134 #endif
135 135
136 DEFUN ("own-selection-internal", Fown_selection_internal, 2, 5, 0, /* 136 DEFUN ("own-selection-internal", Fown_selection_internal, 2, 5, 0, /*
137 Assert a selection of the given NAME with the given VALUE, and 137 Give the selection SELECTION-NAME the value SELECTION-VALUE.
138 optional window-system DATA-TYPE. HOW-TO-ADD specifies how the 138 SELECTION-NAME is a symbol, typically PRIMARY, SECONDARY, or CLIPBOARD.
139 selection will be combined with any existing selection(s) - see 139 SELECTION-VALUE is typically a string, or a cons of two markers, but may be
140 `own-selection' for more information.
141 NAME is a symbol, typically PRIMARY, SECONDARY, or CLIPBOARD.
142 VALUE is typically a string, or a cons of two markers, but may be
143 anything that the functions on selection-converter-out-alist know about. 140 anything that the functions on selection-converter-out-alist know about.
141 Optional arg HOW-TO-ADD specifies how the selection will be combined
142 with any existing selection(s) - see `own-selection' for more
143 information.
144 Optional arg DATA-TYPE is a window-system-specific type.
145 Optional arg DEVICE specifies the device on which to assert the selection.
146 It defaults to the selected device.
144 */ 147 */
145 (selection_name, selection_value, how_to_add, data_type, device)) 148 (selection_name, selection_value, how_to_add, data_type, device))
146 { 149 {
147 Lisp_Object selection_time, selection_data, prev_value = Qnil, 150 Lisp_Object selection_time, selection_data, prev_value = Qnil,
148 value_list = Qnil; 151 value_list = Qnil;
439 442
440 return Qt; 443 return Qt;
441 } 444 }
442 445
443 DEFUN ("selection-owner-p", Fselection_owner_p, 0, 1, 0, /* 446 DEFUN ("selection-owner-p", Fselection_owner_p, 0, 1, 0, /*
444 Return t if current emacs process owns the given Selection. 447 Return t if the current emacs process owns SELECTION.
445 The arg should be the name of the selection in question, typically one of 448 SELECTION should be the name of the selection in question, typically one of
446 the symbols PRIMARY, SECONDARY, or CLIPBOARD. (For convenience, the symbol 449 the symbols PRIMARY, SECONDARY, or CLIPBOARD. (For convenience, the symbol
447 nil is the same as PRIMARY, and t is the same as SECONDARY.) 450 nil is the same as PRIMARY, and t is the same as SECONDARY.)
448 */ 451 */
449 (selection)) 452 (selection))
450 { 453 {
454 457
455 return NILP (Fassq (selection, Vselection_alist)) ? Qnil : Qt; 458 return NILP (Fassq (selection, Vselection_alist)) ? Qnil : Qt;
456 } 459 }
457 460
458 DEFUN ("selection-exists-p", Fselection_exists_p, 0, 3, 0, /* 461 DEFUN ("selection-exists-p", Fselection_exists_p, 0, 3, 0, /*
459 Whether there is an owner for the given Selection. 462 Whether there is currently an owner for SELECTION.
460 The arg should be the name of the selection in question, typically one of 463 SELECTION should be the name of the selection in question, typically one of
461 the symbols PRIMARY, SECONDARY, or CLIPBOARD. (For convenience, the symbol 464 the symbols PRIMARY, SECONDARY, or CLIPBOARD. (For convenience, the symbol
462 nil is the same as PRIMARY, and t is the same as SECONDARY.) 465 nil is the same as PRIMARY, and t is the same as SECONDARY.)
463 Optionally the DEVICE and the window-system DATA-TYPE may be specified. 466 Optionally, the window-system DATA-TYPE and the DEVICE may be specified.
464 */ 467 */
465 (selection, data_type, device)) 468 (selection, data_type, device))
466 { 469 {
467 CHECK_SYMBOL (selection); 470 CHECK_SYMBOL (selection);
468 if (NILP (data_type) 471 if (NILP (data_type)
497 simply return our selection value. If we are not the owner, this 500 simply return our selection value. If we are not the owner, this
498 will block until all of the data has arrived. 501 will block until all of the data has arrived.
499 */ 502 */
500 DEFUN ("get-selection-internal", Fget_selection_internal, 2, 3, 0, /* 503 DEFUN ("get-selection-internal", Fget_selection_internal, 2, 3, 0, /*
501 Return text selected from some window-system window. 504 Return text selected from some window-system window.
502 SELECTION_SYMBOL is a symbol, typically PRIMARY, SECONDARY, or CLIPBOARD. 505 SELECTION is a symbol, typically PRIMARY, SECONDARY, or CLIPBOARD.
503 TARGET_TYPE is the type of data desired, typically STRING or COMPOUND_TEXT. 506 TARGET-TYPE is the type of data desired, typically STRING or COMPOUND_TEXT.
504 Under Mule, if the resultant data comes back as 8-bit data in type 507 Under Mule, if the resultant data comes back as 8-bit data in type
505 TEXT or COMPOUND_TEXT, it will be decoded as Compound Text. 508 TEXT or COMPOUND_TEXT, it will be decoded as Compound Text.
506 */ 509 */
507 (selection_symbol, target_type, device)) 510 (selection, target_type, device))
508 { 511 {
509 /* This function can GC */ 512 /* This function can GC */
510 Lisp_Object val = Qnil; 513 Lisp_Object val = Qnil;
511 struct gcpro gcpro1, gcpro2; 514 struct gcpro gcpro1, gcpro2;
512 GCPRO2 (target_type, val); 515 GCPRO2 (target_type, val);
513 CHECK_SYMBOL (selection_symbol); 516 CHECK_SYMBOL (selection);
514 517
515 if (NILP (device)) 518 if (NILP (device))
516 device = Fselected_device (Qnil); 519 device = Fselected_device (Qnil);
517 520
518 #ifdef MULE 521 #ifdef MULE
536 /* Used to check that target_type was a symbol. This is no longer 539 /* Used to check that target_type was a symbol. This is no longer
537 necessarily the case, because the type might be registered with 540 necessarily the case, because the type might be registered with
538 the device (in which case target_type would be a device-specific 541 the device (in which case target_type would be a device-specific
539 identifier - probably an integer) - ajh */ 542 identifier - probably an integer) - ajh */
540 543
541 val = get_local_selection (selection_symbol, target_type); 544 val = get_local_selection (selection, target_type);
542 545
543 if (!NILP (val)) 546 if (!NILP (val))
544 { 547 {
545 /* If we get something from the local cache, we may need to convert 548 /* If we get something from the local cache, we may need to convert
546 it slightly - to do this, we call select-coerce */ 549 it slightly - to do this, we call select-coerce */
547 val = call3 (Qselect_coerce, selection_symbol, target_type, val); 550 val = call3 (Qselect_coerce, selection, target_type, val);
548 } 551 }
549 else if (HAS_DEVMETH_P (XDEVICE (device), get_foreign_selection)) 552 else if (HAS_DEVMETH_P (XDEVICE (device), get_foreign_selection))
550 { 553 {
551 /* Nothing in the local cache; try the window system */ 554 /* Nothing in the local cache; try the window system */
552 val = DEVMETH (XDEVICE (device), get_foreign_selection, 555 val = DEVMETH (XDEVICE (device), get_foreign_selection,
553 (selection_symbol, target_type)); 556 (selection, target_type));
554 } 557 }
555 558
556 if (NILP (val)) 559 if (NILP (val))
557 { 560 {
558 /* Still nothing. Try coercion. */ 561 /* Still nothing. Try coercion. */
560 /* Try looking in selection-coercible-types to see if any of 563 /* Try looking in selection-coercible-types to see if any of
561 them are present for this selection. We try them *in order*; 564 them are present for this selection. We try them *in order*;
562 the first for which a conversion succeeds gets returned. */ 565 the first for which a conversion succeeds gets returned. */
563 EXTERNAL_LIST_LOOP_2 (element, Vselection_coercible_types) 566 EXTERNAL_LIST_LOOP_2 (element, Vselection_coercible_types)
564 { 567 {
565 val = get_local_selection (selection_symbol, element); 568 val = get_local_selection (selection, element);
566 569
567 if (NILP (val)) 570 if (NILP (val))
568 continue; 571 continue;
569 572
570 val = call3 (Qselect_coerce, selection_symbol, target_type, val); 573 val = call3 (Qselect_coerce, selection, target_type, val);
571 574
572 if (!NILP (val)) 575 if (!NILP (val))
573 break; 576 break;
574 } 577 }
575 } 578 }