diff options
| author | Jason Rumney | 2002-02-23 18:12:30 +0000 |
|---|---|---|
| committer | Jason Rumney | 2002-02-23 18:12:30 +0000 |
| commit | aab7e392f55abf638077a64c893f079fe15c2318 (patch) | |
| tree | 7b977c3c76f8f327904765c1fc82a4a178ee869f /src | |
| parent | 5a7a27be27659c78b8f5be00c1535dac8127e51a (diff) | |
| download | emacs-aab7e392f55abf638077a64c893f079fe15c2318.tar.gz emacs-aab7e392f55abf638077a64c893f079fe15c2318.zip | |
(Fw32_set_clipboard_data): Run pre-write-conversion
on the string before encoding it.
(Fw32_get_clipboard_data): Run post-read-conversion on the string
after decoding it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32select.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/src/w32select.c b/src/w32select.c index 92090ccde0f..fa37bd65926 100644 --- a/src/w32select.c +++ b/src/w32select.c | |||
| @@ -197,6 +197,13 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data, | |||
| 197 | Vnext_selection_coding_system = Vselection_coding_system; | 197 | Vnext_selection_coding_system = Vselection_coding_system; |
| 198 | setup_coding_system | 198 | setup_coding_system |
| 199 | (Fcheck_coding_system (Vnext_selection_coding_system), &coding); | 199 | (Fcheck_coding_system (Vnext_selection_coding_system), &coding); |
| 200 | if (SYMBOLP (coding.pre_write_conversion) | ||
| 201 | && !NILP (Ffboundp (coding.pre_write_conversion))) | ||
| 202 | { | ||
| 203 | string = run_pre_post_conversion_on_str (string, &coding, 1); | ||
| 204 | src = XSTRING (string)->data; | ||
| 205 | nbytes = STRING_BYTES (XSTRING (string)); | ||
| 206 | } | ||
| 200 | coding.src_multibyte = 1; | 207 | coding.src_multibyte = 1; |
| 201 | coding.dst_multibyte = 0; | 208 | coding.dst_multibyte = 0; |
| 202 | Vnext_selection_coding_system = Qnil; | 209 | Vnext_selection_coding_system = Qnil; |
| @@ -294,28 +301,21 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data, | |||
| 294 | && memcmp(last_clipboard_text, src, nbytes) == 0) | 301 | && memcmp(last_clipboard_text, src, nbytes) == 0) |
| 295 | goto closeclip; | 302 | goto closeclip; |
| 296 | 303 | ||
| 297 | if ( | 304 | { |
| 298 | #if 1 | 305 | /* If the clipboard data contains any non-ascii code, we |
| 299 | 1 | 306 | need to decode it. */ |
| 300 | #else | 307 | int i; |
| 301 | ! NILP (buffer_defaults.enable_multibyte_characters) | 308 | |
| 302 | #endif | 309 | for (i = 0; i < nbytes; i++) |
| 303 | ) | 310 | { |
| 304 | { | 311 | if (src[i] >= 0x80) |
| 305 | /* If the clipboard data contains any non-ascii code, we | 312 | { |
| 306 | need to decode it. */ | 313 | require_decoding = 1; |
| 307 | int i; | 314 | break; |
| 315 | } | ||
| 316 | } | ||
| 317 | } | ||
| 308 | 318 | ||
| 309 | for (i = 0; i < nbytes; i++) | ||
| 310 | { | ||
| 311 | if (src[i] >= 0x80) | ||
| 312 | { | ||
| 313 | require_decoding = 1; | ||
| 314 | break; | ||
| 315 | } | ||
| 316 | } | ||
| 317 | } | ||
| 318 | |||
| 319 | if (require_decoding) | 319 | if (require_decoding) |
| 320 | { | 320 | { |
| 321 | int bufsize; | 321 | int bufsize; |
| @@ -337,6 +337,9 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data, | |||
| 337 | ret = make_string_from_bytes ((char *) buf, | 337 | ret = make_string_from_bytes ((char *) buf, |
| 338 | coding.produced_char, coding.produced); | 338 | coding.produced_char, coding.produced); |
| 339 | xfree (buf); | 339 | xfree (buf); |
| 340 | if (SYMBOLP (coding.post_read_conversion) | ||
| 341 | && !NILP (Ffboundp (coding.post_read_conversion))) | ||
| 342 | ret = run_pre_post_conversion_on_str (ret, &coding, 0); | ||
| 340 | } | 343 | } |
| 341 | else | 344 | else |
| 342 | { | 345 | { |