diff options
| author | Kenichi Handa | 1997-08-03 03:02:05 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-08-03 03:02:05 +0000 |
| commit | 2584c9ec2b4772ec590fcff3a488948dd870fd4a (patch) | |
| tree | 1f069c5dd39ceedfd9dde494f0ad874dd46fe2d8 /src | |
| parent | 684295dbd3e38ba95c320dca27a67466e3abbdfa (diff) | |
| download | emacs-2584c9ec2b4772ec590fcff3a488948dd870fd4a.tar.gz emacs-2584c9ec2b4772ec590fcff3a488948dd870fd4a.zip | |
(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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xselect.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/xselect.c b/src/xselect.c index b6168a024a7..1bff6772168 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -45,6 +45,9 @@ Lisp_Object QCUT_BUFFER0, QCUT_BUFFER1, QCUT_BUFFER2, QCUT_BUFFER3, | |||
| 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 |
| @@ -1491,10 +1494,10 @@ selection_data_to_lisp_data (display, data, size, type, format) | |||
| 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"); | ||
| 1495 | 1497 | ||
| 1496 | setup_coding_system (Fcheck_coding_system (sym), &coding); | 1498 | setup_coding_system |
| 1497 | coding.last_block = 1; | 1499 | (Fcheck_coding_system(Vclipboard_coding_system), &coding); |
| 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); |
| @@ -1624,16 +1627,16 @@ lisp_data_to_selection_data (display, obj, | |||
| 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"); | ||
| 1628 | 1630 | ||
| 1629 | setup_coding_system (Fcheck_coding_system (sym), &coding); | 1631 | setup_coding_system |
| 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'. */ |
| @@ -2261,6 +2264,14 @@ 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\ |