annotate src/w32select.c @ 24455:013e22e5d30c

(smtpmail-do-bcc): Fix regexp.
author Karl Heuer <kwzh@gnu.org>
date Tue, 09 Mar 1999 03:02:55 +0000
parents 122a362c5024
children a0423d2b9302
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
1 /* Selection processing for Emacs on the Microsoft W32 API.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2 Copyright (C) 1993, 1994 Free Software Foundation.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
4 This file is part of GNU Emacs.
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
5
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
7 it under the terms of the GNU General Public License as published by
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
9 any later version.
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
10
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
14 GNU General Public License for more details.
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
15
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
16 You should have received a copy of the GNU General Public License
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13434
diff changeset
19 Boston, MA 02111-1307, USA. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
20
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
21 /* Written by Kevin Gallo */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
22
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
23 #include <config.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
24 #include "lisp.h"
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15235
diff changeset
25 #include "w32term.h" /* for all of the w32 includes */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
26 #include "dispextern.h" /* frame.h seems to want this */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
27 #include "frame.h" /* Need this to get the X window of selected_frame */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
28 #include "blockinput.h"
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
29 #include "buffer.h"
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
30 #include "charset.h"
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
31 #include "coding.h"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
32
15235
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
33 Lisp_Object QCLIPBOARD;
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
34
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
35 /* Coding system for communicating with other Windows programs via the
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
36 clipboard. */
22914
4d4e775cf6f7 (Vselection_coding_system): Renamed from Vclipboard_coding_system.
Richard M. Stallman <rms@gnu.org>
parents: 22745
diff changeset
37 static Lisp_Object Vselection_coding_system;
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
38
23562
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
39 /* Coding system for the next communicating with other X clients. */
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
40 static Lisp_Object Vnext_selection_coding_system;
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
41
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
42 #if 0
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15235
diff changeset
43 DEFUN ("w32-open-clipboard", Fw32_open_clipboard, Sw32_open_clipboard, 0, 1, 0,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
44 "This opens the clipboard with the given frame pointer.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
45 (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
46 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
47 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
48 BOOL ok = FALSE;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
49
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
50 if (!NILP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
51 CHECK_LIVE_FRAME (frame, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
52
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
53 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
54
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15235
diff changeset
55 ok = OpenClipboard ((!NILP (frame) && FRAME_W32_P (XFRAME (frame))) ? FRAME_W32_WINDOW (XFRAME (frame)) : NULL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
56
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
57 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
58
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
59 return (ok ? frame : Qnil);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
60 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
61
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15235
diff changeset
62 DEFUN ("w32-empty-clipboard", Fw32_empty_clipboard, Sw32_empty_clipboard, 0, 0, 0,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
63 "This empties the clipboard and assigns ownership to the window which opened the clipboard.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
64 ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
65 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
66 BOOL ok = FALSE;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
67
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
68 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
69
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
70 ok = EmptyClipboard ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
71
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
72 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
73
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
74 return (ok ? Qt : Qnil);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
75 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
76
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15235
diff changeset
77 DEFUN ("w32-close-clipboard", Fw32_close_clipboard, Sw32_close_clipboard, 0, 0, 0,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
78 "This closes the clipboard.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
79 ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
80 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
81 BOOL ok = FALSE;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
82
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
83 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
84
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
85 ok = CloseClipboard ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
86
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
87 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
88
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
89 return (ok ? Qt : Qnil);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
90 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
91
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
92 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
93
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15235
diff changeset
94 DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data, Sw32_set_clipboard_data, 1, 2, 0,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
95 "This sets the clipboard data to the given text.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
96 (string, frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
97 Lisp_Object string, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
98 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
99 BOOL ok = TRUE;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
100 HANDLE htext;
15150
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
101 int nbytes;
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
102 int truelen;
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
103 unsigned char *src;
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
104 unsigned char *dst;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
105
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
106 CHECK_STRING (string, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
107
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
108 if (!NILP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
109 CHECK_LIVE_FRAME (frame, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
110
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
111 BLOCK_INPUT;
15150
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
112
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
113 nbytes = STRING_BYTES (XSTRING (string)) + 1;
15150
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
114 src = XSTRING (string)->data;
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
115
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
116 {
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
117 /* Since we are now handling multilingual text, we must consider
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
118 encoding text for the clipboard. */
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
119 int charsets[MAX_CHARSET + 1];
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
120 int num;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
121
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
122 bzero (charsets, (MAX_CHARSET + 1) * sizeof (int));
23562
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
123 num = ((nbytes <= 1 /* Check the possibility of short cut. */
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
124 || !STRING_MULTIBYTE (string)
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
125 || nbytes == XSTRING (string)->size)
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
126 ? 0
23874
122a362c5024 (Fw32_set_clipboard_data): Call find_charset_in_str
Kenichi Handa <handa@m17n.org>
parents: 23835
diff changeset
127 : find_charset_in_str (src, nbytes, charsets, Qnil, 0, 1));
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
128
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
129 if (!num || (num == 1 && charsets[CHARSET_ASCII]))
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
130 {
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
131 /* No multibyte character in OBJ. We need not encode it. */
15150
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
132
23835
ad04307ef465 (Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents: 23562
diff changeset
133 /* Need to know final size after CR chars are inserted (the
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
134 standard CF_TEXT clipboard format uses CRLF line endings,
23835
ad04307ef465 (Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents: 23562
diff changeset
135 while Emacs uses just LF internally). */
15150
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
136
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
137 truelen = nbytes;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
138 dst = src;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
139 /* avoid using strchr because it recomputes the length everytime */
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
140 while ((dst = memchr (dst, '\n', nbytes - (dst - src))) != NULL)
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
141 {
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
142 truelen++;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
143 dst++;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
144 }
15150
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
145
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
146 if ((htext = GlobalAlloc (GMEM_MOVEABLE | GMEM_DDESHARE, truelen)) == NULL)
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
147 goto error;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
148
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
149 if ((dst = (unsigned char *) GlobalLock (htext)) == NULL)
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
150 goto error;
15150
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
151
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
152 /* convert to CRLF line endings expected by clipboard */
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
153 while (1)
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
154 {
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
155 unsigned char *next;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
156 /* copy next line or remaining bytes including '\0' */
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
157 next = _memccpy (dst, src, '\n', nbytes);
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
158 if (next)
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
159 {
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
160 /* copied one line ending with '\n' */
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
161 int copied = next - dst;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
162 nbytes -= copied;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
163 src += copied;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
164 /* insert '\r' before '\n' */
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
165 next[-1] = '\r';
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
166 next[0] = '\n';
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
167 dst = next + 1;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
168 }
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
169 else
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
170 /* copied remaining partial line -> now finished */
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
171 break;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
172 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
173
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
174 GlobalUnlock (htext);
22745
ef9607e709bc (Fw32_set_clipboard_data): Set Vlast_coding_system_used.
Andrew Innes <andrewi@gnu.org>
parents: 22545
diff changeset
175
ef9607e709bc (Fw32_set_clipboard_data): Set Vlast_coding_system_used.
Andrew Innes <andrewi@gnu.org>
parents: 22545
diff changeset
176 Vlast_coding_system_used = Qraw_text;
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
177 }
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
178 else
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
179 {
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
180 /* We must encode contents of OBJ to compound text format.
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
181 The format is compatible with what the target `STRING'
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
182 expects if OBJ contains only ASCII and Latin-1
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
183 characters. */
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
184 int bufsize;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
185 struct coding_system coding;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
186 HANDLE htext2;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
187
23562
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
188 if (NILP (Vnext_selection_coding_system))
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
189 Vnext_selection_coding_system = Vselection_coding_system;
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
190 setup_coding_system
23562
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
191 (Fcheck_coding_system (Vnext_selection_coding_system), &coding);
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
192 Vnext_selection_coding_system = Qnil;
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
193 coding.mode |= CODING_MODE_LAST_BLOCK;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
194 bufsize = encoding_buffer_size (&coding, nbytes);
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
195 if ((htext = GlobalAlloc (GMEM_MOVEABLE | GMEM_DDESHARE, bufsize)) == NULL)
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
196 goto error;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
197 if ((dst = (unsigned char *) GlobalLock (htext)) == NULL)
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
198 goto error;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
199 encode_coding (&coding, src, dst, nbytes, bufsize);
22745
ef9607e709bc (Fw32_set_clipboard_data): Set Vlast_coding_system_used.
Andrew Innes <andrewi@gnu.org>
parents: 22545
diff changeset
200 Vlast_coding_system_used = coding.symbol;
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
201 GlobalUnlock (htext);
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
202 /* Shrink data block to actual size. */
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
203 htext2 = GlobalReAlloc (htext, coding.produced, GMEM_MOVEABLE | GMEM_DDESHARE);
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
204 if (htext2 != NULL) htext = htext2;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
205 }
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
206 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
207
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15235
diff changeset
208 if (!OpenClipboard ((!NILP (frame) && FRAME_W32_P (XFRAME (frame))) ? FRAME_W32_WINDOW (XFRAME (frame)) : NULL))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
209 goto error;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
210
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
211 ok = EmptyClipboard () && SetClipboardData (CF_TEXT, htext);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
212
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
213 CloseClipboard ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
214
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
215 if (ok) goto done;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
216
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
217 error:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
218
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
219 ok = FALSE;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
220 if (htext) GlobalFree (htext);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
221
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
222 done:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
223 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
224
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
225 return (ok ? string : Qnil);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
226 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
227
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15235
diff changeset
228 DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data, Sw32_get_clipboard_data, 0, 1, 0,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
229 "This gets the clipboard data in text format.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
230 (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
231 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
232 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
233 HANDLE htext;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
234 Lisp_Object ret = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
235
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
236 if (!NILP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
237 CHECK_LIVE_FRAME (frame, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
238
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
239 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
240
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15235
diff changeset
241 if (!OpenClipboard ((!NILP (frame) && FRAME_W32_P (XFRAME (frame))) ? FRAME_W32_WINDOW (XFRAME (frame)) : NULL))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
242 goto done;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
243
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
244 if ((htext = GetClipboardData (CF_TEXT)) == NULL)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
245 goto closeclip;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
246
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
247 {
15150
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
248 unsigned char *src;
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
249 unsigned char *dst;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
250 int nbytes;
15150
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
251 int truelen;
23835
ad04307ef465 (Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents: 23562
diff changeset
252 int require_decoding = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
253
15150
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
254 if ((src = (unsigned char *) GlobalLock (htext)) == NULL)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
255 goto closeclip;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
256
15150
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
257 nbytes = strlen (src);
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
258
23562
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
259 if (
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
260 #if 1
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
261 1
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
262 #else
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
263 ! NILP (buffer_defaults.enable_multibyte_characters)
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
264 #endif
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
265 )
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
266 {
23835
ad04307ef465 (Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents: 23562
diff changeset
267 /* If the clipboard data contains any non-ascii code, we
23562
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
268 need to decode it. */
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
269 int i;
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
270
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
271 for (i = 0; i < nbytes; i++)
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
272 {
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
273 if (src[i] >= 0x80)
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
274 {
23835
ad04307ef465 (Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents: 23562
diff changeset
275 require_decoding = 1;
23562
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
276 break;
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
277 }
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
278 }
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
279 }
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
280
23835
ad04307ef465 (Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents: 23562
diff changeset
281 if (require_decoding)
15150
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
282 {
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
283 int bufsize;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
284 unsigned char *buf;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
285 struct coding_system coding;
15150
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
286
23562
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
287 if (NILP (Vnext_selection_coding_system))
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
288 Vnext_selection_coding_system = Vselection_coding_system;
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
289 setup_coding_system
23562
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
290 (Fcheck_coding_system (Vnext_selection_coding_system), &coding);
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
291 Vnext_selection_coding_system = Qnil;
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
292 coding.mode |= CODING_MODE_LAST_BLOCK;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
293 bufsize = decoding_buffer_size (&coding, nbytes);
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
294 buf = (unsigned char *) xmalloc (bufsize);
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
295 decode_coding (&coding, src, buf, nbytes, bufsize);
22745
ef9607e709bc (Fw32_set_clipboard_data): Set Vlast_coding_system_used.
Andrew Innes <andrewi@gnu.org>
parents: 22545
diff changeset
296 Vlast_coding_system_used = coding.symbol;
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
297 truelen = (coding.fake_multibyte
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
298 ? multibyte_chars_in_text (buf, coding.produced)
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
299 : coding.produced_char);
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
300 ret = make_string_from_bytes ((char *) buf, truelen, coding.produced);
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
301 xfree (buf);
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
302 }
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
303 else
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
304 {
23835
ad04307ef465 (Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents: 23562
diff changeset
305 /* Need to know final size after CR chars are removed because we
ad04307ef465 (Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents: 23562
diff changeset
306 can't change the string size manually, and doing an extra
ad04307ef465 (Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents: 23562
diff changeset
307 copy is silly. Note that we only remove CR when it appears
ad04307ef465 (Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents: 23562
diff changeset
308 as part of CRLF. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
309
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
310 truelen = nbytes;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
311 dst = src;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
312 /* avoid using strchr because it recomputes the length everytime */
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
313 while ((dst = memchr (dst, '\r', nbytes - (dst - src))) != NULL)
15150
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
314 {
23835
ad04307ef465 (Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents: 23562
diff changeset
315 if (dst[1] == '\n') /* safe because of trailing '\0' */
ad04307ef465 (Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents: 23562
diff changeset
316 truelen--;
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
317 dst++;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
318 }
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
319
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
320 ret = make_uninit_string (truelen);
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
321
23835
ad04307ef465 (Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents: 23562
diff changeset
322 /* Convert CRLF line endings (the standard CF_TEXT clipboard
ad04307ef465 (Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents: 23562
diff changeset
323 format) to LF endings as used internally by Emacs. */
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
324
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
325 dst = XSTRING (ret)->data;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
326 while (1)
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
327 {
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
328 unsigned char *next;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
329 /* copy next line or remaining bytes excluding '\0' */
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
330 next = _memccpy (dst, src, '\r', nbytes);
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
331 if (next)
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
332 {
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
333 /* copied one line ending with '\r' */
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
334 int copied = next - dst;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
335 nbytes -= copied;
23835
ad04307ef465 (Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents: 23562
diff changeset
336 dst += copied;
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
337 src += copied;
23835
ad04307ef465 (Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents: 23562
diff changeset
338 if (*src == '\n')
ad04307ef465 (Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents: 23562
diff changeset
339 dst--; /* overwrite '\r' with '\n' */
ad04307ef465 (Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents: 23562
diff changeset
340 }
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
341 else
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
342 /* copied remaining partial line -> now finished */
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
343 break;
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
344 }
22745
ef9607e709bc (Fw32_set_clipboard_data): Set Vlast_coding_system_used.
Andrew Innes <andrewi@gnu.org>
parents: 22545
diff changeset
345
ef9607e709bc (Fw32_set_clipboard_data): Set Vlast_coding_system_used.
Andrew Innes <andrewi@gnu.org>
parents: 22545
diff changeset
346 Vlast_coding_system_used = Qraw_text;
15150
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
347 }
e37489592e27 (Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
348
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
349 GlobalUnlock (htext);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
350 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
351
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
352 closeclip:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
353 CloseClipboard ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
354
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
355 done:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
356 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
357
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
358 return (ret);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
359 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
360
15235
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
361 /* Support checking for a clipboard selection. */
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
362
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
363 DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p,
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
364 0, 1, 0,
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
365 "Whether there is an owner for the given X Selection.\n\
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
366 The arg should be the name of the selection in question, typically one of\n\
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
367 the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.\n\
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
368 \(Those are literal upper-case symbol names, since that's what X expects.)\n\
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
369 For convenience, the symbol nil is the same as `PRIMARY',\n\
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
370 and t is the same as `SECONDARY'.")
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
371 (selection)
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
372 Lisp_Object selection;
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
373 {
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
374 CHECK_SYMBOL (selection, 0);
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
375
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
376 /* Return nil for PRIMARY and SECONDARY selections; for CLIPBOARD, check
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
377 if the clipboard currently has valid text format contents. */
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
378
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
379 if (EQ (selection, QCLIPBOARD))
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
380 {
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
381 Lisp_Object val = Qnil;
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
382
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
383 if (OpenClipboard (NULL))
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
384 {
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
385 int format = 0;
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
386 while (format = EnumClipboardFormats (format))
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
387 if (format == CF_TEXT)
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
388 {
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
389 val = Qt;
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
390 break;
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
391 }
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
392 CloseClipboard ();
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
393 }
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
394 return val;
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
395 }
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
396 return Qnil;
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
397 }
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
398
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
399 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15235
diff changeset
400 syms_of_w32select ()
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
401 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
402 #if 0
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15235
diff changeset
403 defsubr (&Sw32_open_clipboard);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15235
diff changeset
404 defsubr (&Sw32_empty_clipboard);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15235
diff changeset
405 defsubr (&Sw32_close_clipboard);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
406 #endif
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15235
diff changeset
407 defsubr (&Sw32_set_clipboard_data);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15235
diff changeset
408 defsubr (&Sw32_get_clipboard_data);
15235
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
409 defsubr (&Sx_selection_exists_p);
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
410
22914
4d4e775cf6f7 (Vselection_coding_system): Renamed from Vclipboard_coding_system.
Richard M. Stallman <rms@gnu.org>
parents: 22745
diff changeset
411 DEFVAR_LISP ("selection-coding-system", &Vselection_coding_system,
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
412 "Coding system for communicating with other X clients.\n\
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
413 When sending or receiving text via cut_buffer, selection, and clipboard,\n\
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
414 the text is encoded or decoded by this coding system.\n\
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
415 A default value is `compound-text'");
22914
4d4e775cf6f7 (Vselection_coding_system): Renamed from Vclipboard_coding_system.
Richard M. Stallman <rms@gnu.org>
parents: 22745
diff changeset
416 Vselection_coding_system=intern ("iso-latin-1-dos");
22545
5d3f50b4c8d2 Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents: 16884
diff changeset
417
23562
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
418 DEFVAR_LISP ("next-selection-coding-system", &Vnext_selection_coding_system,
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
419 "Coding system for the next communication with other X clients.\n\
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
420 Usually, `selection-coding-system' is used for communicating with\n\
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
421 other X clients. But, if this variable is set, it is used for the\n\
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
422 next communication only. After the communication, this variable is\n\
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
423 set to nil.");
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
424 Vnext_selection_coding_system = Qnil;
5f3243813b18 (Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23422
diff changeset
425
15235
440d937a60f7 (QCLIPBOARD): New symbol.
Karl Heuer <kwzh@gnu.org>
parents: 15150
diff changeset
426 QCLIPBOARD = intern ("CLIPBOARD"); staticpro (&QCLIPBOARD);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
427 }