summaryrefslogtreecommitdiff
path: root/src/xselect.c
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>1997-08-03 03:02:05 +0000
committerKenichi Handa <handa@m17n.org>1997-08-03 03:02:05 +0000
commit24bdd0180be8e072703563979eb154dd146ea582 (patch)
tree3b1281defdeb29bf501e14d25f5c2b2909e3bdb5 /src/xselect.c
parent8a163b2e7b6e6629af4da5c577f73cf10dbeddb4 (diff)
downloademacs-24bdd0180be8e072703563979eb154dd146ea582.tar.gz
(Vclipboard_coding_system): New variable.
(selection_data_to_lisp_data): Decode text by Vclipboard_coding_system. (lisp_data_to_selection_data): Encode text by Vclipboard_coding_system. (syms_of_xselect): Declare clipboard-coding-system as Lisp variable and initialize it.
Diffstat (limited to 'src/xselect.c')
-rw-r--r--src/xselect.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/xselect.c b/src/xselect.c
index b6168a024a7..1bff6772168 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -45,6 +45,9 @@ Lisp_Object QCUT_BUFFER0, QCUT_BUFFER1, QCUT_BUFFER2, QCUT_BUFFER3,
static Lisp_Object Vx_lost_selection_hooks;
static Lisp_Object Vx_sent_selection_hooks;
+/* Coding system for communicating with other X clients via cutbuffer,
+ selection, and clipboard. */
+static Lisp_Object Vclipboard_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
@@ -1491,10 +1494,10 @@ selection_data_to_lisp_data (display, data, size, type, format)
int bufsize, dummy;
unsigned char *buf;
struct coding_system coding;
- Lisp_Object sym = intern ("iso-latin-1");
- setup_coding_system (Fcheck_coding_system (sym), &coding);
- coding.last_block = 1;
+ setup_coding_system
+ (Fcheck_coding_system(Vclipboard_coding_system), &coding);
+ coding.last_block = 1;
bufsize = decoding_buffer_size (&coding, size);
buf = (unsigned char *) xmalloc (bufsize);
size = decode_coding (&coding, data, buf, size, bufsize, &dummy);
@@ -1624,16 +1627,16 @@ lisp_data_to_selection_data (display, obj,
int bufsize, dummy;
unsigned char *buf;
struct coding_system coding;
- Lisp_Object sym = intern ("iso-latin-1");
- setup_coding_system (Fcheck_coding_system (sym), &coding);
+ setup_coding_system
+ (Fcheck_coding_system (Vclipboard_coding_system), &coding);
coding.last_block = 1;
bufsize = encoding_buffer_size (&coding, *size_ret);
buf = (unsigned char *) xmalloc (bufsize);
*size_ret = encode_coding (&coding, *data_ret, buf,
*size_ret, bufsize, &dummy);
*data_ret = buf;
- if (charsets[charset_latin_iso8859_1]
+ if (charsets[get_charset_id(charset_latin_iso8859_1)]
&& (num == 1 || (num == 2 && charsets[CHARSET_ASCII])))
{
/* Ok, we can return it as `STRING'. */
@@ -2261,6 +2264,14 @@ This hook doesn't let you change the behavior of Emacs's selection replies,\n\
it merely informs you that they have happened.");
Vx_sent_selection_hooks = Qnil;
+ DEFVAR_LISP("clipboard-coding-system", &Vclipboard_coding_system,
+ "Coding system for communicating with other X clients.
+When sending or receiving text via cut_buffer, selection, and clipboard,
+the text is encoded or decoded by this coding system.
+A default value is `iso-latin-1'");
+ Vclipboard_coding_system=intern ("iso-latin-1");
+ staticpro(&Vclipboard_coding_system);
+
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\