aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32select.c
diff options
context:
space:
mode:
authorJason Rumney <[email protected]>2002-02-23 18:12:30 +0000
committerJason Rumney <[email protected]>2002-02-23 18:12:30 +0000
commitaab7e392f55abf638077a64c893f079fe15c2318 (patch)
tree7b977c3c76f8f327904765c1fc82a4a178ee869f /src/w32select.c
parent5a7a27be27659c78b8f5be00c1535dac8127e51a (diff)
(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/w32select.c')
-rw-r--r--src/w32select.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/src/w32select.c b/src/w32select.c
index 92090ccde0..fa37bd6592 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -197,6 +197,13 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
Vnext_selection_coding_system = Vselection_coding_system;
setup_coding_system
(Fcheck_coding_system (Vnext_selection_coding_system), &coding);
+ if (SYMBOLP (coding.pre_write_conversion)
+ && !NILP (Ffboundp (coding.pre_write_conversion)))
+ {
+ string = run_pre_post_conversion_on_str (string, &coding, 1);
+ src = XSTRING (string)->data;
+ nbytes = STRING_BYTES (XSTRING (string));
+ }
coding.src_multibyte = 1;
coding.dst_multibyte = 0;
Vnext_selection_coding_system = Qnil;
@@ -294,28 +301,21 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data,
&& memcmp(last_clipboard_text, src, nbytes) == 0)
goto closeclip;
- if (
-#if 1
- 1
-#else
- ! NILP (buffer_defaults.enable_multibyte_characters)
-#endif
- )
- {
- /* If the clipboard data contains any non-ascii code, we
- need to decode it. */
- int i;
+ {
+ /* If the clipboard data contains any non-ascii code, we
+ need to decode it. */
+ int i;
+
+ for (i = 0; i < nbytes; i++)
+ {
+ if (src[i] >= 0x80)
+ {
+ require_decoding = 1;
+ break;
+ }
+ }
+ }
- for (i = 0; i < nbytes; i++)
- {
- if (src[i] >= 0x80)
- {
- require_decoding = 1;
- break;
- }
- }
- }
-
if (require_decoding)
{
int bufsize;
@@ -337,6 +337,9 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data,
ret = make_string_from_bytes ((char *) buf,
coding.produced_char, coding.produced);
xfree (buf);
+ if (SYMBOLP (coding.post_read_conversion)
+ && !NILP (Ffboundp (coding.post_read_conversion)))
+ ret = run_pre_post_conversion_on_str (ret, &coding, 0);
}
else
{