Update copyright notices for 2013.
[emacs.git] / src / w16select.c
blobc92276b1d291400baefd8d6a4b20448bd1c76be0
1 /* 16-bit Windows Selection processing for emacs on MS-Windows
3 Copyright (C) 1996-1997, 2001-2013 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 "lisp.h"
35 #include "dispextern.h" /* frame.h seems to want this */
36 #include "frame.h" /* Need this to get the X window of selected_frame */
37 #include "blockinput.h"
38 #include "character.h"
39 #include "buffer.h"
40 #include "coding.h"
41 #include "composite.h"
43 /* If ever some function outside this file will need to call any
44 clipboard-related function, the following prototypes and constants
45 should be put on a header file. Right now, nobody else uses them. */
47 #define CF_TEXT 0x01
48 #define CF_BITMAP 0x02
49 #define CF_METAFILE 0x03
50 #define CF_SYLK 0x04
51 #define CF_DIF 0x05
52 #define CF_TIFF 0x06
53 #define CF_OEMTEXT 0x07
54 #define CF_DIBBITMAP 0x08
55 #define CF_WINWRITE 0x80
56 #define CF_DSPTEXT 0x81
57 #define CF_DSPBITMAP 0x82
59 unsigned identify_winoldap_version (void);
60 unsigned open_clipboard (void);
61 unsigned empty_clipboard (void);
62 unsigned set_clipboard_data (unsigned, void *, unsigned, int);
63 unsigned get_clipboard_data_size (unsigned);
64 unsigned get_clipboard_data (unsigned, void *, unsigned, int);
65 unsigned close_clipboard (void);
66 unsigned clipboard_compact (unsigned);
68 Lisp_Object QCLIPBOARD, QPRIMARY;
70 /* The segment address and the size of the buffer in low
71 memory used to move data between us and WinOldAp module. */
72 static struct {
73 unsigned long size;
74 unsigned short rm_segment;
75 } clipboard_xfer_buf_info;
77 /* The last text we put into the clipboard. This is used to prevent
78 passing back our own text from the clipboard, instead of using the
79 kill ring. The former is undesirable because the clipboard data
80 could be MULEtilated by inappropriately chosen
81 (next-)selection-coding-system. For this reason, we must store the
82 text *after* it was encoded/Unix-to-DOS-converted. */
83 static unsigned char *last_clipboard_text;
85 /* The size of allocated storage for storing the clipboard data. */
86 static size_t clipboard_storage_size;
88 /* C functions to access the Windows 3.1x clipboard from DOS apps.
90 The information was obtained from the Microsoft Knowledge Base,
91 article Q67675 and can be found at:
92 http://www.microsoft.com/kb/developr/win_dk/q67675.htm */
94 /* See also Ralf Brown's Interrupt List.
96 I also seem to remember reading about this in Dr. Dobbs Journal a
97 while ago, but if you knew my memory... :-)
99 Dale P. Smith <dpsm@en.com> */
101 /* Return the WinOldAp support version, or 0x1700 if not supported. */
102 unsigned
103 identify_winoldap_version (void)
105 __dpmi_regs regs;
107 /* Calls Int 2Fh/AX=1700h
108 Return Values AX == 1700H: Clipboard functions not available
109 <> 1700H: AL = Major version number
110 AH = Minor version number */
111 regs.x.ax = 0x1700;
112 __dpmi_int (0x2f, &regs);
113 return regs.x.ax;
116 /* Open the clipboard, return non-zero if successful. */
117 unsigned
118 open_clipboard (void)
120 __dpmi_regs regs;
122 /* Is WINOLDAP supported? */
123 /* Kludge alert!! If WinOldAp is not supported, we return a 0,
124 which is the same as ``Clipboard already open''. Currently,
125 this is taken as an error by all the functions that use
126 `open_clipboard', but if somebody someday will use that ``open''
127 clipboard, they will have interesting time debugging it... */
128 if (identify_winoldap_version () == 0x1700)
129 return 0;
131 /* Calls Int 2Fh/AX=1701h
132 Return Values AX == 0: Clipboard already open
133 <> 0: Clipboard opened */
134 regs.x.ax = 0x1701;
135 __dpmi_int (0x2f, &regs);
136 return regs.x.ax;
139 /* Empty clipboard, return non-zero if successful. */
140 unsigned
141 empty_clipboard (void)
143 __dpmi_regs regs;
145 /* Calls Int 2Fh/AX=1702h
146 Return Values AX == 0: Error occurred
147 <> 0: OK, Clipboard emptied */
148 regs.x.ax = 0x1702;
149 __dpmi_int (0x2f, &regs);
150 return regs.x.ax;
153 /* Ensure we have a buffer in low memory with enough memory for data
154 of size WANT_SIZE. Return the linear address of the buffer. */
155 static unsigned long
156 alloc_xfer_buf (unsigned want_size)
158 __dpmi_regs regs;
160 /* If the usual DJGPP transfer buffer is large enough, use that. */
161 if (want_size <= _go32_info_block.size_of_transfer_buffer)
162 return __tb & 0xfffff;
164 /* Don't even try to allocate more than 1MB of memory: DOS cannot
165 possibly handle that (it will overflow the BX register below). */
166 if (want_size > 0xfffff)
167 return 0;
169 /* Need size rounded up to the nearest paragraph, and in
170 paragraph units (1 paragraph = 16 bytes). */
171 clipboard_xfer_buf_info.size = (want_size + 15) >> 4;
173 /* The NT DPMI host crashes us if we free DOS memory via the
174 DPMI service. Work around by calling DOS allocate/free block. */
175 regs.h.ah = 0x48;
176 regs.x.bx = clipboard_xfer_buf_info.size;
177 __dpmi_int (0x21, &regs);
178 if (regs.x.flags & 1)
180 clipboard_xfer_buf_info.size = 0;
181 return 0;
184 clipboard_xfer_buf_info.rm_segment = regs.x.ax;
185 return (((int)clipboard_xfer_buf_info.rm_segment) << 4) & 0xfffff;
188 /* Free our clipboard buffer. We always free it after use, because
189 keeping it leaves less free conventional memory for subprocesses.
190 The clipboard buffer tends to be large in size, because for small
191 clipboard data sizes we use the DJGPP transfer buffer. */
192 static void
193 free_xfer_buf (void)
195 /* If the size is 0, we used DJGPP transfer buffer, so don't free. */
196 if (clipboard_xfer_buf_info.size)
198 __dpmi_regs regs;
200 /* The NT DPMI host crashes us if we free DOS memory via
201 the DPMI service. Work around by calling DOS free block. */
202 regs.h.ah = 0x49;
203 regs.x.es = clipboard_xfer_buf_info.rm_segment;
204 __dpmi_int (0x21, &regs);
205 clipboard_xfer_buf_info.size = 0;
209 /* Copy data into the clipboard, return zero if successful. */
210 unsigned
211 set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
213 __dpmi_regs regs;
214 unsigned truelen;
215 unsigned long xbuf_addr, buf_offset;
216 unsigned char *dp = Data, *dstart = dp;
218 if (Format != CF_OEMTEXT)
219 return 3;
221 /* need to know final size after '\r' chars are inserted (the
222 standard CF_OEMTEXT clipboard format uses CRLF line endings,
223 while Emacs uses just LF internally). */
224 truelen = Size + 1; /* +1 for the terminating null */
226 if (!Raw)
228 /* avoid using strchr because it recomputes the length everytime */
229 while ((dp = memchr (dp, '\n', Size - (dp - dstart))) != 0)
231 truelen++;
232 dp++;
236 if (clipboard_compact (truelen) < truelen)
237 return 1;
239 if ((xbuf_addr = alloc_xfer_buf (truelen)) == 0)
240 return 1;
242 /* Move the buffer into the low memory, convert LF into CR-LF if needed. */
243 if (Raw)
245 dosmemput (Data, Size, xbuf_addr);
247 /* Terminate with a null, otherwise Windows does strange things
248 when the text size is an integral multiple of 32 bytes. */
249 _farpokeb (_dos_ds, xbuf_addr + Size, '\0');
251 else
253 dp = Data;
254 buf_offset = xbuf_addr;
255 _farsetsel (_dos_ds);
256 while (Size--)
258 /* Don't allow them to put binary data into the clipboard, since
259 it will cause yanked data to be truncated at the first null. */
260 if (*dp == '\0')
261 return 2;
262 if (*dp == '\n')
263 _farnspokeb (buf_offset++, '\r');
264 _farnspokeb (buf_offset++, *dp++);
267 /* Terminate with a null, otherwise Windows does strange things
268 when the text size is an integral multiple of 32 bytes. */
269 _farnspokeb (buf_offset, '\0');
272 /* Stash away the data we are about to put into the clipboard, so we
273 could later check inside get_clipboard_data whether the clipboard
274 still holds our data. */
275 if (clipboard_storage_size < truelen)
277 clipboard_storage_size = truelen + 100;
278 last_clipboard_text =
279 (char *) xrealloc (last_clipboard_text, clipboard_storage_size);
281 if (last_clipboard_text)
282 dosmemget (xbuf_addr, truelen, last_clipboard_text);
284 /* Calls Int 2Fh/AX=1703h with:
285 DX = WinOldAp-Supported Clipboard format
286 ES:BX = Pointer to data
287 SI:CX = Size of data in bytes
288 Return Values AX == 0: Error occurred
289 <> 0: OK. Data copied into the Clipboard. */
290 regs.x.ax = 0x1703;
291 regs.x.dx = Format;
292 regs.x.si = truelen >> 16;
293 regs.x.cx = truelen & 0xffff;
294 regs.x.es = xbuf_addr >> 4;
295 regs.x.bx = xbuf_addr & 15;
296 __dpmi_int (0x2f, &regs);
298 free_xfer_buf ();
300 /* If the above failed, invalidate the local copy of the clipboard. */
301 if (regs.x.ax == 0)
302 *last_clipboard_text = '\0';
304 /* Zero means success, otherwise (1, 2, or 3) it's an error. */
305 return regs.x.ax > 0 ? 0 : 3;
308 /* Return the size of the clipboard data of format FORMAT. */
309 unsigned
310 get_clipboard_data_size (unsigned Format)
312 __dpmi_regs regs;
314 /* Calls Int 2Fh/AX=1704h with:
315 DX = WinOldAp-Supported Clipboard format
316 Return Values DX:AX == Size of the data in bytes, including any
317 headers.
318 == 0 If data in this format is not in
319 the clipboard. */
320 regs.x.ax = 0x1704;
321 regs.x.dx = Format;
322 __dpmi_int (0x2f, &regs);
323 return ( (((unsigned)regs.x.dx) << 16) | regs.x.ax);
326 /* Get clipboard data, return its length.
327 Warning: this doesn't check whether DATA has enough space to hold
328 SIZE bytes. */
329 unsigned
330 get_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
332 __dpmi_regs regs;
333 unsigned long xbuf_addr;
334 unsigned char *dp = Data;
336 if (Format != CF_OEMTEXT)
337 return 0;
339 if (Size == 0)
340 return 0;
342 if ((xbuf_addr = alloc_xfer_buf (Size)) == 0)
343 return 0;
345 /* Calls Int 2Fh/AX=1705h with:
346 DX = WinOldAp-Supported Clipboard format
347 ES:BX = Pointer to data buffer to hold data
348 Return Values AX == 0: Error occurred (or data in this format is not
349 in the clipboard)
350 <> 0: OK */
351 regs.x.ax = 0x1705;
352 regs.x.dx = Format;
353 regs.x.es = xbuf_addr >> 4;
354 regs.x.bx = xbuf_addr & 15;
355 __dpmi_int (0x2f, &regs);
356 if (regs.x.ax != 0)
358 unsigned char null_char = '\0';
359 unsigned long xbuf_beg = xbuf_addr;
361 /* If last_clipboard_text is NULL, we don't want to slow down
362 the next loop by an additional test. */
363 register unsigned char *lcdp =
364 last_clipboard_text == NULL ? &null_char : last_clipboard_text;
366 /* Copy data from low memory, remove CR
367 characters before LF if needed. */
368 _farsetsel (_dos_ds);
369 while (Size--)
371 register unsigned char c = _farnspeekb (xbuf_addr++);
373 if (*lcdp == c)
374 lcdp++;
376 if ((*dp++ = c) == '\r' && !Raw && _farnspeekb (xbuf_addr) == '\n')
378 dp--;
379 *dp++ = '\n';
380 xbuf_addr++;
381 if (*lcdp == '\n')
382 lcdp++;
384 /* Windows reportedly rounds up the size of clipboard data
385 (passed in SIZE) to a multiple of 32, and removes trailing
386 spaces from each line without updating SIZE. We therefore
387 bail out when we see the first null character. */
388 else if (c == '\0')
389 break;
392 /* If the text in clipboard is identical to what we put there
393 last time set_clipboard_data was called, pretend there's no
394 data in the clipboard. This is so we don't pass our own text
395 from the clipboard (which might be troublesome if the killed
396 text includes null characters). */
397 if (last_clipboard_text &&
398 xbuf_addr - xbuf_beg == (long)(lcdp - last_clipboard_text))
399 dp = (unsigned char *)Data + 1;
402 free_xfer_buf ();
404 return (unsigned) (dp - (unsigned char *)Data - 1);
407 /* Close clipboard, return non-zero if successful. */
408 unsigned
409 close_clipboard (void)
411 __dpmi_regs regs;
413 /* Calls Int 2Fh/AX=1708h
414 Return Values AX == 0: Error occurred
415 <> 0: OK */
416 regs.x.ax = 0x1708;
417 __dpmi_int (0x2f, &regs);
418 return regs.x.ax;
421 /* Compact clipboard data so that at least SIZE bytes is available. */
422 unsigned
423 clipboard_compact (unsigned Size)
425 __dpmi_regs regs;
427 /* Calls Int 2Fh/AX=1709H with:
428 SI:CX = Desired memory size in bytes.
429 Return Values DX:AX == Number of bytes of largest block of free memory.
430 == 0 if error or no memory */
431 regs.x.ax = 0x1709;
432 regs.x.si = Size >> 16;
433 regs.x.cx = Size & 0xffff;
434 __dpmi_int (0x2f, &regs);
435 return ((unsigned)regs.x.dx << 16) | regs.x.ax;
438 static char no_mem_msg[] =
439 "(Not enough DOS memory to put saved text into clipboard.)";
440 static char binary_msg[] =
441 "(Binary characters in saved text; clipboard data not set.)";
442 static char system_error_msg[] =
443 "(Clipboard interface failure; clipboard data not set.)";
445 DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_data, 1, 2, 0,
446 doc: /* This sets the clipboard data to the given text. */)
447 (Lisp_Object string, Lisp_Object frame)
449 unsigned ok = 1, put_status = 0;
450 int nbytes, no_crlf_conversion;
451 unsigned char *src, *dst = NULL;
453 CHECK_STRING (string);
455 if (NILP (frame))
456 frame = Fselected_frame ();
458 CHECK_LIVE_FRAME (frame);
459 if ( !FRAME_MSDOS_P (XFRAME (frame)))
460 goto done;
462 block_input ();
464 if (!open_clipboard ())
465 goto error;
467 nbytes = SBYTES (string);
468 src = SDATA (string);
470 /* Do we need to encode this text? */
471 for (dst = src; dst < src + nbytes; dst++)
473 if (*dst == '\0' || *dst >= 0x80)
474 break;
476 if (dst >= src + nbytes)
478 /* No multibyte characters in text. We need not encode it, but we
479 will have to convert it to DOS CR-LF style. */
480 no_crlf_conversion = 0;
481 Vlast_coding_system_used = Qraw_text;
482 dst = NULL; /* so we don't try to free a random pointer */
484 else
486 /* We must encode contents of STRING according to what
487 clipboard-coding-system specifies. */
488 struct coding_system coding;
489 Lisp_Object coding_system =
490 NILP (Vnext_selection_coding_system) ?
491 Vselection_coding_system : Vnext_selection_coding_system;
493 setup_coding_system (Fcheck_coding_system (coding_system), &coding);
494 coding.dst_bytes = nbytes * 4;
495 coding.destination = xmalloc (coding.dst_bytes);
496 Vnext_selection_coding_system = Qnil;
497 coding.mode |= CODING_MODE_LAST_BLOCK;
498 dst = coding.destination;
499 encode_coding_object (&coding, string, 0, 0,
500 SCHARS (string), nbytes, Qnil);
501 no_crlf_conversion = 1;
502 nbytes = coding.produced;
503 Vlast_coding_system_used = CODING_ID_NAME (coding.id);
504 src = dst;
507 ok = empty_clipboard ()
508 && ((put_status
509 = set_clipboard_data (CF_OEMTEXT, src, nbytes, no_crlf_conversion))
510 == 0);
512 if (!no_crlf_conversion)
513 close_clipboard ();
515 if (ok) goto unblock;
517 error:
519 ok = 0;
521 unblock:
522 xfree (dst);
523 unblock_input ();
525 /* Notify user if the text is too large to fit into DOS memory.
526 (This will happen somewhere after 600K bytes (470K in DJGPP v1.x),
527 depending on user system configuration.) If we just silently
528 fail the function, people might wonder why their text sometimes
529 doesn't make it to the clipboard. */
530 if (put_status)
532 switch (put_status)
534 case 1:
535 message2 (no_mem_msg, sizeof (no_mem_msg) - 1, 0);
536 break;
537 case 2:
538 message2 (binary_msg, sizeof (binary_msg) - 1, 0);
539 break;
540 case 3:
541 message2 (system_error_msg, sizeof (system_error_msg) - 1, 0);
542 break;
544 sit_for (make_number (2), 0, 2);
547 done:
549 return (ok && put_status == 0 ? string : Qnil);
552 DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_data, 0, 1, 0,
553 doc: /* This gets the clipboard data in text format. */)
554 (Lisp_Object frame)
556 unsigned data_size, truelen;
557 unsigned char *htext = NULL;
558 Lisp_Object ret = Qnil;
559 int require_decoding = 0;
561 if (NILP (frame))
562 frame = Fselected_frame ();
564 CHECK_LIVE_FRAME (frame);
565 if ( !FRAME_MSDOS_P (XFRAME (frame)))
566 goto done;
568 block_input ();
570 if (!open_clipboard ())
571 goto unblock;
573 if ((data_size = get_clipboard_data_size (CF_OEMTEXT)) == 0 ||
574 (htext = xmalloc (data_size)) == 0)
575 goto closeclip;
577 /* need to know final size after '\r' chars are removed because
578 we can't change the string size manually, and doing an extra
579 copy is silly */
580 if ((truelen = get_clipboard_data (CF_OEMTEXT, htext, data_size, 0)) == 0)
581 goto closeclip;
583 /* Do we need to decode it? */
585 /* If the clipboard data contains any 8-bit Latin-1 code, we
586 need to decode it. */
587 int i;
589 for (i = 0; i < truelen; i++)
591 if (htext[i] >= 0x80)
593 require_decoding = 1;
594 break;
598 if (require_decoding)
600 struct coding_system coding;
601 Lisp_Object coding_system = Vnext_selection_coding_system;
603 truelen = get_clipboard_data (CF_OEMTEXT, htext, data_size, 1);
604 if (NILP (coding_system))
605 coding_system = Vselection_coding_system;
606 setup_coding_system (Fcheck_coding_system (coding_system), &coding);
607 coding.source = htext;
608 coding.mode |= CODING_MODE_LAST_BLOCK;
609 /* We explicitly disable composition handling because selection
610 data should not contain any composition sequence. */
611 coding.mode &= CODING_ANNOTATION_MASK;
612 decode_coding_object (&coding, Qnil, 0, 0, truelen, truelen, Qt);
613 ret = coding.dst_object;
614 Vlast_coding_system_used = CODING_ID_NAME (coding.id);
616 else
618 ret = make_unibyte_string ((char *) htext, truelen);
619 Vlast_coding_system_used = Qraw_text;
622 xfree (htext);
623 Vnext_selection_coding_system = Qnil;
625 closeclip:
626 close_clipboard ();
628 unblock:
629 unblock_input ();
631 done:
633 return (ret);
636 /* Support checking for a clipboard selection. */
638 DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p,
639 0, 2, 0,
640 doc: /* Whether there is an owner for the given X selection.
641 SELECTION should be the name of the selection in question, typically
642 one of the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. (X expects
643 these literal upper-case names.) The symbol nil is the same as
644 `PRIMARY', and t is the same as `SECONDARY'.
646 TERMINAL should be a terminal object or a frame specifying the X
647 server to query. If omitted or nil, that stands for the selected
648 frame's display, or the first available X display. */)
649 (Lisp_Object selection, Lisp_Object terminal)
651 CHECK_SYMBOL (selection);
653 /* Return nil for SECONDARY selection. For PRIMARY (or nil)
654 selection, check if there is some text on the kill-ring;
655 for CLIPBOARD, check if the clipboard currently has valid
656 text format contents.
658 The test for killed text on the kill-ring emulates the Emacs
659 behavior on X, where killed text is also put into X selection
660 by the X interface code. (On MSDOS, killed text is only put
661 into the clipboard if we run under Windows, so we cannot check
662 the clipboard alone.) */
663 if ((EQ (selection, Qnil) || EQ (selection, QPRIMARY))
664 && ! NILP (Fsymbol_value (Fintern_soft (build_string ("kill-ring"),
665 Qnil))))
666 return Qt;
668 if (EQ (selection, QCLIPBOARD))
670 Lisp_Object val = Qnil;
672 if (open_clipboard ())
674 if (get_clipboard_data_size (CF_OEMTEXT))
675 val = Qt;
676 close_clipboard ();
678 return val;
680 return Qnil;
683 void
684 syms_of_win16select (void)
686 defsubr (&Sw16_set_clipboard_data);
687 defsubr (&Sw16_get_clipboard_data);
688 defsubr (&Sx_selection_exists_p);
690 DEFVAR_LISP ("selection-coding-system", Vselection_coding_system,
691 doc: /* Coding system for communicating with other programs.
693 For MS-Windows and MS-DOS:
694 When sending or receiving text via selection and clipboard, the text
695 is encoded or decoded by this coding system. The default value is
696 the current system default encoding on 9x/Me, `utf-16le-dos'
697 \(Unicode) on NT/W2K/XP, and `iso-latin-1-dos' on MS-DOS.
699 For X Windows:
700 When sending text via selection and clipboard, if the target
701 data-type matches with the type of this coding system, it is used
702 for encoding the text. Otherwise (including the case that this
703 variable is nil), a proper coding system is used as below:
705 data-type coding system
706 --------- -------------
707 UTF8_STRING utf-8
708 COMPOUND_TEXT compound-text-with-extensions
709 STRING iso-latin-1
710 C_STRING no-conversion
712 When receiving text, if this coding system is non-nil, it is used
713 for decoding regardless of the data-type. If this is nil, a
714 proper coding system is used according to the data-type as above.
716 See also the documentation of the variable `x-select-request-type' how
717 to control which data-type to request for receiving text.
719 The default value is nil. */);
720 Vselection_coding_system = intern ("iso-latin-1-dos");
722 DEFVAR_LISP ("next-selection-coding-system", Vnext_selection_coding_system,
723 doc: /* Coding system for the next communication with other programs.
724 Usually, `selection-coding-system' is used for communicating with
725 other programs (X Windows clients or MS Windows programs). But, if this
726 variable is set, it is used for the next communication only.
727 After the communication, this variable is set to nil. */);
728 Vnext_selection_coding_system = Qnil;
730 QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY);
731 QCLIPBOARD = intern ("CLIPBOARD"); staticpro (&QCLIPBOARD);
734 #endif /* MSDOS */