diff options
| author | Kenichi Handa | 1997-10-21 10:43:40 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-10-21 10:43:40 +0000 |
| commit | 5faa9b4571f79df02c85a949cd3bc7f8c1f93c1f (patch) | |
| tree | e4a36b874949fabb15b8bc6b7a49b98b0c4cc862 /src | |
| parent | 48bad490010cf330931db04ee354134168b475a7 (diff) | |
| download | emacs-5faa9b4571f79df02c85a949cd3bc7f8c1f93c1f.tar.gz emacs-5faa9b4571f79df02c85a949cd3bc7f8c1f93c1f.zip | |
Include buffer.h.
(selection_data_to_lisp_data): Do not perform code conversion if
the default value of enable-multibyte-characters is nil.
(lisp_data_to_selection_data): Likewise. Access the array
`charsets' in the correct way.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xselect.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/src/xselect.c b/src/xselect.c index 190f74b66f3..88efb842950 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -27,6 +27,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 27 | #include "dispextern.h" /* frame.h seems to want this */ | 27 | #include "dispextern.h" /* frame.h seems to want this */ |
| 28 | #include "frame.h" /* Need this to get the X window of selected_frame */ | 28 | #include "frame.h" /* Need this to get the X window of selected_frame */ |
| 29 | #include "blockinput.h" | 29 | #include "blockinput.h" |
| 30 | #include "buffer.h" | ||
| 30 | #include "charset.h" | 31 | #include "charset.h" |
| 31 | #include "coding.h" | 32 | #include "coding.h" |
| 32 | 33 | ||
| @@ -1468,22 +1469,26 @@ selection_data_to_lisp_data (display, data, size, type, format) | |||
| 1468 | Lisp_Object str; | 1469 | Lisp_Object str; |
| 1469 | int require_encoding = 0; | 1470 | int require_encoding = 0; |
| 1470 | 1471 | ||
| 1471 | /* If TYPE is `TEXT' or `COMPOUND_TEXT', we should decode DATA | 1472 | if (! NILP (buffer_defaults.enable_multibyte_characters)) |
| 1472 | to Emacs internal format because DATA may be encoded in | ||
| 1473 | compound text format. In addtion, if TYPE is `STRING' and | ||
| 1474 | DATA contains any 8-bit Latin-1 code, we should also decode | ||
| 1475 | it. */ | ||
| 1476 | if (type == dpyinfo->Xatom_TEXT || type == dpyinfo->Xatom_COMPOUND_TEXT) | ||
| 1477 | require_encoding = 1; | ||
| 1478 | else if (type == XA_STRING) | ||
| 1479 | { | 1473 | { |
| 1480 | int i; | 1474 | /* If TYPE is `TEXT' or `COMPOUND_TEXT', we should decode |
| 1481 | for (i = 0; i < size; i++) | 1475 | DATA to Emacs internal format because DATA may be encoded |
| 1476 | in compound text format. In addtion, if TYPE is `STRING' | ||
| 1477 | and DATA contains any 8-bit Latin-1 code, we should also | ||
| 1478 | decode it. */ | ||
| 1479 | if (type == dpyinfo->Xatom_TEXT | ||
| 1480 | || type == dpyinfo->Xatom_COMPOUND_TEXT) | ||
| 1481 | require_encoding = 1; | ||
| 1482 | else if (type == XA_STRING) | ||
| 1482 | { | 1483 | { |
| 1483 | if (data[i] >= 0x80) | 1484 | int i; |
| 1485 | for (i = 0; i < size; i++) | ||
| 1484 | { | 1486 | { |
| 1485 | require_encoding = 1; | 1487 | if (data[i] >= 0x80) |
| 1486 | break; | 1488 | { |
| 1489 | require_encoding = 1; | ||
| 1490 | break; | ||
| 1491 | } | ||
| 1487 | } | 1492 | } |
| 1488 | } | 1493 | } |
| 1489 | } | 1494 | } |
| @@ -1608,7 +1613,8 @@ lisp_data_to_selection_data (display, obj, | |||
| 1608 | *size_ret = XSTRING (obj)->size; | 1613 | *size_ret = XSTRING (obj)->size; |
| 1609 | *data_ret = XSTRING (obj)->data; | 1614 | *data_ret = XSTRING (obj)->data; |
| 1610 | bzero (charsets, (MAX_CHARSET + 1) * sizeof (int)); | 1615 | bzero (charsets, (MAX_CHARSET + 1) * sizeof (int)); |
| 1611 | num = ((*size_ret <= 1) /* Check the possibility of short cut. */ | 1616 | num = ((*size_ret <= 1 /* Check the possibility of short cut. */ |
| 1617 | || NILP (buffer_defaults.enable_multibyte_characters)) | ||
| 1612 | ? 0 | 1618 | ? 0 |
| 1613 | : find_charset_in_str (*data_ret, *size_ret, charsets, Qnil)); | 1619 | : find_charset_in_str (*data_ret, *size_ret, charsets, Qnil)); |
| 1614 | 1620 | ||
| @@ -1636,7 +1642,7 @@ lisp_data_to_selection_data (display, obj, | |||
| 1636 | *size_ret = encode_coding (&coding, *data_ret, buf, | 1642 | *size_ret = encode_coding (&coding, *data_ret, buf, |
| 1637 | *size_ret, bufsize, &dummy); | 1643 | *size_ret, bufsize, &dummy); |
| 1638 | *data_ret = buf; | 1644 | *data_ret = buf; |
| 1639 | if (charsets[get_charset_id(charset_latin_iso8859_1)] | 1645 | if (charsets[charset_latin_iso8859_1] |
| 1640 | && (num == 1 || (num == 2 && charsets[CHARSET_ASCII]))) | 1646 | && (num == 1 || (num == 2 && charsets[CHARSET_ASCII]))) |
| 1641 | { | 1647 | { |
| 1642 | /* Ok, we can return it as `STRING'. */ | 1648 | /* Ok, we can return it as `STRING'. */ |