Reorder and edit some NEWS entries.
[emacs.git] / src / w16select.c
blob03f63bedf0ddb97d34f4ccba4996f360ae5c269d
1 /* 16-bit Windows Selection processing for emacs on MS-Windows
3 Copyright (C) 1996-1997, 2001-2012 Free Software Foundation, Inc.
5 This file is part of GNU Emacs.
7 GNU Emacs is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 /* These functions work by using WinOldAp interface. WinOldAp
21 (WINOLDAP.MOD) is a Microsoft Windows extension supporting
22 "old" (character-mode) application access to Dynamic Data Exchange,
23 menus, and the Windows clipboard. */
25 /* Written by Dale P. Smith <dpsm@en.com> */
26 /* Adapted to DJGPP by Eli Zaretskii <eliz@gnu.org> */
28 #ifdef MSDOS
30 #include <config.h>
31 #include <dpmi.h>
32 #include <go32.h>
33 #include <sys/farptr.h>
34 #include <setjmp.h>
35 #include "lisp.h"
36 #include "dispextern.h" /* frame.h seems to want this */
37 #include "frame.h" /* Need this to get the X window of selected_frame */
38 #include "blockinput.h"
39 #include "buffer.h"
40 #include "character.h"
41 #include "coding.h"
42 #include "composite.h"
44 /* If ever some function outside this file will need to call any
45 clipboard-related function, the following prototypes and constants
46 should be put on a header file. Right now, nobody else uses them. */
48 #define CF_TEXT 0x01
49 #define CF_BITMAP 0x02
50 #define CF_METAFILE 0x03
51 #define CF_SYLK 0x04
52 #define CF_DIF 0x05
53 #define CF_TIFF 0x06
54 #define CF_OEMTEXT 0x07
55 #define CF_DIBBITMAP 0x08
56 #define CF_WINWRITE 0x80
57 #define CF_DSPTEXT 0x81
58 #define CF_DSPBITMAP 0x82
60 unsigned identify_winoldap_version (void);
61 unsigned open_clipboard (void);
62 unsigned empty_clipboard (void);
63 unsigned set_clipboard_data (unsigned, void *, unsigned, int);
64 unsigned get_clipboard_data_size (unsigned);
65 unsigned get_clipboard_data (unsigned, void *, unsigned, int);
66 unsigned close_clipboard (void);
67 unsigned clipboard_compact (unsigned);
69 Lisp_Object QCLIPBOARD, QPRIMARY;
71 /* The segment address and the size of the buffer in low
72 memory used to move data between us and WinOldAp module. */
73 static struct {
74 unsigned long size;
75 unsigned short rm_segment;
76 } clipboard_xfer_buf_info;
78 /* The last text we put into the clipboard. This is used to prevent
79 passing back our own text from the clipboard, instead of using the
80 kill ring. The former is undesirable because the clipboard data
81 could be MULEtilated by inappropriately chosen
82 (next-)selection-coding-system. For this reason, we must store the
83 text *after* it was encoded/Unix-to-DOS-converted. */
84 static unsigned char *last_clipboard_text;
86 /* The size of allocated storage for storing the clipboard data. */
87 static size_t clipboard_storage_size;
89 /* C functions to access the Windows 3.1x clipboard from DOS apps.
91 The information was obtained from the Microsoft Knowledge Base,
92 article Q67675 and can be found at:
93 http://www.microsoft.com/kb/developr/win_dk/q67675.htm */
95 /* See also Ralf Brown's Interrupt List.
97 I also seem to remember reading about this in Dr. Dobbs Journal a
98 while ago, but if you knew my memory... :-)
100 Dale P. Smith <dpsm@en.com> */
102 /* Return the WinOldAp support version, or 0x1700 if not supported. */
103 unsigned
104 identify_winoldap_version (void)
106 __dpmi_regs regs;
108 /* Calls Int 2Fh/AX=1700h
109 Return Values AX == 1700H: Clipboard functions not available
110 <> 1700H: AL = Major version number
111 AH = Minor version number */
112 regs.x.ax = 0x1700;
113 __dpmi_int (0x2f, &regs);
114 return regs.x.ax;
117 /* Open the clipboard, return non-zero if successful. */
118 unsigned
119 open_clipboard (void)
121 __dpmi_regs regs;
123 /* Is WINOLDAP supported? */
124 /* Kludge alert!! If WinOldAp is not supported, we return a 0,
125 which is the same as ``Clipboard already open''. Currently,
126 this is taken as an error by all the functions that use
127 `open_clipboard', but if somebody someday will use that ``open''
128 clipboard, they will have interesting time debugging it... */
129 if (identify_winoldap_version () == 0x1700)
130 return 0;
132 /* Calls Int 2Fh/AX=1701h
133 Return Values AX == 0: Clipboard already open
134 <> 0: Clipboard opened */
135 regs.x.ax = 0x1701;
136 __dpmi_int (0x2f, &regs);
137 return regs.x.ax;
140 /* Empty clipboard, return non-zero if successful. */
141 unsigned
142 empty_clipboard (void)
144 __dpmi_regs regs;
146 /* Calls Int 2Fh/AX=1702h
147 Return Values AX == 0: Error occurred
148 <> 0: OK, Clipboard emptied */
149 regs.x.ax = 0x1702;
150 __dpmi_int (0x2f, &regs);
151 return regs.x.ax;
154 /* Ensure we have a buffer in low memory with enough memory for data
155 of size WANT_SIZE. Return the linear address of the buffer. */
156 static unsigned long
157 alloc_xfer_buf (unsigned want_size)
159 __dpmi_regs regs;
161 /* If the usual DJGPP transfer buffer is large enough, use that. */
162 if (want_size <= _go32_info_block.size_of_transfer_buffer)
163 return __tb & 0xfffff;
165 /* Don't even try to allocate more than 1MB of memory: DOS cannot
166 possibly handle that (it will overflow the BX register below). */
167 if (want_size > 0xfffff)
168 return 0;
170 /* Need size rounded up to the nearest paragraph, and in
171 paragraph units (1 paragraph = 16 bytes). */
172 clipboard_xfer_buf_info.size = (want_size + 15) >> 4;
174 /* The NT DPMI host crashes us if we free DOS memory via the
175 DPMI service. Work around by calling DOS allocate/free block. */
176 regs.h.ah = 0x48;
177 regs.x.bx = clipboard_xfer_buf_info.size;
178 __dpmi_int (0x21, &regs);
179 if (regs.x.flags & 1)
181 clipboard_xfer_buf_info.size = 0;
182 return 0;
185 clipboard_xfer_buf_info.rm_segment = regs.x.ax;
186 return (((int)clipboard_xfer_buf_info.rm_segment) << 4) & 0xfffff;
189 /* Free our clipboard buffer. We always free it after use, because
190 keeping it leaves less free conventional memory for subprocesses.
191 The clipboard buffer tends to be large in size, because for small
192 clipboard data sizes we use the DJGPP transfer buffer. */
193 static void
194 free_xfer_buf (void)
196 /* If the size is 0, we used DJGPP transfer buffer, so don't free. */
197 if (clipboard_xfer_buf_info.size)
199 __dpmi_regs regs;
201 /* The NT DPMI host crashes us if we free DOS memory via
202 the DPMI service. Work around by calling DOS free block. */
203 regs.h.ah = 0x49;
204 regs.x.es = clipboard_xfer_buf_info.rm_segment;
205 __dpmi_int (0x21, &regs);
206 clipboard_xfer_buf_info.size = 0;
210 /* Copy data into the clipboard, return zero if successful. */
211 unsigned
212 set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
214 __dpmi_regs regs;
215 unsigned truelen;
216 unsigned long xbuf_addr, buf_offset;
217 unsigned char *dp = Data, *dstart = dp;
219 if (Format != CF_OEMTEXT)
220 return 3;
222 /* need to know final size after '\r' chars are inserted (the
223 standard CF_OEMTEXT clipboard format uses CRLF line endings,
224 while Emacs uses just LF internally). */
225 truelen = Size + 1; /* +1 for the terminating null */
227 if (!Raw)
229 /* avoid using strchr because it recomputes the length everytime */
230 while ((dp = memchr (dp, '\n', Size - (dp - dstart))) != 0)
232 truelen++;
233 dp++;
237 if (clipboard_compact (truelen) < truelen)
238 return 1;
240 if ((xbuf_addr = alloc_xfer_buf (truelen)) == 0)
241 return 1;
243 /* Move the buffer into the low memory, convert LF into CR-LF if needed. */
244 if (Raw)
246 dosmemput (Data, Size, xbuf_addr);
248 /* Terminate with a null, otherwise Windows does strange things
249 when the text size is an integral multiple of 32 bytes. */
250 _farpokeb (_dos_ds, xbuf_addr + Size, '\0');
252 else
254 dp = Data;
255 buf_offset = xbuf_addr;
256 _farsetsel (_dos_ds);
257 while (Size--)
259 /* Don't allow them to put binary data into the clipboard, since
260 it will cause yanked data to be truncated at the first null. */
261 if (*dp == '\0')
262 return 2;
263 if (*dp == '\n')
264 _farnspokeb (buf_offset++, '\r');
265 _farnspokeb (buf_offset++, *dp++);
268 /* Terminate with a null, otherwise Windows does strange things
269 when the text size is an integral multiple of 32 bytes. */
270 _farnspokeb (buf_offset, '\0');
273 /* Stash away the data we are about to put into the clipboard, so we
274 could later check inside get_clipboard_data whether the clipboard
275 still holds our data. */
276 if (clipboard_storage_size < truelen)
278 clipboard_storage_size = truelen + 100;
279 last_clipboard_text =
280 (char *) xrealloc (last_clipboard_text, clipboard_storage_size);
282 if (last_clipboard_text)
283 dosmemget (xbuf_addr, truelen, last_clipboard_text);
285 /* Calls Int 2Fh/AX=1703h with:
286 DX = WinOldAp-Supported Clipboard format
287 ES:BX = Pointer to data
288 SI:CX = Size of data in bytes
289 Return Values AX == 0: Error occurred
290 <> 0: OK. Data copied into the Clipboard. */
291 regs.x.ax = 0x1703;
292 regs.x.dx = Format;
293 regs.x.si = truelen >> 16;
294 regs.x.cx = truelen & 0xffff;
295 regs.x.es = xbuf_addr >> 4;
296 regs.x.bx = xbuf_addr & 15;
297 __dpmi_int (0x2f, &regs);
299 free_xfer_buf ();
301 /* If the above failed, invalidate the local copy of the clipboard. */
302 if (regs.x.ax == 0)
303 *last_clipboard_text = '\0';
305 /* Zero means success, otherwise (1, 2, or 3) it's an error. */
306 return regs.x.ax > 0 ? 0 : 3;
309 /* Return the size of the clipboard data of format FORMAT. */
310 unsigned
311 get_clipboard_data_size (unsigned Format)
313 __dpmi_regs regs;
315 /* Calls Int 2Fh/AX=1704h with:
316 DX = WinOldAp-Supported Clipboard format
317 Return Values DX:AX == Size of the data in bytes, including any
318 headers.
319 == 0 If data in this format is not in
320 the clipboard. */
321 regs.x.ax = 0x1704;
322 regs.x.dx = Format;
323 __dpmi_int (0x2f, &regs);
324 return ( (((unsigned)regs.x.dx) << 16) | regs.x.ax);
327 /* Get clipboard data, return its length.
328 Warning: this doesn't check whether DATA has enough space to hold
329 SIZE bytes. */
330 unsigned
331 get_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
333 __dpmi_regs regs;
334 unsigned long xbuf_addr;
335 unsigned char *dp = Data;
337 if (Format != CF_OEMTEXT)
338 return 0;
340 if (Size == 0)
341 return 0;
343 if ((xbuf_addr = alloc_xfer_buf (Size)) == 0)
344 return 0;
346 /* Calls Int 2Fh/AX=1705h with:
347 DX = WinOldAp-Supported Clipboard format
348 ES:BX = Pointer to data buffer to hold data
349 Return Values AX == 0: Error occurred (or data in this format is not
350 in the clipboard)
351 <> 0: OK */
352 regs.x.ax = 0x1705;
353 regs.x.dx = Format;
354 regs.x.es = xbuf_addr >> 4;
355 regs.x.bx = xbuf_addr & 15;
356 __dpmi_int (0x2f, &regs);
357 if (regs.x.ax != 0)
359 unsigned char null_char = '\0';
360 unsigned long xbuf_beg = xbuf_addr;
362 /* If last_clipboard_text is NULL, we don't want to slow down
363 the next loop by an additional test. */
364 register unsigned char *lcdp =
365 last_clipboard_text == NULL ? &null_char : last_clipboard_text;
367 /* Copy data from low memory, remove CR
368 characters before LF if needed. */
369 _farsetsel (_dos_ds);
370 while (Size--)
372 register unsigned char c = _farnspeekb (xbuf_addr++);
374 if (*lcdp == c)
375 lcdp++;
377 if ((*dp++ = c) == '\r' && !Raw && _farnspeekb (xbuf_addr) == '\n')
379 dp--;
380 *dp++ = '\n';
381 xbuf_addr++;
382 if (*lcdp == '\n')
383 lcdp++;
385 /* Windows reportedly rounds up the size of clipboard data
386 (passed in SIZE) to a multiple of 32, and removes trailing
387 spaces from each line without updating SIZE. We therefore
388 bail out when we see the first null character. */
389 else if (c == '\0')
390 break;
393 /* If the text in clipboard is identical to what we put there
394 last time set_clipboard_data was called, pretend there's no
395 data in the clipboard. This is so we don't pass our own text
396 from the clipboard (which might be troublesome if the killed
397 text includes null characters). */
398 if (last_clipboard_text &&
399 xbuf_addr - xbuf_beg == (long)(lcdp - last_clipboard_text))
400 dp = (unsigned char *)Data + 1;
403 free_xfer_buf ();
405 return (unsigned) (dp - (unsigned char *)Data - 1);
408 /* Close clipboard, return non-zero if successful. */
409 unsigned
410 close_clipboard (void)
412 __dpmi_regs regs;
414 /* Calls Int 2Fh/AX=1708h
415 Return Values AX == 0: Error occurred
416 <> 0: OK */
417 regs.x.ax = 0x1708;
418 __dpmi_int (0x2f, &regs);
419 return regs.x.ax;
422 /* Compact clipboard data so that at least SIZE bytes is available. */
423 unsigned
424 clipboard_compact (unsigned Size)
426 __dpmi_regs regs;
428 /* Calls Int 2Fh/AX=1709H with:
429 SI:CX = Desired memory size in bytes.
430 Return Values DX:AX == Number of bytes of largest block of free memory.
431 == 0 if error or no memory */
432 regs.x.ax = 0x1709;
433 regs.x.si = Size >> 16;
434 regs.x.cx = Size & 0xffff;
435 __dpmi_int (0x2f, &regs);
436 return ((unsigned)regs.x.dx << 16) | regs.x.ax;
439 static char no_mem_msg[] =
440 "(Not enough DOS memory to put saved text into clipboard.)";
441 static char binary_msg[] =
442 "(Binary characters in saved text; clipboard data not set.)";
443 static char system_error_msg[] =
444 "(Clipboard interface failure; clipboard data not set.)";
446 DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_data, 1, 2, 0,
447 doc: /* This sets the clipboard data to the given text. */)
448 (Lisp_Object string, Lisp_Object frame)
450 unsigned ok = 1, put_status = 0;
451 int nbytes, no_crlf_conversion;
452 unsigned char *src, *dst = NULL;
454 CHECK_STRING (string);
456 if (NILP (frame))
457 frame = Fselected_frame ();
459 CHECK_LIVE_FRAME (frame);
460 if ( !FRAME_MSDOS_P (XFRAME (frame)))
461 goto done;
463 BLOCK_INPUT;
465 if (!open_clipboard ())
466 goto error;
468 nbytes = SBYTES (string);
469 src = SDATA (string);
471 /* Do we need to encode this text? */
472 for (dst = src; dst < src + nbytes; dst++)
474 if (*dst == '\0' || *dst >= 0x80)
475 break;
477 if (dst >= src + nbytes)
479 /* No multibyte characters in text. We need not encode it, but we
480 will have to convert it to DOS CR-LF style. */
481 no_crlf_conversion = 0;
482 Vlast_coding_system_used = Qraw_text;
483 dst = NULL; /* so we don't try to free a random pointer */
485 else
487 /* We must encode contents of STRING according to what
488 clipboard-coding-system specifies. */
489 struct coding_system coding;
490 Lisp_Object coding_system =
491 NILP (Vnext_selection_coding_system) ?
492 Vselection_coding_system : Vnext_selection_coding_system;
494 setup_coding_system (Fcheck_coding_system (coding_system), &coding);
495 coding.dst_bytes = nbytes * 4;
496 coding.destination = (unsigned char *) xmalloc (coding.dst_bytes);
497 Vnext_selection_coding_system = Qnil;
498 coding.mode |= CODING_MODE_LAST_BLOCK;
499 dst = coding.destination;
500 encode_coding_object (&coding, string, 0, 0,
501 SCHARS (string), nbytes, Qnil);
502 no_crlf_conversion = 1;
503 nbytes = coding.produced;
504 Vlast_coding_system_used = CODING_ID_NAME (coding.id);
505 src = dst;
508 ok = empty_clipboard ()
509 && ((put_status
510 = set_clipboard_data (CF_OEMTEXT, src, nbytes, no_crlf_conversion))
511 == 0);
513 if (!no_crlf_conversion)
514 close_clipboard ();
516 if (ok) goto unblock;
518 error:
520 ok = 0;
522 unblock:
523 xfree (dst);
524 UNBLOCK_INPUT;
526 /* Notify user if the text is too large to fit into DOS memory.
527 (This will happen somewhere after 600K bytes (470K in DJGPP v1.x),
528 depending on user system configuration.) If we just silently
529 fail the function, people might wonder why their text sometimes
530 doesn't make it to the clipboard. */
531 if (put_status)
533 switch (put_status)
535 case 1:
536 message2 (no_mem_msg, sizeof (no_mem_msg) - 1, 0);
537 break;
538 case 2:
539 message2 (binary_msg, sizeof (binary_msg) - 1, 0);
540 break;
541 case 3:
542 message2 (system_error_msg, sizeof (system_error_msg) - 1, 0);
543 break;
545 sit_for (make_number (2), 0, 2);
548 done:
550 return (ok && put_status == 0 ? string : Qnil);
553 DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_data, 0, 1, 0,
554 doc: /* This gets the clipboard data in text format. */)
555 (Lisp_Object frame)
557 unsigned data_size, truelen;
558 unsigned char *htext = NULL;
559 Lisp_Object ret = Qnil;
560 int require_decoding = 0;
562 if (NILP (frame))
563 frame = Fselected_frame ();
565 CHECK_LIVE_FRAME (frame);
566 if ( !FRAME_MSDOS_P (XFRAME (frame)))
567 goto done;
569 BLOCK_INPUT;
571 if (!open_clipboard ())
572 goto unblock;
574 if ((data_size = get_clipboard_data_size (CF_OEMTEXT)) == 0 ||
575 (htext = (unsigned char *)xmalloc (data_size)) == 0)
576 goto closeclip;
578 /* need to know final size after '\r' chars are removed because
579 we can't change the string size manually, and doing an extra
580 copy is silly */
581 if ((truelen = get_clipboard_data (CF_OEMTEXT, htext, data_size, 0)) == 0)
582 goto closeclip;
584 /* Do we need to decode it? */
586 /* If the clipboard data contains any 8-bit Latin-1 code, we
587 need to decode it. */
588 int i;
590 for (i = 0; i < truelen; i++)
592 if (htext[i] >= 0x80)
594 require_decoding = 1;
595 break;
599 if (require_decoding)
601 struct coding_system coding;
602 Lisp_Object coding_system = Vnext_selection_coding_system;
604 truelen = get_clipboard_data (CF_OEMTEXT, htext, data_size, 1);
605 if (NILP (coding_system))
606 coding_system = Vselection_coding_system;
607 setup_coding_system (Fcheck_coding_system (coding_system), &coding);
608 coding.source = htext;
609 coding.mode |= CODING_MODE_LAST_BLOCK;
610 /* We explicitly disable composition handling because selection
611 data should not contain any composition sequence. */
612 coding.mode &= CODING_ANNOTATION_MASK;
613 decode_coding_object (&coding, Qnil, 0, 0, truelen, truelen, Qt);
614 ret = coding.dst_object;
615 Vlast_coding_system_used = CODING_ID_NAME (coding.id);
617 else
619 ret = make_unibyte_string ((char *) htext, truelen);
620 Vlast_coding_system_used = Qraw_text;
623 xfree (htext);
624 Vnext_selection_coding_system = Qnil;
626 closeclip:
627 close_clipboard ();
629 unblock:
630 UNBLOCK_INPUT;
632 done:
634 return (ret);
637 /* Support checking for a clipboard selection. */
639 DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p,
640 0, 2, 0,
641 doc: /* Whether there is an owner for the given X selection.
642 SELECTION should be the name of the selection in question, typically
643 one of the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. (X expects
644 these literal upper-case names.) The symbol nil is the same as
645 `PRIMARY', and t is the same as `SECONDARY'.
647 TERMINAL should be a terminal object or a frame specifying the X
648 server to query. If omitted or nil, that stands for the selected
649 frame's display, or the first available X display. */)
650 (Lisp_Object selection, Lisp_Object terminal)
652 CHECK_SYMBOL (selection);
654 /* Return nil for SECONDARY selection. For PRIMARY (or nil)
655 selection, check if there is some text on the kill-ring;
656 for CLIPBOARD, check if the clipboard currently has valid
657 text format contents.
659 The test for killed text on the kill-ring emulates the Emacs
660 behavior on X, where killed text is also put into X selection
661 by the X interface code. (On MSDOS, killed text is only put
662 into the clipboard if we run under Windows, so we cannot check
663 the clipboard alone.) */
664 if ((EQ (selection, Qnil) || EQ (selection, QPRIMARY))
665 && ! NILP (Fsymbol_value (Fintern_soft (build_string ("kill-ring"),
666 Qnil))))
667 return Qt;
669 if (EQ (selection, QCLIPBOARD))
671 Lisp_Object val = Qnil;
673 if (open_clipboard ())
675 if (get_clipboard_data_size (CF_OEMTEXT))
676 val = Qt;
677 close_clipboard ();
679 return val;
681 return Qnil;
684 void
685 syms_of_win16select (void)
687 defsubr (&Sw16_set_clipboard_data);
688 defsubr (&Sw16_get_clipboard_data);
689 defsubr (&Sx_selection_exists_p);
691 DEFVAR_LISP ("selection-coding-system", Vselection_coding_system,
692 doc: /* Coding system for communicating with other programs.
694 For MS-Windows and MS-DOS:
695 When sending or receiving text via selection and clipboard, the text
696 is encoded or decoded by this coding system. The default value is
697 the current system default encoding on 9x/Me, `utf-16le-dos'
698 \(Unicode) on NT/W2K/XP, and `iso-latin-1-dos' on MS-DOS.
700 For X Windows:
701 When sending text via selection and clipboard, if the target
702 data-type matches with the type of this coding system, it is used
703 for encoding the text. Otherwise (including the case that this
704 variable is nil), a proper coding system is used as below:
706 data-type coding system
707 --------- -------------
708 UTF8_STRING utf-8
709 COMPOUND_TEXT compound-text-with-extensions
710 STRING iso-latin-1
711 C_STRING no-conversion
713 When receiving text, if this coding system is non-nil, it is used
714 for decoding regardless of the data-type. If this is nil, a
715 proper coding system is used according to the data-type as above.
717 See also the documentation of the variable `x-select-request-type' how
718 to control which data-type to request for receiving text.
720 The default value is nil. */);
721 Vselection_coding_system = intern ("iso-latin-1-dos");
723 DEFVAR_LISP ("next-selection-coding-system", Vnext_selection_coding_system,
724 doc: /* Coding system for the next communication with other programs.
725 Usually, `selection-coding-system' is used for communicating with
726 other programs (X Windows clients or MS Windows programs). But, if this
727 variable is set, it is used for the next communication only.
728 After the communication, this variable is set to nil. */);
729 Vnext_selection_coding_system = Qnil;
731 QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY);
732 QCLIPBOARD = intern ("CLIPBOARD"); staticpro (&QCLIPBOARD);
735 #endif /* MSDOS */