Mercurial > emacs
annotate lisp/term/x-win.el @ 8515:3043fef029a7
(copy-face): Ignore errors in set-face-font.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 11 Aug 1994 07:11:51 +0000 |
parents | acca78b72dd6 |
children | 14951c0ea4f8 |
rev | line source |
---|---|
2157
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
1 ;;; x-win.el --- parse switches controlling interface with X window system |
7298 | 2 ;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. |
2157
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
3 |
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
4 ;; Author: FSF |
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
5 ;; Keywords: terminals |
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
6 |
3287 | 7 ;;; This file is part of GNU Emacs. |
8 ;;; | |
9 ;;; GNU Emacs is free software; you can redistribute it and/or modify | |
10 ;;; it under the terms of the GNU General Public License as published by | |
11 ;;; the Free Software Foundation; either version 2, or (at your option) | |
12 ;;; any later version. | |
13 ;;; | |
14 ;;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;;; GNU General Public License for more details. | |
18 ;;; | |
19 ;;; You should have received a copy of the GNU General Public License | |
20 ;;; along with GNU Emacs; see the file COPYING. If not, write to | |
21 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
54 | 22 |
2157
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
23 ;;; Commentary: |
54 | 24 |
25 ;; X-win.el: this file is loaded from ../lisp/startup.el when it recognizes | |
26 ;; that X windows are to be used. Command line switches are parsed and those | |
27 ;; pertaining to X are processed and removed from the command line. The | |
28 ;; X display is opened and hooks are set for popping up the initial window. | |
29 | |
30 ;; startup.el will then examine startup files, and eventually call the hooks | |
31 ;; which create the first window (s). | |
2157
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
32 |
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
33 ;;; Code: |
54 | 34 |
35 ;; These are the standard X switches from the Xt Initialize.c file of | |
36 ;; Release 4. | |
37 | |
38 ;; Command line Resource Manager string | |
39 | |
40 ;; +rv *reverseVideo | |
41 ;; +synchronous *synchronous | |
42 ;; -background *background | |
43 ;; -bd *borderColor | |
44 ;; -bg *background | |
45 ;; -bordercolor *borderColor | |
46 ;; -borderwidth .borderWidth | |
47 ;; -bw .borderWidth | |
48 ;; -display .display | |
49 ;; -fg *foreground | |
50 ;; -fn *font | |
51 ;; -font *font | |
52 ;; -foreground *foreground | |
53 ;; -geometry .geometry | |
3070
08003ba2ac71
* x-win.el (command-switch-alist, x-switch-definitions): Treat
Jim Blandy <jimb@redhat.com>
parents:
3068
diff
changeset
|
54 ;; -i .iconType |
08003ba2ac71
* x-win.el (command-switch-alist, x-switch-definitions): Treat
Jim Blandy <jimb@redhat.com>
parents:
3068
diff
changeset
|
55 ;; -itype .iconType |
54 | 56 ;; -iconic .iconic |
57 ;; -name .name | |
58 ;; -reverse *reverseVideo | |
59 ;; -rv *reverseVideo | |
60 ;; -selectionTimeout .selectionTimeout | |
61 ;; -synchronous *synchronous | |
62 ;; -xrm | |
63 | |
64 ;; An alist of X options and the function which handles them. See | |
65 ;; ../startup.el. | |
66 | |
273 | 67 (if (not (eq window-system 'x)) |
4132
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
68 (error "%s: Loading x-win.el but not compiled for X" (invocation-name))) |
273 | 69 |
779 | 70 (require 'frame) |
467 | 71 (require 'mouse) |
1972
b0cde2f5164d
* term/x-win.el: Require `scroll-bar', not `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1954
diff
changeset
|
72 (require 'scroll-bar) |
2718
c91b18333f58
* x-win.el: Since we require faces.el, there's no point in setting
Jim Blandy <jimb@redhat.com>
parents:
2586
diff
changeset
|
73 (require 'faces) |
c91b18333f58
* x-win.el: Since we require faces.el, there's no point in setting
Jim Blandy <jimb@redhat.com>
parents:
2586
diff
changeset
|
74 (require 'select) |
2808 | 75 (require 'menu-bar) |
273 | 76 |
3373
4177a984e5c0
(x-invocation-args): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
3287
diff
changeset
|
77 (defvar x-invocation-args) |
4177a984e5c0
(x-invocation-args): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
3287
diff
changeset
|
78 |
3081
63c51f1e885b
Pass x-command-line-resources to x-open-connection.
Richard M. Stallman <rms@gnu.org>
parents:
3070
diff
changeset
|
79 (defvar x-command-line-resources nil) |
63c51f1e885b
Pass x-command-line-resources to x-open-connection.
Richard M. Stallman <rms@gnu.org>
parents:
3070
diff
changeset
|
80 |
54 | 81 (setq command-switch-alist |
380 | 82 (append '(("-bw" . x-handle-numeric-switch) |
273 | 83 ("-d" . x-handle-display) |
84 ("-display" . x-handle-display) | |
4132
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
85 ("-name" . x-handle-name-rn-switch) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
86 ("-rn" . x-handle-name-rn-switch) |
273 | 87 ("-T" . x-handle-switch) |
88 ("-r" . x-handle-switch) | |
89 ("-rv" . x-handle-switch) | |
90 ("-reverse" . x-handle-switch) | |
91 ("-fn" . x-handle-switch) | |
92 ("-font" . x-handle-switch) | |
3889
2eebd5d36093
* term/x-win.el (command-switch-alist): "-ib" takes a numeric
Jim Blandy <jimb@redhat.com>
parents:
3756
diff
changeset
|
93 ("-ib" . x-handle-numeric-switch) |
273 | 94 ("-g" . x-handle-geometry) |
95 ("-geometry" . x-handle-geometry) | |
96 ("-fg" . x-handle-switch) | |
97 ("-foreground". x-handle-switch) | |
98 ("-bg" . x-handle-switch) | |
99 ("-background". x-handle-switch) | |
100 ("-ms" . x-handle-switch) | |
1547
2754d53edf5d
(command-switch-alist, x-switch-definitions):
Richard M. Stallman <rms@gnu.org>
parents:
1546
diff
changeset
|
101 ("-itype" . x-handle-switch) |
3070
08003ba2ac71
* x-win.el (command-switch-alist, x-switch-definitions): Treat
Jim Blandy <jimb@redhat.com>
parents:
3068
diff
changeset
|
102 ("-i" . x-handle-switch) |
4306
2e51ffb537a8
(x-handle-iconic): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4280
diff
changeset
|
103 ("-iconic" . x-handle-iconic) |
4132
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
104 ("-xrm" . x-handle-xrm-switch) |
273 | 105 ("-cr" . x-handle-switch) |
106 ("-vb" . x-handle-switch) | |
107 ("-hb" . x-handle-switch) | |
108 ("-bd" . x-handle-switch)) | |
54 | 109 command-switch-alist)) |
110 | |
111 (defconst x-switch-definitions | |
112 '(("-name" name) | |
113 ("-T" name) | |
3068
32c1cb0149b3
* x-win.el (x-select-text): New arg PUSH.
Jim Blandy <jimb@redhat.com>
parents:
3036
diff
changeset
|
114 ("-r" reverse t) |
32c1cb0149b3
* x-win.el (x-select-text): New arg PUSH.
Jim Blandy <jimb@redhat.com>
parents:
3036
diff
changeset
|
115 ("-rv" reverse t) |
32c1cb0149b3
* x-win.el (x-select-text): New arg PUSH.
Jim Blandy <jimb@redhat.com>
parents:
3036
diff
changeset
|
116 ("-reverse" reverse t) |
54 | 117 ("-fn" font) |
118 ("-font" font) | |
119 ("-ib" internal-border-width) | |
120 ("-fg" foreground-color) | |
121 ("-foreground" foreground-color) | |
122 ("-bg" background-color) | |
123 ("-background" background-color) | |
124 ("-ms" mouse-color) | |
125 ("-cr" cursor-color) | |
1547
2754d53edf5d
(command-switch-alist, x-switch-definitions):
Richard M. Stallman <rms@gnu.org>
parents:
1546
diff
changeset
|
126 ("-itype" icon-type t) |
3070
08003ba2ac71
* x-win.el (command-switch-alist, x-switch-definitions): Treat
Jim Blandy <jimb@redhat.com>
parents:
3068
diff
changeset
|
127 ("-i" icon-type t) |
1984
e0c7208bdafa
* term/x-win.el (x-switch-definitons): Use the proper names for
Jim Blandy <jimb@redhat.com>
parents:
1972
diff
changeset
|
128 ("-vb" vertical-scroll-bars t) |
e0c7208bdafa
* term/x-win.el (x-switch-definitons): Use the proper names for
Jim Blandy <jimb@redhat.com>
parents:
1972
diff
changeset
|
129 ("-hb" horizontal-scroll-bars t) |
54 | 130 ("-bd" border-color) |
131 ("-bw" border-width))) | |
132 | |
133 ;; Handler for switches of the form "-switch value" or "-switch". | |
134 (defun x-handle-switch (switch) | |
135 (let ((aelt (assoc switch x-switch-definitions))) | |
136 (if aelt | |
137 (if (nth 2 aelt) | |
779 | 138 (setq default-frame-alist |
54 | 139 (cons (cons (nth 1 aelt) (nth 2 aelt)) |
779 | 140 default-frame-alist)) |
141 (setq default-frame-alist | |
54 | 142 (cons (cons (nth 1 aelt) |
143 (car x-invocation-args)) | |
779 | 144 default-frame-alist) |
54 | 145 x-invocation-args (cdr x-invocation-args)))))) |
146 | |
4306
2e51ffb537a8
(x-handle-iconic): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4280
diff
changeset
|
147 ;; Make -iconic apply only to the initial frame! |
2e51ffb537a8
(x-handle-iconic): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4280
diff
changeset
|
148 (defun x-handle-iconic (switch) |
2e51ffb537a8
(x-handle-iconic): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4280
diff
changeset
|
149 (setq initial-frame-alist |
2e51ffb537a8
(x-handle-iconic): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4280
diff
changeset
|
150 (cons '(visibility . icon) initial-frame-alist))) |
2e51ffb537a8
(x-handle-iconic): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4280
diff
changeset
|
151 |
54 | 152 ;; Handler for switches of the form "-switch n" |
153 (defun x-handle-numeric-switch (switch) | |
154 (let ((aelt (assoc switch x-switch-definitions))) | |
155 (if aelt | |
779 | 156 (setq default-frame-alist |
54 | 157 (cons (cons (nth 1 aelt) |
158 (string-to-int (car x-invocation-args))) | |
779 | 159 default-frame-alist) |
54 | 160 x-invocation-args |
161 (cdr x-invocation-args))))) | |
162 | |
4132
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
163 ;; Handle the -xrm option. |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
164 (defun x-handle-xrm-switch (switch) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
165 (or (consp x-invocation-args) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
166 (error "%s: missing argument to `%s' option" (invocation-name) switch)) |
3081
63c51f1e885b
Pass x-command-line-resources to x-open-connection.
Richard M. Stallman <rms@gnu.org>
parents:
3070
diff
changeset
|
167 (setq x-command-line-resources (car x-invocation-args)) |
63c51f1e885b
Pass x-command-line-resources to x-open-connection.
Richard M. Stallman <rms@gnu.org>
parents:
3070
diff
changeset
|
168 (setq x-invocation-args (cdr x-invocation-args))) |
63c51f1e885b
Pass x-command-line-resources to x-open-connection.
Richard M. Stallman <rms@gnu.org>
parents:
3070
diff
changeset
|
169 |
54 | 170 ;; Handle the geometry option |
171 (defun x-handle-geometry (switch) | |
7249
876b3518fa78
(x-handle-geometry): Specify user-position and
Richard M. Stallman <rms@gnu.org>
parents:
6792
diff
changeset
|
172 (let ((geo (x-parse-geometry (car x-invocation-args)))) |
876b3518fa78
(x-handle-geometry): Specify user-position and
Richard M. Stallman <rms@gnu.org>
parents:
6792
diff
changeset
|
173 (setq initial-frame-alist |
876b3518fa78
(x-handle-geometry): Specify user-position and
Richard M. Stallman <rms@gnu.org>
parents:
6792
diff
changeset
|
174 (append initial-frame-alist |
876b3518fa78
(x-handle-geometry): Specify user-position and
Richard M. Stallman <rms@gnu.org>
parents:
6792
diff
changeset
|
175 (if (or (assq 'left geo) (assq 'top geo)) |
876b3518fa78
(x-handle-geometry): Specify user-position and
Richard M. Stallman <rms@gnu.org>
parents:
6792
diff
changeset
|
176 '((user-position . t))) |
876b3518fa78
(x-handle-geometry): Specify user-position and
Richard M. Stallman <rms@gnu.org>
parents:
6792
diff
changeset
|
177 (if (or (assq 'height geo) (assq 'width geo)) |
876b3518fa78
(x-handle-geometry): Specify user-position and
Richard M. Stallman <rms@gnu.org>
parents:
6792
diff
changeset
|
178 '((user-size . t))) |
876b3518fa78
(x-handle-geometry): Specify user-position and
Richard M. Stallman <rms@gnu.org>
parents:
6792
diff
changeset
|
179 geo) |
876b3518fa78
(x-handle-geometry): Specify user-position and
Richard M. Stallman <rms@gnu.org>
parents:
6792
diff
changeset
|
180 x-invocation-args (cdr x-invocation-args)))) |
54 | 181 |
4132
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
182 ;; Handle the -name and -rn options. Set the variable x-resource-name |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
183 ;; to the option's operand; if the switch was `-name', set the name of |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
184 ;; the initial frame, too. |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
185 (defun x-handle-name-rn-switch (switch) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
186 (or (consp x-invocation-args) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
187 (error "%s: missing argument to `%s' option" (invocation-name) switch)) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
188 (setq x-resource-name (car x-invocation-args) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
189 x-invocation-args (cdr x-invocation-args)) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
190 (if (string= switch "-name") |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
191 (setq initial-frame-alist (cons (cons 'name x-resource-name) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
192 initial-frame-alist)))) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
193 |
54 | 194 (defvar x-display-name nil |
779 | 195 "The X display name specifying server and X frame.") |
54 | 196 |
197 (defun x-handle-display (switch) | |
198 (setq x-display-name (car x-invocation-args) | |
199 x-invocation-args (cdr x-invocation-args))) | |
200 | |
201 (defvar x-invocation-args nil) | |
202 | |
321 | 203 (defun x-handle-args (args) |
6698
b107e54218fe
(x-select-enable-clipboard): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
6399
diff
changeset
|
204 "Process the X-related command line options in ARGS. |
b107e54218fe
(x-select-enable-clipboard): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
6399
diff
changeset
|
205 This is done before the user's startup file is loaded. They are copied to |
321 | 206 x-invocation args from which the X-related things are extracted, first |
207 the switch (e.g., \"-fg\") in the following code, and possible values | |
7639 | 208 \(e.g., \"black\") in the option handler code (e.g., x-handle-switch). |
321 | 209 This returns ARGS with the arguments that have been processed removed." |
273 | 210 (setq x-invocation-args args |
211 args nil) | |
212 (while x-invocation-args | |
213 (let* ((this-switch (car x-invocation-args)) | |
214 (aelt (assoc this-switch command-switch-alist))) | |
215 (setq x-invocation-args (cdr x-invocation-args)) | |
216 (if aelt | |
217 (funcall (cdr aelt) this-switch) | |
218 (setq args (cons this-switch args))))) | |
219 (setq args (nreverse args))) | |
220 | |
279 | 221 |
54 | 222 |
223 ;; | |
224 ;; Standard X cursor shapes, courtesy of Mr. Fox, who wanted ALL of them. | |
225 ;; | |
226 | |
227 (defconst x-pointer-X-cursor 0) | |
228 (defconst x-pointer-arrow 2) | |
229 (defconst x-pointer-based-arrow-down 4) | |
230 (defconst x-pointer-based-arrow-up 6) | |
231 (defconst x-pointer-boat 8) | |
232 (defconst x-pointer-bogosity 10) | |
233 (defconst x-pointer-bottom-left-corner 12) | |
234 (defconst x-pointer-bottom-right-corner 14) | |
235 (defconst x-pointer-bottom-side 16) | |
236 (defconst x-pointer-bottom-tee 18) | |
237 (defconst x-pointer-box-spiral 20) | |
238 (defconst x-pointer-center-ptr 22) | |
239 (defconst x-pointer-circle 24) | |
240 (defconst x-pointer-clock 26) | |
241 (defconst x-pointer-coffee-mug 28) | |
242 (defconst x-pointer-cross 30) | |
243 (defconst x-pointer-cross-reverse 32) | |
244 (defconst x-pointer-crosshair 34) | |
245 (defconst x-pointer-diamond-cross 36) | |
246 (defconst x-pointer-dot 38) | |
247 (defconst x-pointer-dotbox 40) | |
248 (defconst x-pointer-double-arrow 42) | |
249 (defconst x-pointer-draft-large 44) | |
250 (defconst x-pointer-draft-small 46) | |
251 (defconst x-pointer-draped-box 48) | |
252 (defconst x-pointer-exchange 50) | |
253 (defconst x-pointer-fleur 52) | |
254 (defconst x-pointer-gobbler 54) | |
255 (defconst x-pointer-gumby 56) | |
256 (defconst x-pointer-hand1 58) | |
257 (defconst x-pointer-hand2 60) | |
258 (defconst x-pointer-heart 62) | |
259 (defconst x-pointer-icon 64) | |
260 (defconst x-pointer-iron-cross 66) | |
261 (defconst x-pointer-left-ptr 68) | |
262 (defconst x-pointer-left-side 70) | |
263 (defconst x-pointer-left-tee 72) | |
264 (defconst x-pointer-leftbutton 74) | |
265 (defconst x-pointer-ll-angle 76) | |
266 (defconst x-pointer-lr-angle 78) | |
267 (defconst x-pointer-man 80) | |
268 (defconst x-pointer-middlebutton 82) | |
269 (defconst x-pointer-mouse 84) | |
270 (defconst x-pointer-pencil 86) | |
271 (defconst x-pointer-pirate 88) | |
272 (defconst x-pointer-plus 90) | |
273 (defconst x-pointer-question-arrow 92) | |
274 (defconst x-pointer-right-ptr 94) | |
275 (defconst x-pointer-right-side 96) | |
276 (defconst x-pointer-right-tee 98) | |
277 (defconst x-pointer-rightbutton 100) | |
278 (defconst x-pointer-rtl-logo 102) | |
279 (defconst x-pointer-sailboat 104) | |
280 (defconst x-pointer-sb-down-arrow 106) | |
281 (defconst x-pointer-sb-h-double-arrow 108) | |
282 (defconst x-pointer-sb-left-arrow 110) | |
283 (defconst x-pointer-sb-right-arrow 112) | |
284 (defconst x-pointer-sb-up-arrow 114) | |
285 (defconst x-pointer-sb-v-double-arrow 116) | |
286 (defconst x-pointer-shuttle 118) | |
287 (defconst x-pointer-sizing 120) | |
288 (defconst x-pointer-spider 122) | |
289 (defconst x-pointer-spraycan 124) | |
290 (defconst x-pointer-star 126) | |
291 (defconst x-pointer-target 128) | |
292 (defconst x-pointer-tcross 130) | |
293 (defconst x-pointer-top-left-arrow 132) | |
294 (defconst x-pointer-top-left-corner 134) | |
295 (defconst x-pointer-top-right-corner 136) | |
296 (defconst x-pointer-top-side 138) | |
297 (defconst x-pointer-top-tee 140) | |
298 (defconst x-pointer-trek 142) | |
299 (defconst x-pointer-ul-angle 144) | |
300 (defconst x-pointer-umbrella 146) | |
301 (defconst x-pointer-ur-angle 148) | |
302 (defconst x-pointer-watch 150) | |
303 (defconst x-pointer-xterm 152) | |
304 | |
305 ;; | |
306 ;; Available colors | |
307 ;; | |
308 | |
309 (defvar x-colors '("aquamarine" | |
310 "Aquamarine" | |
311 "medium aquamarine" | |
312 "MediumAquamarine" | |
313 "black" | |
314 "Black" | |
315 "blue" | |
316 "Blue" | |
317 "cadet blue" | |
318 "CadetBlue" | |
319 "cornflower blue" | |
320 "CornflowerBlue" | |
321 "dark slate blue" | |
322 "DarkSlateBlue" | |
323 "light blue" | |
324 "LightBlue" | |
325 "light steel blue" | |
326 "LightSteelBlue" | |
327 "medium blue" | |
328 "MediumBlue" | |
329 "medium slate blue" | |
330 "MediumSlateBlue" | |
331 "midnight blue" | |
332 "MidnightBlue" | |
333 "navy blue" | |
334 "NavyBlue" | |
335 "navy" | |
336 "Navy" | |
337 "sky blue" | |
338 "SkyBlue" | |
339 "slate blue" | |
340 "SlateBlue" | |
341 "steel blue" | |
342 "SteelBlue" | |
343 "coral" | |
344 "Coral" | |
345 "cyan" | |
346 "Cyan" | |
347 "firebrick" | |
348 "Firebrick" | |
349 "brown" | |
350 "Brown" | |
351 "gold" | |
352 "Gold" | |
353 "goldenrod" | |
354 "Goldenrod" | |
355 "medium goldenrod" | |
356 "MediumGoldenrod" | |
357 "green" | |
358 "Green" | |
359 "dark green" | |
360 "DarkGreen" | |
361 "dark olive green" | |
362 "DarkOliveGreen" | |
363 "forest green" | |
364 "ForestGreen" | |
365 "lime green" | |
366 "LimeGreen" | |
367 "medium forest green" | |
368 "MediumForestGreen" | |
369 "medium sea green" | |
370 "MediumSeaGreen" | |
371 "medium spring green" | |
372 "MediumSpringGreen" | |
373 "pale green" | |
374 "PaleGreen" | |
375 "sea green" | |
376 "SeaGreen" | |
377 "spring green" | |
378 "SpringGreen" | |
379 "yellow green" | |
380 "YellowGreen" | |
381 "dark slate grey" | |
382 "DarkSlateGrey" | |
383 "dark slate gray" | |
384 "DarkSlateGray" | |
385 "dim grey" | |
386 "DimGrey" | |
387 "dim gray" | |
388 "DimGray" | |
389 "light grey" | |
390 "LightGrey" | |
391 "light gray" | |
392 "LightGray" | |
393 "gray" | |
394 "grey" | |
395 "Gray" | |
396 "Grey" | |
397 "khaki" | |
398 "Khaki" | |
399 "magenta" | |
400 "Magenta" | |
401 "maroon" | |
402 "Maroon" | |
403 "orange" | |
404 "Orange" | |
405 "orchid" | |
406 "Orchid" | |
407 "dark orchid" | |
408 "DarkOrchid" | |
409 "medium orchid" | |
410 "MediumOrchid" | |
411 "pink" | |
412 "Pink" | |
413 "plum" | |
414 "Plum" | |
415 "red" | |
416 "Red" | |
417 "indian red" | |
418 "IndianRed" | |
419 "medium violet red" | |
420 "MediumVioletRed" | |
421 "orange red" | |
422 "OrangeRed" | |
423 "violet red" | |
424 "VioletRed" | |
425 "salmon" | |
426 "Salmon" | |
427 "sienna" | |
428 "Sienna" | |
429 "tan" | |
430 "Tan" | |
431 "thistle" | |
432 "Thistle" | |
433 "turquoise" | |
434 "Turquoise" | |
435 "dark turquoise" | |
436 "DarkTurquoise" | |
437 "medium turquoise" | |
438 "MediumTurquoise" | |
439 "violet" | |
440 "Violet" | |
441 "blue violet" | |
442 "BlueViolet" | |
443 "wheat" | |
444 "Wheat" | |
445 "white" | |
446 "White" | |
447 "yellow" | |
448 "Yellow" | |
449 "green yellow" | |
450 "GreenYellow") | |
451 "The full list of X colors from the rgb.text file.") | |
452 | |
453 (defun x-defined-colors () | |
454 "Return a list of colors supported by the current X-Display." | |
455 (let ((all-colors x-colors) | |
456 (this-color nil) | |
457 (defined-colors nil)) | |
458 (while all-colors | |
459 (setq this-color (car all-colors) | |
460 all-colors (cdr all-colors)) | |
2367
df7de9403e02
* x-win.el (x-defined-colors): Use x-color-defined-p instead of
Jim Blandy <jimb@redhat.com>
parents:
2366
diff
changeset
|
461 (and (x-color-defined-p this-color) |
54 | 462 (setq defined-colors (cons this-color defined-colors)))) |
463 defined-colors)) | |
396 | 464 |
465 ;;;; Function keys | |
466 | |
4313
87472f1eb031
(iconify-or-deiconify-frame): New function. Use it for C-z.
Richard M. Stallman <rms@gnu.org>
parents:
4306
diff
changeset
|
467 (defun iconify-or-deiconify-frame () |
87472f1eb031
(iconify-or-deiconify-frame): New function. Use it for C-z.
Richard M. Stallman <rms@gnu.org>
parents:
4306
diff
changeset
|
468 "Iconify the selected frame, or deiconify if it's currently an icon." |
87472f1eb031
(iconify-or-deiconify-frame): New function. Use it for C-z.
Richard M. Stallman <rms@gnu.org>
parents:
4306
diff
changeset
|
469 (interactive) |
87472f1eb031
(iconify-or-deiconify-frame): New function. Use it for C-z.
Richard M. Stallman <rms@gnu.org>
parents:
4306
diff
changeset
|
470 (if (eq (cdr (assq 'visibility (frame-parameters))) t) |
87472f1eb031
(iconify-or-deiconify-frame): New function. Use it for C-z.
Richard M. Stallman <rms@gnu.org>
parents:
4306
diff
changeset
|
471 (iconify-frame) |
6141
fefa088fc7f9
(iconify-or-deiconify-frame): Don't make invisible before making visible.
Karl Heuer <kwzh@gnu.org>
parents:
6137
diff
changeset
|
472 (make-frame-visible))) |
4313
87472f1eb031
(iconify-or-deiconify-frame): New function. Use it for C-z.
Richard M. Stallman <rms@gnu.org>
parents:
4306
diff
changeset
|
473 |
87472f1eb031
(iconify-or-deiconify-frame): New function. Use it for C-z.
Richard M. Stallman <rms@gnu.org>
parents:
4306
diff
changeset
|
474 (substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame |
87472f1eb031
(iconify-or-deiconify-frame): New function. Use it for C-z.
Richard M. Stallman <rms@gnu.org>
parents:
4306
diff
changeset
|
475 global-map) |
1546 | 476 |
2145
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
477 ;; Map certain keypad keys into ASCII characters |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
478 ;; that people usually expect. |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
479 (define-key function-key-map [backspace] [127]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
480 (define-key function-key-map [delete] [127]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
481 (define-key function-key-map [tab] [?\t]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
482 (define-key function-key-map [linefeed] [?\n]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
483 (define-key function-key-map [clear] [11]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
484 (define-key function-key-map [return] [13]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
485 (define-key function-key-map [escape] [?\e]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
486 (define-key function-key-map [M-backspace] [?\M-\d]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
487 (define-key function-key-map [M-delete] [?\M-\d]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
488 (define-key function-key-map [M-tab] [?\M-\t]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
489 (define-key function-key-map [M-linefeed] [?\M-\n]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
490 (define-key function-key-map [M-clear] [?\M-\013]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
491 (define-key function-key-map [M-return] [?\M-\015]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
492 (define-key function-key-map [M-escape] [?\M-\e]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
493 |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
494 ;; These tell read-char how to convert |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
495 ;; these special chars to ASCII. |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
496 (put 'backspace 'ascii-character 127) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
497 (put 'delete 'ascii-character 127) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
498 (put 'tab 'ascii-character ?\t) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
499 (put 'linefeed 'ascii-character ?\n) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
500 (put 'clear 'ascii-character 12) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
501 (put 'return 'ascii-character 13) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
502 (put 'escape 'ascii-character ?\e) |
5515
920b55d2057b
(vendor-key-syms): Set this variable.
Richard M. Stallman <rms@gnu.org>
parents:
4314
diff
changeset
|
503 |
5537
899159133053
(vendor-key-syms): Add more HP keysyms and some Sun.
Richard M. Stallman <rms@gnu.org>
parents:
5515
diff
changeset
|
504 ;; Set up to recognize vendor-specific keysyms. |
899159133053
(vendor-key-syms): Add more HP keysyms and some Sun.
Richard M. Stallman <rms@gnu.org>
parents:
5515
diff
changeset
|
505 ;; Unless/until there is a real conflict, |
899159133053
(vendor-key-syms): Add more HP keysyms and some Sun.
Richard M. Stallman <rms@gnu.org>
parents:
5515
diff
changeset
|
506 ;; we need not try to make this list depend on |
899159133053
(vendor-key-syms): Add more HP keysyms and some Sun.
Richard M. Stallman <rms@gnu.org>
parents:
5515
diff
changeset
|
507 ;; the type of X server in use. |
6097
adf5b18629c8
(system-key-alist): Renamed from vendor-key-syms.
Richard M. Stallman <rms@gnu.org>
parents:
5546
diff
changeset
|
508 (setq system-key-alist |
5515
920b55d2057b
(vendor-key-syms): Set this variable.
Richard M. Stallman <rms@gnu.org>
parents:
4314
diff
changeset
|
509 '( |
920b55d2057b
(vendor-key-syms): Set this variable.
Richard M. Stallman <rms@gnu.org>
parents:
4314
diff
changeset
|
510 ;; These are some HP keys. |
5537
899159133053
(vendor-key-syms): Add more HP keysyms and some Sun.
Richard M. Stallman <rms@gnu.org>
parents:
5515
diff
changeset
|
511 ( 168 . mute-acute) |
899159133053
(vendor-key-syms): Add more HP keysyms and some Sun.
Richard M. Stallman <rms@gnu.org>
parents:
5515
diff
changeset
|
512 ( 169 . mute-grave) |
899159133053
(vendor-key-syms): Add more HP keysyms and some Sun.
Richard M. Stallman <rms@gnu.org>
parents:
5515
diff
changeset
|
513 ( 170 . mute-asciicircum) |
899159133053
(vendor-key-syms): Add more HP keysyms and some Sun.
Richard M. Stallman <rms@gnu.org>
parents:
5515
diff
changeset
|
514 ( 171 . mute-diaeresis) |
899159133053
(vendor-key-syms): Add more HP keysyms and some Sun.
Richard M. Stallman <rms@gnu.org>
parents:
5515
diff
changeset
|
515 ( 172 . mute-asciitilde) |
899159133053
(vendor-key-syms): Add more HP keysyms and some Sun.
Richard M. Stallman <rms@gnu.org>
parents:
5515
diff
changeset
|
516 ( 175 . lira) |
899159133053
(vendor-key-syms): Add more HP keysyms and some Sun.
Richard M. Stallman <rms@gnu.org>
parents:
5515
diff
changeset
|
517 ( 190 . guilder) |
899159133053
(vendor-key-syms): Add more HP keysyms and some Sun.
Richard M. Stallman <rms@gnu.org>
parents:
5515
diff
changeset
|
518 ( 252 . block) |
899159133053
(vendor-key-syms): Add more HP keysyms and some Sun.
Richard M. Stallman <rms@gnu.org>
parents:
5515
diff
changeset
|
519 ( 256 . longminus) |
5515
920b55d2057b
(vendor-key-syms): Set this variable.
Richard M. Stallman <rms@gnu.org>
parents:
4314
diff
changeset
|
520 (65388 . reset) |
920b55d2057b
(vendor-key-syms): Set this variable.
Richard M. Stallman <rms@gnu.org>
parents:
4314
diff
changeset
|
521 (65389 . system) |
920b55d2057b
(vendor-key-syms): Set this variable.
Richard M. Stallman <rms@gnu.org>
parents:
4314
diff
changeset
|
522 (65390 . user) |
920b55d2057b
(vendor-key-syms): Set this variable.
Richard M. Stallman <rms@gnu.org>
parents:
4314
diff
changeset
|
523 (65391 . clearline) |
920b55d2057b
(vendor-key-syms): Set this variable.
Richard M. Stallman <rms@gnu.org>
parents:
4314
diff
changeset
|
524 (65392 . insertline) |
920b55d2057b
(vendor-key-syms): Set this variable.
Richard M. Stallman <rms@gnu.org>
parents:
4314
diff
changeset
|
525 (65393 . deleteline) |
920b55d2057b
(vendor-key-syms): Set this variable.
Richard M. Stallman <rms@gnu.org>
parents:
4314
diff
changeset
|
526 (65394 . insertchar) |
920b55d2057b
(vendor-key-syms): Set this variable.
Richard M. Stallman <rms@gnu.org>
parents:
4314
diff
changeset
|
527 (65395 . deletechar) |
920b55d2057b
(vendor-key-syms): Set this variable.
Richard M. Stallman <rms@gnu.org>
parents:
4314
diff
changeset
|
528 (65396 . backtab) |
920b55d2057b
(vendor-key-syms): Set this variable.
Richard M. Stallman <rms@gnu.org>
parents:
4314
diff
changeset
|
529 (65397 . kp-backtab) |
6195
f5f8e0bcfaaf
(system-key-alist): Fix the code value for `remove'.
Richard M. Stallman <rms@gnu.org>
parents:
6141
diff
changeset
|
530 ;; This is used by DEC's X server. |
f5f8e0bcfaaf
(system-key-alist): Fix the code value for `remove'.
Richard M. Stallman <rms@gnu.org>
parents:
6141
diff
changeset
|
531 (65280 . remove) |
5537
899159133053
(vendor-key-syms): Add more HP keysyms and some Sun.
Richard M. Stallman <rms@gnu.org>
parents:
5515
diff
changeset
|
532 ;; These are for Sun. |
899159133053
(vendor-key-syms): Add more HP keysyms and some Sun.
Richard M. Stallman <rms@gnu.org>
parents:
5515
diff
changeset
|
533 (392976 . f35) |
899159133053
(vendor-key-syms): Add more HP keysyms and some Sun.
Richard M. Stallman <rms@gnu.org>
parents:
5515
diff
changeset
|
534 (392977 . f36) |
5546
19618ce9a103
(vendor-key-syms): Fixed typo (extra parens).
Roland McGrath <roland@gnu.org>
parents:
5537
diff
changeset
|
535 (393056 . req) |
8319
acca78b72dd6
(system-key-alist): Add Sun-specific X11R6 keysyms.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
536 ;; These are for Sun under X11R6 |
acca78b72dd6
(system-key-alist): Add Sun-specific X11R6 keysyms.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
537 (393072 . props) |
acca78b72dd6
(system-key-alist): Add Sun-specific X11R6 keysyms.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
538 (393073 . front) |
acca78b72dd6
(system-key-alist): Add Sun-specific X11R6 keysyms.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
539 (393074 . copy) |
acca78b72dd6
(system-key-alist): Add Sun-specific X11R6 keysyms.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
540 (393075 . open) |
acca78b72dd6
(system-key-alist): Add Sun-specific X11R6 keysyms.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
541 (393076 . paste) |
acca78b72dd6
(system-key-alist): Add Sun-specific X11R6 keysyms.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
542 (393077 . cut) |
5515
920b55d2057b
(vendor-key-syms): Set this variable.
Richard M. Stallman <rms@gnu.org>
parents:
4314
diff
changeset
|
543 )) |
54 | 544 |
1546 | 545 ;;;; Selections and cut buffers |
707 | 546 |
727 | 547 ;;; We keep track of the last text selected here, so we can check the |
548 ;;; current selection against it, and avoid passing back our own text | |
549 ;;; from x-cut-buffer-or-selection-value. | |
550 (defvar x-last-selected-text nil) | |
551 | |
4273
79dc5c3370f8
(x-select-text): Never set the CLIPBOARD selection.
Richard M. Stallman <rms@gnu.org>
parents:
4246
diff
changeset
|
552 ;;; It is said that overlarge strings are slow to put into the cut buffer. |
4306
2e51ffb537a8
(x-handle-iconic): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4280
diff
changeset
|
553 ;;; Note this value is overridden below. |
2e51ffb537a8
(x-handle-iconic): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4280
diff
changeset
|
554 (defvar x-cut-buffer-max 20000 |
4273
79dc5c3370f8
(x-select-text): Never set the CLIPBOARD selection.
Richard M. Stallman <rms@gnu.org>
parents:
4246
diff
changeset
|
555 "Max number of characters to put in the cut buffer.") |
4236
8e14db210975
(x-select-text): Limit size of text sent to cut buffer.
Richard M. Stallman <rms@gnu.org>
parents:
4132
diff
changeset
|
556 |
6698
b107e54218fe
(x-select-enable-clipboard): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
6399
diff
changeset
|
557 (defvar x-select-enable-clipboard nil |
b107e54218fe
(x-select-enable-clipboard): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
6399
diff
changeset
|
558 "Non-nil means cutting and pasting uses the clipboard. |
b107e54218fe
(x-select-enable-clipboard): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
6399
diff
changeset
|
559 This is in addition to the primary selection.") |
b107e54218fe
(x-select-enable-clipboard): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
6399
diff
changeset
|
560 |
4273
79dc5c3370f8
(x-select-text): Never set the CLIPBOARD selection.
Richard M. Stallman <rms@gnu.org>
parents:
4246
diff
changeset
|
561 ;;; Make TEXT, a string, the primary X selection. |
707 | 562 ;;; Also, set the value of X cut buffer 0, for backward compatibility |
1817
5c2bdeb13f68
x-selection-value has been renamed to x-selection.
Jim Blandy <jimb@redhat.com>
parents:
1772
diff
changeset
|
563 ;;; with older X applications. |
4273
79dc5c3370f8
(x-select-text): Never set the CLIPBOARD selection.
Richard M. Stallman <rms@gnu.org>
parents:
4246
diff
changeset
|
564 ;;; gildea@lcs.mit.edu says it's not desirable to put kills |
79dc5c3370f8
(x-select-text): Never set the CLIPBOARD selection.
Richard M. Stallman <rms@gnu.org>
parents:
4246
diff
changeset
|
565 ;;; in the clipboard. |
3036
98f500ca5593
(x-select-text): New arg PUSH.
Richard M. Stallman <rms@gnu.org>
parents:
2808
diff
changeset
|
566 (defun x-select-text (text &optional push) |
4236
8e14db210975
(x-select-text): Limit size of text sent to cut buffer.
Richard M. Stallman <rms@gnu.org>
parents:
4132
diff
changeset
|
567 ;; Don't send the cut buffer too much text. |
8e14db210975
(x-select-text): Limit size of text sent to cut buffer.
Richard M. Stallman <rms@gnu.org>
parents:
4132
diff
changeset
|
568 ;; It becomes slow, and if really big it causes errors. |
8e14db210975
(x-select-text): Limit size of text sent to cut buffer.
Richard M. Stallman <rms@gnu.org>
parents:
4132
diff
changeset
|
569 (if (< (length text) x-cut-buffer-max) |
4273
79dc5c3370f8
(x-select-text): Never set the CLIPBOARD selection.
Richard M. Stallman <rms@gnu.org>
parents:
4246
diff
changeset
|
570 (x-set-cut-buffer text push) |
4246
af9d2ade78ed
(x-select-text): Always set the cut buffer,
Richard M. Stallman <rms@gnu.org>
parents:
4236
diff
changeset
|
571 (x-set-cut-buffer "" push)) |
2366
ed9b74c46fb9
* x-win.el: Update copyright to 1993.
Jim Blandy <jimb@redhat.com>
parents:
2157
diff
changeset
|
572 (x-set-selection 'PRIMARY text) |
6698
b107e54218fe
(x-select-enable-clipboard): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
6399
diff
changeset
|
573 (if x-select-enable-clipboard |
b107e54218fe
(x-select-enable-clipboard): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
6399
diff
changeset
|
574 (x-set-selection 'CLIPBOARD text)) |
727 | 575 (setq x-last-selected-text text)) |
643 | 576 |
6399
96ec63c4a347
(x-cut-buffer-or-selection-value): Check for error from x-get-selection.
Karl Heuer <kwzh@gnu.org>
parents:
6319
diff
changeset
|
577 ;;; Return the value of the current X selection. |
96ec63c4a347
(x-cut-buffer-or-selection-value): Check for error from x-get-selection.
Karl Heuer <kwzh@gnu.org>
parents:
6319
diff
changeset
|
578 ;;; Consult the selection, then the cut buffer. Treat empty strings |
96ec63c4a347
(x-cut-buffer-or-selection-value): Check for error from x-get-selection.
Karl Heuer <kwzh@gnu.org>
parents:
6319
diff
changeset
|
579 ;;; as if they were unset. |
707 | 580 (defun x-cut-buffer-or-selection-value () |
1266 | 581 (let (text) |
582 | |
6399
96ec63c4a347
(x-cut-buffer-or-selection-value): Check for error from x-get-selection.
Karl Heuer <kwzh@gnu.org>
parents:
6319
diff
changeset
|
583 ;; Don't die if x-get-selection signals an error. |
96ec63c4a347
(x-cut-buffer-or-selection-value): Check for error from x-get-selection.
Karl Heuer <kwzh@gnu.org>
parents:
6319
diff
changeset
|
584 (condition-case c |
96ec63c4a347
(x-cut-buffer-or-selection-value): Check for error from x-get-selection.
Karl Heuer <kwzh@gnu.org>
parents:
6319
diff
changeset
|
585 (setq text (x-get-selection 'PRIMARY)) |
96ec63c4a347
(x-cut-buffer-or-selection-value): Check for error from x-get-selection.
Karl Heuer <kwzh@gnu.org>
parents:
6319
diff
changeset
|
586 (error (message "%s" c))) |
4273
79dc5c3370f8
(x-select-text): Never set the CLIPBOARD selection.
Richard M. Stallman <rms@gnu.org>
parents:
4246
diff
changeset
|
587 (if (string= text "") (setq text nil)) |
6698
b107e54218fe
(x-select-enable-clipboard): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
6399
diff
changeset
|
588 |
b107e54218fe
(x-select-enable-clipboard): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
6399
diff
changeset
|
589 (if x-select-enable-clipboard |
b107e54218fe
(x-select-enable-clipboard): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
6399
diff
changeset
|
590 (condition-case c |
b107e54218fe
(x-select-enable-clipboard): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
6399
diff
changeset
|
591 (setq text (x-get-selection 'CLIPBOARD)) |
b107e54218fe
(x-select-enable-clipboard): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
6399
diff
changeset
|
592 (error (message "%s" c)))) |
b107e54218fe
(x-select-enable-clipboard): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
6399
diff
changeset
|
593 (if (string= text "") (setq text nil)) |
4306
2e51ffb537a8
(x-handle-iconic): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4280
diff
changeset
|
594 (or text (setq text (x-get-cut-buffer 0))) |
1266 | 595 (if (string= text "") (setq text nil)) |
596 | |
597 (cond | |
598 ((not text) nil) | |
599 ((eq text x-last-selected-text) nil) | |
600 ((string= text x-last-selected-text) | |
601 ;; Record the newer string, so subsequent calls can use the `eq' test. | |
602 (setq x-last-selected-text text) | |
603 nil) | |
604 (t | |
605 (setq x-last-selected-text text))))) | |
707 | 606 |
1546 | 607 |
608 ;;; Do the actual X Windows setup here; the above code just defines | |
609 ;;; functions and variables that we use now. | |
610 | |
611 (setq command-line-args (x-handle-args command-line-args)) | |
4132
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
612 |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
613 ;;; Make sure we have a valid resource name. |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
614 (or (stringp x-resource-name) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
615 (let (i) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
616 (setq x-resource-name (invocation-name)) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
617 |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
618 ;; Change any . or * characters in x-resource-name to hyphens, |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
619 ;; so as not to choke when we use it in X resource queries. |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
620 (while (setq i (string-match "[.*]" x-resource-name)) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
621 (aset x-resource-name i ?-)))) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
622 |
6319 | 623 (menu-bar-mode t) |
624 | |
1546 | 625 (x-open-connection (or x-display-name |
3081
63c51f1e885b
Pass x-command-line-resources to x-open-connection.
Richard M. Stallman <rms@gnu.org>
parents:
3070
diff
changeset
|
626 (setq x-display-name (getenv "DISPLAY"))) |
63c51f1e885b
Pass x-command-line-resources to x-open-connection.
Richard M. Stallman <rms@gnu.org>
parents:
3070
diff
changeset
|
627 x-command-line-resources) |
1546 | 628 |
2718
c91b18333f58
* x-win.el: Since we require faces.el, there's no point in setting
Jim Blandy <jimb@redhat.com>
parents:
2586
diff
changeset
|
629 (setq frame-creation-function 'x-create-frame-with-faces) |
2145
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
630 |
4306
2e51ffb537a8
(x-handle-iconic): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4280
diff
changeset
|
631 (setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100) |
2e51ffb537a8
(x-handle-iconic): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4280
diff
changeset
|
632 x-cut-buffer-max)) |
2e51ffb537a8
(x-handle-iconic): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4280
diff
changeset
|
633 |
6792
385261457584
If server is a Sun, call menu-bar-enable-clipboard.
Richard M. Stallman <rms@gnu.org>
parents:
6698
diff
changeset
|
634 ;; Sun expects the menu bar cut and paste commands to use the clipboard. |
385261457584
If server is a Sun, call menu-bar-enable-clipboard.
Richard M. Stallman <rms@gnu.org>
parents:
6698
diff
changeset
|
635 (if (string-match "X11/NeWS - Sun Microsystems Inc\\." |
385261457584
If server is a Sun, call menu-bar-enable-clipboard.
Richard M. Stallman <rms@gnu.org>
parents:
6698
diff
changeset
|
636 (x-server-vendor)) |
385261457584
If server is a Sun, call menu-bar-enable-clipboard.
Richard M. Stallman <rms@gnu.org>
parents:
6698
diff
changeset
|
637 (menu-bar-enable-clipboard)) |
385261457584
If server is a Sun, call menu-bar-enable-clipboard.
Richard M. Stallman <rms@gnu.org>
parents:
6698
diff
changeset
|
638 |
3172
2a484b449183
* x-win.el: Check for a geometry resource, and apply it to the
Jim Blandy <jimb@redhat.com>
parents:
3081
diff
changeset
|
639 ;; Apply a geometry resource to the initial frame. Put it at the end |
2a484b449183
* x-win.el: Check for a geometry resource, and apply it to the
Jim Blandy <jimb@redhat.com>
parents:
3081
diff
changeset
|
640 ;; of the alist, so that anything specified on the command line takes |
2a484b449183
* x-win.el: Check for a geometry resource, and apply it to the
Jim Blandy <jimb@redhat.com>
parents:
3081
diff
changeset
|
641 ;; precedence. |
2a484b449183
* x-win.el: Check for a geometry resource, and apply it to the
Jim Blandy <jimb@redhat.com>
parents:
3081
diff
changeset
|
642 (let ((res-geometry (x-get-resource "geometry" "Geometry"))) |
2a484b449183
* x-win.el: Check for a geometry resource, and apply it to the
Jim Blandy <jimb@redhat.com>
parents:
3081
diff
changeset
|
643 (if res-geometry |
2a484b449183
* x-win.el: Check for a geometry resource, and apply it to the
Jim Blandy <jimb@redhat.com>
parents:
3081
diff
changeset
|
644 (setq initial-frame-alist (append initial-frame-alist |
2a484b449183
* x-win.el: Check for a geometry resource, and apply it to the
Jim Blandy <jimb@redhat.com>
parents:
3081
diff
changeset
|
645 (x-parse-geometry res-geometry))))) |
2a484b449183
* x-win.el: Check for a geometry resource, and apply it to the
Jim Blandy <jimb@redhat.com>
parents:
3081
diff
changeset
|
646 |
3966
dcf86f82f2c8
* term/x-win.el: Check the reverseVideo/ReverseVideo resource,
Jim Blandy <jimb@redhat.com>
parents:
3889
diff
changeset
|
647 ;; Check the reverseVideo resource. |
4132
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
648 (let ((case-fold-search t)) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
649 (let ((rv (x-get-resource "reverseVideo" "ReverseVideo"))) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
650 (if (and rv |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
651 (string-match "^\\(true\\|yes\\|on\\)$" rv)) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
652 (setq default-frame-alist |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
653 (cons '(reverse . t) default-frame-alist))))) |
3966
dcf86f82f2c8
* term/x-win.el: Check the reverseVideo/ReverseVideo resource,
Jim Blandy <jimb@redhat.com>
parents:
3889
diff
changeset
|
654 |
3493
b37b09c0b43d
(x-selection-timeout): Set it, using x-get-resource.
Richard M. Stallman <rms@gnu.org>
parents:
3373
diff
changeset
|
655 ;; Set x-selection-timeout, measured in milliseconds. |
b37b09c0b43d
(x-selection-timeout): Set it, using x-get-resource.
Richard M. Stallman <rms@gnu.org>
parents:
3373
diff
changeset
|
656 (let ((res-selection-timeout |
b37b09c0b43d
(x-selection-timeout): Set it, using x-get-resource.
Richard M. Stallman <rms@gnu.org>
parents:
3373
diff
changeset
|
657 (x-get-resource "selectionTimeout" "SelectionTimeout"))) |
4280
fcc66d1d9289
(x-selection-timeout): Use 20000 as default.
Richard M. Stallman <rms@gnu.org>
parents:
4273
diff
changeset
|
658 (setq x-selection-timeout 20000) |
3493
b37b09c0b43d
(x-selection-timeout): Set it, using x-get-resource.
Richard M. Stallman <rms@gnu.org>
parents:
3373
diff
changeset
|
659 (if res-selection-timeout |
b37b09c0b43d
(x-selection-timeout): Set it, using x-get-resource.
Richard M. Stallman <rms@gnu.org>
parents:
3373
diff
changeset
|
660 (setq x-selection-timeout (string-to-number res-selection-timeout)))) |
b37b09c0b43d
(x-selection-timeout): Set it, using x-get-resource.
Richard M. Stallman <rms@gnu.org>
parents:
3373
diff
changeset
|
661 |
2145
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
662 (defun x-win-suspend-error () |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
663 (error "Suspending an emacs running under X makes no sense")) |
2366
ed9b74c46fb9
* x-win.el: Update copyright to 1993.
Jim Blandy <jimb@redhat.com>
parents:
2157
diff
changeset
|
664 (add-hook 'suspend-hook 'x-win-suspend-error) |
ed9b74c46fb9
* x-win.el: Update copyright to 1993.
Jim Blandy <jimb@redhat.com>
parents:
2157
diff
changeset
|
665 |
707 | 666 ;;; Arrange for the kill and yank functions to set and check the clipboard. |
667 (setq interprogram-cut-function 'x-select-text) | |
668 (setq interprogram-paste-function 'x-cut-buffer-or-selection-value) | |
273 | 669 |
383 | 670 ;;; Turn off window-splitting optimization; X is usually fast enough |
671 ;;; that this is only annoying. | |
672 (setq split-window-keep-point t) | |
2157
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
673 |
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
674 ;;; x-win.el ends here |