comparison src/xselect.c @ 19094:3f7a3248883b

(Vclipboard_coding_system): New variable. (selection_data_to_lisp_data): Decode text by Vclipboard_coding_system. (lisp_data_to_selection_data): Encode text by Vclipboard_coding_system. (syms_of_xselect): Declare clipboard-coding-system as Lisp variable and initialize it.
author Kenichi Handa <handa@m17n.org>
date Sun, 03 Aug 1997 03:02:05 +0000
parents 4e695c86585c
children 92a9271ea062
comparison
equal deleted inserted replaced
19093:b3433731b84c 19094:3f7a3248883b
43 QCUT_BUFFER4, QCUT_BUFFER5, QCUT_BUFFER6, QCUT_BUFFER7; 43 QCUT_BUFFER4, QCUT_BUFFER5, QCUT_BUFFER6, QCUT_BUFFER7;
44 #endif 44 #endif
45 45
46 static Lisp_Object Vx_lost_selection_hooks; 46 static Lisp_Object Vx_lost_selection_hooks;
47 static Lisp_Object Vx_sent_selection_hooks; 47 static Lisp_Object Vx_sent_selection_hooks;
48 /* Coding system for communicating with other X clients via cutbuffer,
49 selection, and clipboard. */
50 static Lisp_Object Vclipboard_coding_system;
48 51
49 /* If this is a smaller number than the max-request-size of the display, 52 /* If this is a smaller number than the max-request-size of the display,
50 emacs will use INCR selection transfer when the selection is larger 53 emacs will use INCR selection transfer when the selection is larger
51 than this. The max-request-size is usually around 64k, so if you want 54 than this. The max-request-size is usually around 64k, so if you want
52 emacs to use incremental selection transfers when the selection is 55 emacs to use incremental selection transfers when the selection is
1489 else 1492 else
1490 { 1493 {
1491 int bufsize, dummy; 1494 int bufsize, dummy;
1492 unsigned char *buf; 1495 unsigned char *buf;
1493 struct coding_system coding; 1496 struct coding_system coding;
1494 Lisp_Object sym = intern ("iso-latin-1"); 1497
1495 1498 setup_coding_system
1496 setup_coding_system (Fcheck_coding_system (sym), &coding); 1499 (Fcheck_coding_system(Vclipboard_coding_system), &coding);
1497 coding.last_block = 1; 1500 coding.last_block = 1;
1498 bufsize = decoding_buffer_size (&coding, size); 1501 bufsize = decoding_buffer_size (&coding, size);
1499 buf = (unsigned char *) xmalloc (bufsize); 1502 buf = (unsigned char *) xmalloc (bufsize);
1500 size = decode_coding (&coding, data, buf, size, bufsize, &dummy); 1503 size = decode_coding (&coding, data, buf, size, bufsize, &dummy);
1501 str = make_string ((char *) buf, size); 1504 str = make_string ((char *) buf, size);
1502 free (buf); 1505 free (buf);
1622 expects if OBJ contains only ASCII and Latin-1 1625 expects if OBJ contains only ASCII and Latin-1
1623 characters. */ 1626 characters. */
1624 int bufsize, dummy; 1627 int bufsize, dummy;
1625 unsigned char *buf; 1628 unsigned char *buf;
1626 struct coding_system coding; 1629 struct coding_system coding;
1627 Lisp_Object sym = intern ("iso-latin-1"); 1630
1628 1631 setup_coding_system
1629 setup_coding_system (Fcheck_coding_system (sym), &coding); 1632 (Fcheck_coding_system (Vclipboard_coding_system), &coding);
1630 coding.last_block = 1; 1633 coding.last_block = 1;
1631 bufsize = encoding_buffer_size (&coding, *size_ret); 1634 bufsize = encoding_buffer_size (&coding, *size_ret);
1632 buf = (unsigned char *) xmalloc (bufsize); 1635 buf = (unsigned char *) xmalloc (bufsize);
1633 *size_ret = encode_coding (&coding, *data_ret, buf, 1636 *size_ret = encode_coding (&coding, *data_ret, buf,
1634 *size_ret, bufsize, &dummy); 1637 *size_ret, bufsize, &dummy);
1635 *data_ret = buf; 1638 *data_ret = buf;
1636 if (charsets[charset_latin_iso8859_1] 1639 if (charsets[get_charset_id(charset_latin_iso8859_1)]
1637 && (num == 1 || (num == 2 && charsets[CHARSET_ASCII]))) 1640 && (num == 1 || (num == 2 && charsets[CHARSET_ASCII])))
1638 { 1641 {
1639 /* Ok, we can return it as `STRING'. */ 1642 /* Ok, we can return it as `STRING'. */
1640 if (NILP (type)) type = QSTRING; 1643 if (NILP (type)) type = QSTRING;
1641 } 1644 }
2259 to convert into a type that we don't know about or that is inappropriate.\n\ 2262 to convert into a type that we don't know about or that is inappropriate.\n\
2260 This hook doesn't let you change the behavior of Emacs's selection replies,\n\ 2263 This hook doesn't let you change the behavior of Emacs's selection replies,\n\
2261 it merely informs you that they have happened."); 2264 it merely informs you that they have happened.");
2262 Vx_sent_selection_hooks = Qnil; 2265 Vx_sent_selection_hooks = Qnil;
2263 2266
2267 DEFVAR_LISP("clipboard-coding-system", &Vclipboard_coding_system,
2268 "Coding system for communicating with other X clients.
2269 When sending or receiving text via cut_buffer, selection, and clipboard,
2270 the text is encoded or decoded by this coding system.
2271 A default value is `iso-latin-1'");
2272 Vclipboard_coding_system=intern ("iso-latin-1");
2273 staticpro(&Vclipboard_coding_system);
2274
2264 DEFVAR_INT ("x-selection-timeout", &x_selection_timeout, 2275 DEFVAR_INT ("x-selection-timeout", &x_selection_timeout,
2265 "Number of milliseconds to wait for a selection reply.\n\ 2276 "Number of milliseconds to wait for a selection reply.\n\
2266 If the selection owner doesn't reply in this time, we give up.\n\ 2277 If the selection owner doesn't reply in this time, we give up.\n\
2267 A value of 0 means wait as long as necessary. This is initialized from the\n\ 2278 A value of 0 means wait as long as necessary. This is initialized from the\n\
2268 \"*selectionTimeout\" resource."); 2279 \"*selectionTimeout\" resource.");