[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/xfns.c
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] Changes to emacs/src/xfns.c |
Date: |
Fri, 22 Feb 2002 08:14:28 -0500 |
Index: emacs/src/xfns.c
diff -c emacs/src/xfns.c:1.538 emacs/src/xfns.c:1.539
*** emacs/src/xfns.c:1.538 Wed Feb 20 05:26:42 2002
--- emacs/src/xfns.c Fri Feb 22 08:14:27 2002
***************
*** 2345,2350 ****
--- 2345,2354 ----
CODING_SYSTEM, and return a newly allocated memory area which
should be freed by `xfree' by a caller.
+ SELECTIONP non-zero means the string is being encoded for an X
+ selection, so it is safe to run pre-write conversions (which
+ may run Lisp code).
+
Store the byte length of resulting text in *TEXT_BYTES.
If the text contains only ASCII and Latin-1, store 1 in *STRING_P,
***************
*** 2353,2361 ****
the result should be `COMPOUND_TEXT'. */
unsigned char *
! x_encode_text (string, coding_system, text_bytes, stringp)
Lisp_Object string, coding_system;
int *text_bytes, *stringp;
{
unsigned char *str = XSTRING (string)->data;
int chars = XSTRING (string)->size;
--- 2357,2366 ----
the result should be `COMPOUND_TEXT'. */
unsigned char *
! x_encode_text (string, coding_system, selectionp, text_bytes, stringp)
Lisp_Object string, coding_system;
int *text_bytes, *stringp;
+ int selectionp;
{
unsigned char *str = XSTRING (string)->data;
int chars = XSTRING (string)->size;
***************
*** 2375,2380 ****
--- 2380,2394 ----
}
setup_coding_system (coding_system, &coding);
+ if (selectionp
+ && SYMBOLP (coding.pre_write_conversion)
+ && !NILP (Ffboundp (coding.pre_write_conversion)))
+ {
+ string = run_pre_post_conversion_on_str (string, &coding, 1);
+ str = XSTRING (string)->data;
+ chars = XSTRING (string)->size;
+ bytes = STRING_BYTES (XSTRING (string));
+ }
coding.src_multibyte = 1;
coding.dst_multibyte = 0;
coding.mode |= CODING_MODE_LAST_BLOCK;
***************
*** 2458,2464 ****
coding_system = Vlocale_coding_system;
if (NILP (coding_system))
coding_system = Qcompound_text;
! text.value = x_encode_text (name, coding_system, &bytes, &stringp);
text.encoding = (stringp ? XA_STRING
: FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
text.format = 8;
--- 2472,2478 ----
coding_system = Vlocale_coding_system;
if (NILP (coding_system))
coding_system = Qcompound_text;
! text.value = x_encode_text (name, coding_system, 0, &bytes, &stringp);
text.encoding = (stringp ? XA_STRING
: FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
text.format = 8;
***************
*** 2470,2476 ****
}
else
{
! icon.value = x_encode_text (f->icon_name, coding_system,
&bytes, &stringp);
icon.encoding = (stringp ? XA_STRING
: FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
--- 2484,2490 ----
}
else
{
! icon.value = x_encode_text (f->icon_name, coding_system, 0,
&bytes, &stringp);
icon.encoding = (stringp ? XA_STRING
: FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
***************
*** 2565,2571 ****
coding_system = Vlocale_coding_system;
if (NILP (coding_system))
coding_system = Qcompound_text;
! text.value = x_encode_text (name, coding_system, &bytes, &stringp);
text.encoding = (stringp ? XA_STRING
: FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
text.format = 8;
--- 2579,2585 ----
coding_system = Vlocale_coding_system;
if (NILP (coding_system))
coding_system = Qcompound_text;
! text.value = x_encode_text (name, coding_system, 0, &bytes, &stringp);
text.encoding = (stringp ? XA_STRING
: FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
text.format = 8;
***************
*** 2577,2583 ****
}
else
{
! icon.value = x_encode_text (f->icon_name, coding_system,
&bytes, &stringp);
icon.encoding = (stringp ? XA_STRING
: FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
--- 2591,2597 ----
}
else
{
! icon.value = x_encode_text (f->icon_name, coding_system, 0,
&bytes, &stringp);
icon.encoding = (stringp ? XA_STRING
: FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);