Mercurial > emacs
annotate src/nsselect.m @ 105609:bdcd73244f19
Convert comments about autoloads into autoload comments.
(No-ops so long as file is dumped.)
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Thu, 15 Oct 2009 06:18:02 +0000 |
parents | 65c6cc4bd9c8 |
children | bb413968898a |
rev | line source |
---|---|
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
1 /* NeXT/Open/GNUstep / MacOSX Cocoa selection processing for emacs. |
100951 | 2 Copyright (C) 1993, 1994, 2005, 2006, 2008, 2009 |
96692
6fad3f85eab7
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96689
diff
changeset
|
3 Free Software Foundation, Inc. |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
4 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
5 This file is part of GNU Emacs. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
6 |
96692
6fad3f85eab7
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96689
diff
changeset
|
7 GNU Emacs is free software: you can redistribute it and/or modify |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
8 it under the terms of the GNU General Public License as published by |
96692
6fad3f85eab7
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96689
diff
changeset
|
9 the Free Software Foundation, either version 3 of the License, or |
6fad3f85eab7
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96689
diff
changeset
|
10 (at your option) any later version. |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
11 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
12 GNU Emacs is distributed in the hope that it will be useful, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
15 GNU General Public License for more details. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
16 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
96692
6fad3f85eab7
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96689
diff
changeset
|
18 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
19 |
96692
6fad3f85eab7
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96689
diff
changeset
|
20 /* |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
21 Originally by Carl Edman |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
22 Updated by Christian Limpach (chris@nice.ch) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
23 OpenStep/Rhapsody port by Scott Bender (sbender@harmony-ds.com) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
24 MacOSX/Aqua port by Christophe de Dinechin (descubes@earthlink.net) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
25 GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
26 */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
27 |
99904
ba4876d944bc
Fix bug #1362. * image.c (x_clear_image_1): Do not free background under HAVE_NS, it is not an indexed color. * nsterm.m (free_indexed_color): Add argument checking. * nsfns.m: Move config.h to before system includes (advised by Dan N.).
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
28 /* This should be the first include, as it may set up #defines affecting |
ba4876d944bc
Fix bug #1362. * image.c (x_clear_image_1): Do not free background under HAVE_NS, it is not an indexed color. * nsterm.m (free_indexed_color): Add argument checking. * nsfns.m: Move config.h to before system includes (advised by Dan N.).
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
29 interpretation of even the system includes. */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
30 #include "config.h" |
99904
ba4876d944bc
Fix bug #1362. * image.c (x_clear_image_1): Do not free background under HAVE_NS, it is not an indexed color. * nsterm.m (free_indexed_color): Add argument checking. * nsfns.m: Move config.h to before system includes (advised by Dan N.).
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
97047
diff
changeset
|
31 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
32 #include "lisp.h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
33 #include "nsterm.h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
34 #include "termhooks.h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
35 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
36 #define CUT_BUFFER_SUPPORT |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
37 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
38 Lisp_Object QPRIMARY, QSECONDARY, QTEXT, QFILE_NAME; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
39 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
40 static Lisp_Object Vns_sent_selection_hooks; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
41 static Lisp_Object Vns_lost_selection_hooks; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
42 static Lisp_Object Vselection_alist; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
43 static Lisp_Object Vselection_converter_alist; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
44 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
45 static Lisp_Object Qforeign_selection; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
46 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
47 NSString *NXSecondaryPboard; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
48 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
49 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
50 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
51 /* ========================================================================== |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
52 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
53 Internal utility functions |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
54 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
55 ========================================================================== */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
56 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
57 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
58 static NSString * |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
59 symbol_to_nsstring (Lisp_Object sym) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
60 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
61 CHECK_SYMBOL (sym); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
62 if (EQ (sym, QPRIMARY)) return NSGeneralPboard; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
63 if (EQ (sym, QSECONDARY)) return NXSecondaryPboard; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
64 if (EQ (sym, QTEXT)) return NSStringPboardType; |
102954
b5a34573cf82
* nsselect.m (symbol_to_nsstring, clean_local_selection_data)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101357
diff
changeset
|
65 return [NSString stringWithUTF8String: SDATA (XSYMBOL (sym)->xname)]; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
66 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
67 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
68 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
69 static Lisp_Object |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
70 ns_string_to_symbol (NSString *t) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
71 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
72 if ([t isEqualToString: NSGeneralPboard]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
73 return QPRIMARY; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
74 if ([t isEqualToString: NXSecondaryPboard]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
75 return QSECONDARY; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
76 if ([t isEqualToString: NSStringPboardType]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
77 return QTEXT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
78 if ([t isEqualToString: NSFilenamesPboardType]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
79 return QFILE_NAME; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
80 if ([t isEqualToString: NSTabularTextPboardType]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
81 return QTEXT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
82 return intern ([t UTF8String]); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
83 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
84 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
85 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
86 static Lisp_Object |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
87 clean_local_selection_data (Lisp_Object obj) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
88 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
89 if (CONSP (obj) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
90 && INTEGERP (XCAR (obj)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
91 && CONSP (XCDR (obj)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
92 && INTEGERP (XCAR (XCDR (obj))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
93 && NILP (XCDR (XCDR (obj)))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
94 obj = Fcons (XCAR (obj), XCDR (obj)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
95 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
96 if (CONSP (obj) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
97 && INTEGERP (XCAR (obj)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
98 && INTEGERP (XCDR (obj))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
99 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
100 if (XINT (XCAR (obj)) == 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
101 return XCDR (obj); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
102 if (XINT (XCAR (obj)) == -1) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
103 return make_number (- XINT (XCDR (obj))); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
104 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
105 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
106 if (VECTORP (obj)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
107 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
108 int i; |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
109 int size = ASIZE (obj); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
110 Lisp_Object copy; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
111 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
112 if (size == 1) |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
113 return clean_local_selection_data (AREF (obj, 0)); |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
114 copy = Fmake_vector (make_number (size), Qnil); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
115 for (i = 0; i < size; i++) |
102954
b5a34573cf82
* nsselect.m (symbol_to_nsstring, clean_local_selection_data)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101357
diff
changeset
|
116 ASET (copy, i, clean_local_selection_data (AREF (obj, i))); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
117 return copy; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
118 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
119 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
120 return obj; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
121 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
122 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
123 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
124 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
125 ns_declare_pasteboard (id pb) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
126 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
127 [pb declareTypes: ns_send_types owner: NSApp]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
128 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
129 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
130 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
131 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
132 ns_undeclare_pasteboard (id pb) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
133 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
134 [pb declareTypes: [NSArray array] owner: nil]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
135 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
136 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
137 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
138 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
139 ns_string_to_pasteboard_internal (id pb, Lisp_Object str, NSString *gtype) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
140 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
141 if (EQ (str, Qnil)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
142 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
143 [pb declareTypes: [NSArray array] owner: nil]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
144 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
145 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
146 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
147 char *utfStr; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
148 NSString *type, *nsStr; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
149 NSEnumerator *tenum; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
150 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
151 CHECK_STRING (str); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
152 |
102954
b5a34573cf82
* nsselect.m (symbol_to_nsstring, clean_local_selection_data)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101357
diff
changeset
|
153 utfStr = SDATA (str); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
154 nsStr = [NSString stringWithUTF8String: utfStr]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
155 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
156 if (gtype == nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
157 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
158 [pb declareTypes: ns_send_types owner: nil]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
159 tenum = [ns_send_types objectEnumerator]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
160 while ( (type = [tenum nextObject]) ) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
161 [pb setString: nsStr forType: type]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
162 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
163 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
164 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
165 [pb setString: nsStr forType: gtype]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
166 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
167 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
168 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
169 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
170 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
171 static Lisp_Object |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
172 ns_get_local_selection (Lisp_Object selection_name, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
173 Lisp_Object target_type) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
174 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
175 Lisp_Object local_value; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
176 Lisp_Object handler_fn, value, type, check; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
177 int count; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
178 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
179 local_value = assq_no_quit (selection_name, Vselection_alist); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
180 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
181 if (NILP (local_value)) return Qnil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
182 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
183 count = specpdl_ptr - specpdl; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
184 specbind (Qinhibit_quit, Qt); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
185 CHECK_SYMBOL (target_type); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
186 handler_fn = Fcdr (Fassq (target_type, Vselection_converter_alist)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
187 if (!NILP (handler_fn)) |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
188 value = call3 (handler_fn, selection_name, target_type, |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
189 XCAR (XCDR (local_value))); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
190 else |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
191 value = Qnil; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
192 unbind_to (count, Qnil); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
193 |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
194 check = value; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
195 if (CONSP (value) && SYMBOLP (XCAR (value))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
196 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
197 type = XCAR (value); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
198 check = XCDR (value); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
199 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
200 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
201 if (STRINGP (check) || VECTORP (check) || SYMBOLP (check) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
202 || INTEGERP (check) || NILP (value)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
203 return value; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
204 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
205 if (CONSP (check) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
206 && INTEGERP (XCAR (check)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
207 && (INTEGERP (XCDR (check))|| |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
208 (CONSP (XCDR (check)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
209 && INTEGERP (XCAR (XCDR (check))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
210 && NILP (XCDR (XCDR (check)))))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
211 return value; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
212 |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
213 // FIXME: Why `quit' rather than `error'? |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
214 Fsignal (Qquit, Fcons (build_string ( |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
215 "invalid data returned by selection-conversion function"), |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
216 Fcons (handler_fn, Fcons (value, Qnil)))); |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
217 // FIXME: Beware, `quit' can return!! |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
218 return Qnil; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
219 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
220 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
221 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
222 static Lisp_Object |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
223 ns_get_foreign_selection (Lisp_Object symbol, Lisp_Object target) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
224 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
225 id pb; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
226 pb =[NSPasteboard pasteboardWithName: symbol_to_nsstring (symbol)]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
227 return ns_string_from_pasteboard (pb); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
228 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
229 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
230 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
231 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
232 ns_handle_selection_request (struct input_event *event) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
233 { |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
234 // FIXME: BIG UGLY HACK!!! |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
235 id pb = (id)*(EMACS_INT*)&(event->x); |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
236 NSString *type = (NSString *)*(EMACS_INT*)&(event->y); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
237 Lisp_Object selection_name, selection_data, target_symbol, data; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
238 Lisp_Object successful_p, rest; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
239 |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
240 selection_name = ns_string_to_symbol ([(NSPasteboard *)pb name]); |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
241 target_symbol = ns_string_to_symbol (type); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
242 selection_data = assq_no_quit (selection_name, Vselection_alist); |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
243 successful_p = Qnil; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
244 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
245 if (!NILP (selection_data)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
246 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
247 data = ns_get_local_selection (selection_name, target_symbol); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
248 if (!NILP (data)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
249 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
250 if (STRINGP (data)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
251 ns_string_to_pasteboard_internal (pb, data, type); |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
252 successful_p = Qt; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
253 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
254 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
255 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
256 if (!EQ (Vns_sent_selection_hooks, Qunbound)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
257 { |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
258 for (rest = Vns_sent_selection_hooks; CONSP (rest); rest = Fcdr (rest)) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
259 call3 (Fcar (rest), selection_name, target_symbol, successful_p); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
260 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
261 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
262 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
263 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
264 static void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
265 ns_handle_selection_clear (struct input_event *event) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
266 { |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
267 id pb = (id)*(EMACS_INT*)&(event->x); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
268 Lisp_Object selection_name, selection_data, rest; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
269 |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
270 selection_name = ns_string_to_symbol ([(NSPasteboard *)pb name]); |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
271 selection_data = assq_no_quit (selection_name, Vselection_alist); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
272 if (NILP (selection_data)) return; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
273 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
274 if (EQ (selection_data, Fcar (Vselection_alist))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
275 Vselection_alist = Fcdr (Vselection_alist); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
276 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
277 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
278 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
279 if (EQ (selection_data, Fcar (Fcdr (rest)))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
280 Fsetcdr (rest, Fcdr (Fcdr (rest))); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
281 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
282 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
283 if (!EQ (Vns_lost_selection_hooks, Qunbound)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
284 { |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
285 for (rest = Vns_lost_selection_hooks;CONSP (rest); rest = Fcdr (rest)) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
286 call1 (Fcar (rest), selection_name); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
287 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
288 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
289 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
290 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
291 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
292 /* ========================================================================== |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
293 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
294 Functions used externally |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
295 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
296 ========================================================================== */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
297 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
298 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
299 Lisp_Object |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
300 ns_string_from_pasteboard (id pb) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
301 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
302 NSString *type, *str; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
303 const char *utfStr; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
304 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
305 type = [pb availableTypeFromArray: ns_return_types]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
306 if (type == nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
307 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
308 Fsignal (Qquit, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
309 Fcons (build_string ("empty or unsupported pasteboard type"), |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
310 Qnil)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
311 return Qnil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
312 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
313 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
314 /* get the string */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
315 if (! (str = [pb stringForType: type])) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
316 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
317 NSData *data = [pb dataForType: type]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
318 if (data != nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
319 str = [[NSString alloc] initWithData: data |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
320 encoding: NSUTF8StringEncoding]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
321 if (str != nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
322 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
323 [str autorelease]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
324 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
325 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
326 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
327 Fsignal (Qquit, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
328 Fcons (build_string ("pasteboard doesn't contain valid data"), |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
329 Qnil)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
330 return Qnil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
331 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
332 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
333 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
334 /* assume UTF8 */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
335 NS_DURING |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
336 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
337 /* EOL conversion: PENDING- is this too simple? */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
338 NSMutableString *mstr = [[str mutableCopy] autorelease]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
339 [mstr replaceOccurrencesOfString: @"\r\n" withString: @"\n" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
340 options: NSLiteralSearch range: NSMakeRange (0, [mstr length])]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
341 [mstr replaceOccurrencesOfString: @"\r" withString: @"\n" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
342 options: NSLiteralSearch range: NSMakeRange (0, [mstr length])]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
343 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
344 utfStr = [mstr UTF8String]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
345 if (!utfStr) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
346 utfStr = [mstr cString]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
347 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
348 NS_HANDLER |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
349 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
350 message1 ("ns_string_from_pasteboard: UTF8String failed\n"); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
351 utfStr = [str lossyCString]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
352 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
353 NS_ENDHANDLER |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
354 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
355 return build_string (utfStr); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
356 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
357 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
358 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
359 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
360 ns_string_to_pasteboard (id pb, Lisp_Object str) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
361 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
362 ns_string_to_pasteboard_internal (pb, str, nil); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
363 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
364 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
365 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
366 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
367 /* ========================================================================== |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
368 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
369 Lisp Defuns |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
370 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
371 ========================================================================== */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
372 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
373 |
103326
65c6cc4bd9c8
nsselect.m (Fx_own_selection_internal, Fx_selection_exists_p,
David Reitter <david.reitter@gmail.com>
parents:
102954
diff
changeset
|
374 DEFUN ("x-own-selection-internal", Fx_own_selection_internal, |
65c6cc4bd9c8
nsselect.m (Fx_own_selection_internal, Fx_selection_exists_p,
David Reitter <david.reitter@gmail.com>
parents:
102954
diff
changeset
|
375 Sx_own_selection_internal, 2, 2, 0, |
96905
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
376 doc: /* Assert a selection. |
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
377 SELECTION-NAME is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. |
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
378 VALUE is typically a string, or a cons of two markers, but may be |
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
379 anything that the functions on `selection-converter-alist' know about. */) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
380 (selection_name, selection_value) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
381 Lisp_Object selection_name, selection_value; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
382 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
383 id pb; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
384 Lisp_Object old_value, new_value; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
385 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
386 check_ns (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
387 CHECK_SYMBOL (selection_name); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
388 if (NILP (selection_value)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
389 error ("selection-value may not be nil."); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
390 pb =[NSPasteboard pasteboardWithName: symbol_to_nsstring (selection_name)]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
391 ns_declare_pasteboard (pb); |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
392 old_value = assq_no_quit (selection_name, Vselection_alist); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
393 new_value = Fcons (selection_name, Fcons (selection_value, Qnil)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
394 if (NILP (old_value)) |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
395 Vselection_alist = Fcons (new_value, Vselection_alist); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
396 else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
397 Fsetcdr (old_value, Fcdr (new_value)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
398 /* XXX An evil hack, but a necessary one I fear XXX */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
399 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
400 struct input_event ev; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
401 ev.kind = SELECTION_REQUEST_EVENT; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
402 ev.modifiers = 0; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
403 ev.code = 0; |
96759
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
404 *(EMACS_INT*)(&(ev.x)) = (EMACS_INT)pb; // FIXME: BIG UGLY HACK!! |
1e2f7aab70ba
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96692
diff
changeset
|
405 *(EMACS_INT*)(&(ev.y)) = (EMACS_INT)NSStringPboardType; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
406 ns_handle_selection_request (&ev); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
407 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
408 return selection_value; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
409 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
410 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
411 |
96870
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96759
diff
changeset
|
412 DEFUN ("x-disown-selection-internal", Fx_disown_selection_internal, |
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96759
diff
changeset
|
413 Sx_disown_selection_internal, 1, 2, 0, |
96905
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
414 doc: /* If we own the selection SELECTION, disown it. */) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
415 (selection_name, time) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
416 Lisp_Object selection_name, time; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
417 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
418 id pb; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
419 check_ns (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
420 CHECK_SYMBOL (selection_name); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
421 if (NILP (assq_no_quit (selection_name, Vselection_alist))) return Qnil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
422 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
423 pb =[NSPasteboard pasteboardWithName: symbol_to_nsstring (selection_name)]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
424 ns_undeclare_pasteboard (pb); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
425 return Qt; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
426 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
427 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
428 |
103326
65c6cc4bd9c8
nsselect.m (Fx_own_selection_internal, Fx_selection_exists_p,
David Reitter <david.reitter@gmail.com>
parents:
102954
diff
changeset
|
429 DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p, |
96905
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
430 0, 1, 0, doc: /* Whether there is an owner for the given selection. |
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
431 The arg should be the name of the selection in question, typically one of |
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
432 the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. |
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
433 \(Those are literal upper-case symbol names.) |
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
434 For convenience, the symbol nil is the same as `PRIMARY', |
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
435 and t is the same as `SECONDARY'.) */) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
436 (selection) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
437 Lisp_Object selection; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
438 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
439 id pb; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
440 NSArray *types; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
441 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
442 check_ns (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
443 CHECK_SYMBOL (selection); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
444 if (EQ (selection, Qnil)) selection = QPRIMARY; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
445 if (EQ (selection, Qt)) selection = QSECONDARY; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
446 pb =[NSPasteboard pasteboardWithName: symbol_to_nsstring (selection)]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
447 types =[pb types]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
448 return ([types count] == 0) ? Qnil : Qt; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
449 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
450 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
451 |
103326
65c6cc4bd9c8
nsselect.m (Fx_own_selection_internal, Fx_selection_exists_p,
David Reitter <david.reitter@gmail.com>
parents:
102954
diff
changeset
|
452 DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p, |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
453 0, 1, 0, |
96905
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
454 doc: /* Whether the current Emacs process owns the given selection. |
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
455 The arg should be the name of the selection in question, typically one of |
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
456 the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. |
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
457 \(Those are literal upper-case symbol names.) |
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
458 For convenience, the symbol nil is the same as `PRIMARY', |
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
459 and t is the same as `SECONDARY'.) */) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
460 (selection) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
461 Lisp_Object selection; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
462 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
463 check_ns (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
464 CHECK_SYMBOL (selection); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
465 if (EQ (selection, Qnil)) selection = QPRIMARY; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
466 if (EQ (selection, Qt)) selection = QSECONDARY; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
467 return (NILP (Fassq (selection, Vselection_alist))) ? Qnil : Qt; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
468 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
469 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
470 |
96870
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96759
diff
changeset
|
471 DEFUN ("x-get-selection-internal", Fx_get_selection_internal, |
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96759
diff
changeset
|
472 Sx_get_selection_internal, 2, 2, 0, |
96905
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
473 doc: /* Return text selected from some pasteboard. |
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
474 SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. |
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
475 \(Those are literal upper-case symbol names.) |
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
476 TYPE is the type of data desired, typically `STRING'. */) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
477 (selection_name, target_type) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
478 Lisp_Object selection_name, target_type; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
479 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
480 Lisp_Object val; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
481 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
482 check_ns (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
483 CHECK_SYMBOL (selection_name); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
484 CHECK_SYMBOL (target_type); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
485 val = ns_get_local_selection (selection_name, target_type); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
486 if (NILP (val)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
487 val = ns_get_foreign_selection (selection_name, target_type); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
488 if (CONSP (val) && SYMBOLP (Fcar (val))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
489 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
490 val = Fcdr (val); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
491 if (CONSP (val) && NILP (Fcdr (val))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
492 val = Fcar (val); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
493 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
494 val = clean_local_selection_data (val); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
495 return val; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
496 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
497 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
498 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
499 #ifdef CUT_BUFFER_SUPPORT |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
500 DEFUN ("ns-get-cut-buffer-internal", Fns_get_cut_buffer_internal, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
501 Sns_get_cut_buffer_internal, 1, 1, 0, |
96905
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
502 doc: /* Returns the value of the named cut buffer. */) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
503 (buffer) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
504 Lisp_Object buffer; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
505 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
506 id pb; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
507 check_ns (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
508 pb =[NSPasteboard pasteboardWithName: symbol_to_nsstring (buffer)]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
509 return ns_string_from_pasteboard (pb); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
510 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
511 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
512 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
513 DEFUN ("ns-rotate-cut-buffers-internal", Fns_rotate_cut_buffers_internal, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
514 Sns_rotate_cut_buffers_internal, 1, 1, 0, |
96905
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
515 doc: /* Rotate the values of the cut buffers by N steps. |
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
516 Positive N means move values forward, negative means |
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
517 backward. CURRENTLY NOT IMPLEMENTED UNDER NEXTSTEP. */ ) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
518 (n) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
519 Lisp_Object n; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
520 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
521 /* XXX This function is unimplemented under NeXTstep XXX */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
522 Fsignal (Qquit, Fcons (build_string ( |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
523 "Warning: ns-rotate-cut-buffers-internal not implemented\n"), Qnil)); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
524 return Qnil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
525 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
526 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
527 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
528 DEFUN ("ns-store-cut-buffer-internal", Fns_store_cut_buffer_internal, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
529 Sns_store_cut_buffer_internal, 2, 2, 0, |
96905
43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
Chong Yidong <cyd@stupidchicken.com>
parents:
96870
diff
changeset
|
530 doc: /* Sets the value of the named cut buffer (typically CUT_BUFFER0). */) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
531 (buffer, string) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
532 Lisp_Object buffer, string; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
533 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
534 id pb; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
535 check_ns (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
536 pb =[NSPasteboard pasteboardWithName: symbol_to_nsstring (buffer)]; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
537 ns_string_to_pasteboard (pb, string); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
538 return Qnil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
539 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
540 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
541 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
542 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
543 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
544 nxatoms_of_nsselect (void) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
545 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
546 NXSecondaryPboard = @"Selection"; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
547 } |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
548 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
549 void |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
550 syms_of_nsselect (void) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
551 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
552 QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
553 QSECONDARY = intern ("SECONDARY"); staticpro (&QSECONDARY); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
554 QTEXT = intern ("TEXT"); staticpro (&QTEXT); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
555 QFILE_NAME = intern ("FILE_NAME"); staticpro (&QFILE_NAME); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
556 |
96870
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96759
diff
changeset
|
557 defsubr (&Sx_disown_selection_internal); |
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96759
diff
changeset
|
558 defsubr (&Sx_get_selection_internal); |
103326
65c6cc4bd9c8
nsselect.m (Fx_own_selection_internal, Fx_selection_exists_p,
David Reitter <david.reitter@gmail.com>
parents:
102954
diff
changeset
|
559 defsubr (&Sx_own_selection_internal); |
65c6cc4bd9c8
nsselect.m (Fx_own_selection_internal, Fx_selection_exists_p,
David Reitter <david.reitter@gmail.com>
parents:
102954
diff
changeset
|
560 defsubr (&Sx_selection_exists_p); |
65c6cc4bd9c8
nsselect.m (Fx_own_selection_internal, Fx_selection_exists_p,
David Reitter <david.reitter@gmail.com>
parents:
102954
diff
changeset
|
561 defsubr (&Sx_selection_owner_p); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
562 #ifdef CUT_BUFFER_SUPPORT |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
563 defsubr (&Sns_get_cut_buffer_internal); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
564 defsubr (&Sns_rotate_cut_buffers_internal); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
565 defsubr (&Sns_store_cut_buffer_internal); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
566 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
567 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
568 Vselection_alist = Qnil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
569 staticpro (&Vselection_alist); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
570 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
571 DEFVAR_LISP ("ns-sent-selection-hooks", &Vns_sent_selection_hooks, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
572 "A list of functions to be called when Emacs answers a selection request.\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
573 The functions are called with four arguments:\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
574 - the selection name (typically `PRIMARY', `SECONDARY', or `CLIPBOARD');\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
575 - the selection-type which Emacs was asked to convert the\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
576 selection into before sending (for example, `STRING' or `LENGTH');\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
577 - a flag indicating success or failure for responding to the request.\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
578 We might have failed (and declined the request) for any number of reasons,\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
579 including being asked for a selection that we no longer own, or being asked\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
580 to convert into a type that we don't know about or that is inappropriate.\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
581 This hook doesn't let you change the behavior of Emacs's selection replies,\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
582 it merely informs you that they have happened."); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
583 Vns_sent_selection_hooks = Qnil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
584 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
585 DEFVAR_LISP ("selection-converter-alist", &Vselection_converter_alist, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
586 "An alist associating X Windows selection-types with functions.\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
587 These functions are called to convert the selection, with three args:\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
588 the name of the selection (typically `PRIMARY', `SECONDARY', or `CLIPBOARD');\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
589 a desired type to which the selection should be converted;\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
590 and the local selection value (whatever was given to `x-own-selection').\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
591 \n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
592 The function should return the value to send to the X server\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
593 \(typically a string). A return value of nil\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
594 means that the conversion could not be done.\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
595 A return value which is the symbol `NULL'\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
596 means that a side-effect was executed,\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
597 and there is no meaningful selection value."); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
598 Vselection_converter_alist = Qnil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
599 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
600 DEFVAR_LISP ("ns-lost-selection-hooks", &Vns_lost_selection_hooks, |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
601 "A list of functions to be called when Emacs loses an X selection.\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
602 \(This happens when some other X client makes its own selection\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
603 or when a Lisp program explicitly clears the selection.)\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
604 The functions are called with one argument, the selection type\n\ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
605 \(a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD')."); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
606 Vns_lost_selection_hooks = Qnil; |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
607 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
608 Qforeign_selection = intern ("foreign-selection"); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
609 staticpro (&Qforeign_selection); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
610 } |
96685 | 611 |
96689
f34c4d928d39
Use nicer comment syntax for arch taglines in Objective-C files
Miles Bader <miles@gnu.org>
parents:
96685
diff
changeset
|
612 // arch-tag: 39d1dde7-06a6-49ff-95a7-0e7af12d2218 |