summaryrefslogtreecommitdiff
path: root/src/xselect.c
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>1998-08-15 01:28:14 +0000
committerKenichi Handa <handa@m17n.org>1998-08-15 01:28:14 +0000
commit16cd5029243337639a536b8cc972d6938ca61754 (patch)
tree53940e7a925dc3157e3a42cbd8c8850751e3d486 /src/xselect.c
parentab29c43b51181a352461867ab822814cf48ee7ec (diff)
downloademacs-16cd5029243337639a536b8cc972d6938ca61754.tar.gz
(Vnext_selection_coding_system): New variable.
(selection_data_to_lisp_data): If Vnext_selection_coding_system is non-nil, use it. (lisp_data_to_selection_data): Likewise. (syms_of_xselect): Declare next-selection-coding-system as a Lisp variable.
Diffstat (limited to 'src/xselect.c')
-rw-r--r--src/xselect.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/xselect.c b/src/xselect.c
index b05a21ea453..74f0393d1fd 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -51,6 +51,9 @@ static Lisp_Object Vx_sent_selection_hooks;
selection, and clipboard. */
static Lisp_Object Vselection_coding_system;
+/* Coding system for the next communicating with other X clients. */
+static Lisp_Object Vnext_selection_coding_system;
+
/* If this is a smaller number than the max-request-size of the display,
emacs will use INCR selection transfer when the selection is larger
than this. The max-request-size is usually around 64k, so if you want
@@ -1504,8 +1507,11 @@ selection_data_to_lisp_data (display, data, size, type, format)
unsigned char *buf;
struct coding_system coding;
+ if (NILP (Vnext_selection_coding_system))
+ Vnext_selection_coding_system = Vselection_coding_system;
setup_coding_system
- (Fcheck_coding_system(Vselection_coding_system), &coding);
+ (Fcheck_coding_system(Vnext_selection_coding_system), &coding);
+ Vnext_selection_coding_system = Qnil;
coding.mode |= CODING_MODE_LAST_BLOCK;
bufsize = decoding_buffer_size (&coding, size);
buf = (unsigned char *) xmalloc (bufsize);
@@ -1643,8 +1649,11 @@ lisp_data_to_selection_data (display, obj,
unsigned char *buf;
struct coding_system coding;
+ if (NILP (Vnext_selection_coding_system))
+ Vnext_selection_coding_system = Vselection_coding_system;
setup_coding_system
- (Fcheck_coding_system (Vselection_coding_system), &coding);
+ (Fcheck_coding_system (Vnext_selection_coding_system), &coding);
+ Vnext_selection_coding_system = Qnil;
coding.mode |= CODING_MODE_LAST_BLOCK;
bufsize = encoding_buffer_size (&coding, *size_ret);
buf = (unsigned char *) xmalloc (bufsize);
@@ -2288,6 +2297,14 @@ the text is encoded or decoded by this coding system.\n\
A default value is `compound-text'");
Vselection_coding_system = intern ("compound-text");
+ DEFVAR_LISP ("next-selection-coding-system", &Vnext_selection_coding_system,
+ "Coding system for the next communication with other X clients.\n\
+Usually, `selection-coding-system' is used for communicating with\n\
+other X clients. But, if this variable is set, it is used for the\n\
+next communication only. After the communication, this variable is\n\
+set to nil.");
+ Vnext_selection_coding_system = Qnil;
+
DEFVAR_INT ("x-selection-timeout", &x_selection_timeout,
"Number of milliseconds to wait for a selection reply.\n\
If the selection owner doesn't reply in this time, we give up.\n\