Mercurial > emacs
annotate lisp/term/x-win.el @ 2294:9bce20507666
Use the `visiblity' parameter to determine the initial state of
the frame, instead of the `iconic-startup' and
`suppress-initial-map'.
* xfns.c (x_icon): Test the Qvisibility parameter against Qicon,
instead of the Qiconic_startup against Qt.
(x_create_frame): Test Qvisibility against Qnil and
Qicon, instead of testing Qsuppress_initial_map and Qvisibility.
(Qicon): New symbol.
(Qiconic_startup, Qsuppress_icon, Qsuppress_initial_map): Removed.
(syms_of_xfns): Adjusted appropriately.
* xfns.c [not HAVE_X11] (x_create_frame): Check Qicon_type,
instead of Qsuppress_icon.
* xfns.c (x_set_visibility): Instead of interpreting only Qt as
`make the frame visible' and everything else as `iconify the
frame', interpret Qicon as `iconify the frame' and everything else
as `make the frame visible.'
* xfns.c (x_get_arg): When the type of the resource is `symbol',
return `true' and `on' as Qt, and `false' and `off' as Qnil.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Sun, 21 Mar 1993 05:11:23 +0000 |
parents | 0d77768bf3f2 |
children | ed9b74c46fb9 |
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 |
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
2 |
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
3 ;; Author: FSF |
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
4 ;; Keywords: terminals |
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
5 |
54 | 6 ;; Copyright (C) 1990 Free Software Foundation, Inc. |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is distributed in the hope that it will be useful, | |
11 ;; but WITHOUT ANY WARRANTY. No author or distributor | |
12 ;; accepts responsibility to anyone for the consequences of using it | |
13 ;; or for whether it serves any particular purpose or works at all, | |
14 ;; unless he says so in writing. Refer to the GNU Emacs General Public | |
15 ;; License for full details. | |
16 | |
17 ;; Everyone is granted permission to copy, modify and redistribute | |
18 ;; GNU Emacs, but only under the conditions described in the | |
19 ;; GNU Emacs General Public License. A copy of this license is | |
20 ;; supposed to have been given to you along with GNU Emacs so you | |
21 ;; can know your rights and responsibilities. It should be in a | |
22 ;; file named COPYING. Among other things, the copyright notice | |
23 ;; and this notice must be preserved on all copies. | |
24 | |
2157
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
25 ;;; Commentary: |
54 | 26 |
27 ;; X-win.el: this file is loaded from ../lisp/startup.el when it recognizes | |
28 ;; that X windows are to be used. Command line switches are parsed and those | |
29 ;; pertaining to X are processed and removed from the command line. The | |
30 ;; X display is opened and hooks are set for popping up the initial window. | |
31 | |
32 ;; startup.el will then examine startup files, and eventually call the hooks | |
33 ;; which create the first window (s). | |
2157
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
34 |
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
35 ;;; Code: |
54 | 36 |
37 ;; These are the standard X switches from the Xt Initialize.c file of | |
38 ;; Release 4. | |
39 | |
40 ;; Command line Resource Manager string | |
41 | |
42 ;; +rv *reverseVideo | |
43 ;; +synchronous *synchronous | |
44 ;; -background *background | |
45 ;; -bd *borderColor | |
46 ;; -bg *background | |
47 ;; -bordercolor *borderColor | |
48 ;; -borderwidth .borderWidth | |
49 ;; -bw .borderWidth | |
50 ;; -display .display | |
51 ;; -fg *foreground | |
52 ;; -fn *font | |
53 ;; -font *font | |
54 ;; -foreground *foreground | |
55 ;; -geometry .geometry | |
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)) |
68 (error "Loading x-win.el but not compiled for X")) | |
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) |
273 | 73 |
54 | 74 (setq command-switch-alist |
380 | 75 (append '(("-bw" . x-handle-numeric-switch) |
273 | 76 ("-d" . x-handle-display) |
77 ("-display" . x-handle-display) | |
78 ("-name" . x-handle-switch) | |
79 ("-T" . x-handle-switch) | |
80 ("-r" . x-handle-switch) | |
81 ("-rv" . x-handle-switch) | |
82 ("-reverse" . x-handle-switch) | |
83 ("-fn" . x-handle-switch) | |
84 ("-font" . x-handle-switch) | |
85 ("-ib" . x-handle-switch) | |
86 ("-g" . x-handle-geometry) | |
87 ("-geometry" . x-handle-geometry) | |
88 ("-fg" . x-handle-switch) | |
89 ("-foreground". x-handle-switch) | |
90 ("-bg" . x-handle-switch) | |
91 ("-background". x-handle-switch) | |
92 ("-ms" . x-handle-switch) | |
1547
2754d53edf5d
(command-switch-alist, x-switch-definitions):
Richard M. Stallman <rms@gnu.org>
parents:
1546
diff
changeset
|
93 ("-itype" . x-handle-switch) |
273 | 94 ("-iconic" . x-handle-switch) |
95 ("-cr" . x-handle-switch) | |
96 ("-vb" . x-handle-switch) | |
97 ("-hb" . x-handle-switch) | |
98 ("-bd" . x-handle-switch)) | |
54 | 99 command-switch-alist)) |
100 | |
101 (defconst x-switch-definitions | |
102 '(("-name" name) | |
103 ("-T" name) | |
104 ("-r" lose) | |
105 ("-rv" lose) | |
106 ("-reverse" lose) | |
107 ("-fn" font) | |
108 ("-font" font) | |
109 ("-ib" internal-border-width) | |
110 ("-fg" foreground-color) | |
111 ("-foreground" foreground-color) | |
112 ("-bg" background-color) | |
113 ("-background" background-color) | |
114 ("-ms" mouse-color) | |
115 ("-cr" cursor-color) | |
1547
2754d53edf5d
(command-switch-alist, x-switch-definitions):
Richard M. Stallman <rms@gnu.org>
parents:
1546
diff
changeset
|
116 ("-itype" icon-type t) |
54 | 117 ("-iconic" iconic-startup t) |
1984
e0c7208bdafa
* term/x-win.el (x-switch-definitons): Use the proper names for
Jim Blandy <jimb@redhat.com>
parents:
1972
diff
changeset
|
118 ("-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
|
119 ("-hb" horizontal-scroll-bars t) |
54 | 120 ("-bd" border-color) |
121 ("-bw" border-width))) | |
122 | |
123 ;; Handler for switches of the form "-switch value" or "-switch". | |
124 (defun x-handle-switch (switch) | |
125 (let ((aelt (assoc switch x-switch-definitions))) | |
126 (if aelt | |
127 (if (nth 2 aelt) | |
779 | 128 (setq default-frame-alist |
54 | 129 (cons (cons (nth 1 aelt) (nth 2 aelt)) |
779 | 130 default-frame-alist)) |
131 (setq default-frame-alist | |
54 | 132 (cons (cons (nth 1 aelt) |
133 (car x-invocation-args)) | |
779 | 134 default-frame-alist) |
54 | 135 x-invocation-args (cdr x-invocation-args)))))) |
136 | |
137 ;; Handler for switches of the form "-switch n" | |
138 (defun x-handle-numeric-switch (switch) | |
139 (let ((aelt (assoc switch x-switch-definitions))) | |
140 (if aelt | |
779 | 141 (setq default-frame-alist |
54 | 142 (cons (cons (nth 1 aelt) |
143 (string-to-int (car x-invocation-args))) | |
779 | 144 default-frame-alist) |
54 | 145 x-invocation-args |
146 (cdr x-invocation-args))))) | |
147 | |
148 ;; Handle the geometry option | |
149 (defun x-handle-geometry (switch) | |
779 | 150 (setq initial-frame-alist (append initial-frame-alist |
54 | 151 (x-geometry (car x-invocation-args))) |
152 x-invocation-args (cdr x-invocation-args))) | |
153 | |
154 (defvar x-display-name nil | |
779 | 155 "The X display name specifying server and X frame.") |
54 | 156 |
157 (defun x-handle-display (switch) | |
158 (setq x-display-name (car x-invocation-args) | |
159 x-invocation-args (cdr x-invocation-args))) | |
160 | |
161 (defvar x-invocation-args nil) | |
162 | |
321 | 163 (defun x-handle-args (args) |
164 "Here the X-related command line options in ARGS are processed, | |
165 before the user's startup file is loaded. They are copied to | |
166 x-invocation args from which the X-related things are extracted, first | |
167 the switch (e.g., \"-fg\") in the following code, and possible values | |
168 (e.g., \"black\") in the option handler code (e.g., x-handle-switch). | |
169 This returns ARGS with the arguments that have been processed removed." | |
273 | 170 (setq x-invocation-args args |
171 args nil) | |
172 (while x-invocation-args | |
173 (let* ((this-switch (car x-invocation-args)) | |
174 (aelt (assoc this-switch command-switch-alist))) | |
175 (setq x-invocation-args (cdr x-invocation-args)) | |
176 (if aelt | |
177 (funcall (cdr aelt) this-switch) | |
178 (setq args (cons this-switch args))))) | |
179 (setq args (nreverse args))) | |
180 | |
279 | 181 |
54 | 182 |
183 ;; | |
184 ;; Standard X cursor shapes, courtesy of Mr. Fox, who wanted ALL of them. | |
185 ;; | |
186 | |
187 (defconst x-pointer-X-cursor 0) | |
188 (defconst x-pointer-arrow 2) | |
189 (defconst x-pointer-based-arrow-down 4) | |
190 (defconst x-pointer-based-arrow-up 6) | |
191 (defconst x-pointer-boat 8) | |
192 (defconst x-pointer-bogosity 10) | |
193 (defconst x-pointer-bottom-left-corner 12) | |
194 (defconst x-pointer-bottom-right-corner 14) | |
195 (defconst x-pointer-bottom-side 16) | |
196 (defconst x-pointer-bottom-tee 18) | |
197 (defconst x-pointer-box-spiral 20) | |
198 (defconst x-pointer-center-ptr 22) | |
199 (defconst x-pointer-circle 24) | |
200 (defconst x-pointer-clock 26) | |
201 (defconst x-pointer-coffee-mug 28) | |
202 (defconst x-pointer-cross 30) | |
203 (defconst x-pointer-cross-reverse 32) | |
204 (defconst x-pointer-crosshair 34) | |
205 (defconst x-pointer-diamond-cross 36) | |
206 (defconst x-pointer-dot 38) | |
207 (defconst x-pointer-dotbox 40) | |
208 (defconst x-pointer-double-arrow 42) | |
209 (defconst x-pointer-draft-large 44) | |
210 (defconst x-pointer-draft-small 46) | |
211 (defconst x-pointer-draped-box 48) | |
212 (defconst x-pointer-exchange 50) | |
213 (defconst x-pointer-fleur 52) | |
214 (defconst x-pointer-gobbler 54) | |
215 (defconst x-pointer-gumby 56) | |
216 (defconst x-pointer-hand1 58) | |
217 (defconst x-pointer-hand2 60) | |
218 (defconst x-pointer-heart 62) | |
219 (defconst x-pointer-icon 64) | |
220 (defconst x-pointer-iron-cross 66) | |
221 (defconst x-pointer-left-ptr 68) | |
222 (defconst x-pointer-left-side 70) | |
223 (defconst x-pointer-left-tee 72) | |
224 (defconst x-pointer-leftbutton 74) | |
225 (defconst x-pointer-ll-angle 76) | |
226 (defconst x-pointer-lr-angle 78) | |
227 (defconst x-pointer-man 80) | |
228 (defconst x-pointer-middlebutton 82) | |
229 (defconst x-pointer-mouse 84) | |
230 (defconst x-pointer-pencil 86) | |
231 (defconst x-pointer-pirate 88) | |
232 (defconst x-pointer-plus 90) | |
233 (defconst x-pointer-question-arrow 92) | |
234 (defconst x-pointer-right-ptr 94) | |
235 (defconst x-pointer-right-side 96) | |
236 (defconst x-pointer-right-tee 98) | |
237 (defconst x-pointer-rightbutton 100) | |
238 (defconst x-pointer-rtl-logo 102) | |
239 (defconst x-pointer-sailboat 104) | |
240 (defconst x-pointer-sb-down-arrow 106) | |
241 (defconst x-pointer-sb-h-double-arrow 108) | |
242 (defconst x-pointer-sb-left-arrow 110) | |
243 (defconst x-pointer-sb-right-arrow 112) | |
244 (defconst x-pointer-sb-up-arrow 114) | |
245 (defconst x-pointer-sb-v-double-arrow 116) | |
246 (defconst x-pointer-shuttle 118) | |
247 (defconst x-pointer-sizing 120) | |
248 (defconst x-pointer-spider 122) | |
249 (defconst x-pointer-spraycan 124) | |
250 (defconst x-pointer-star 126) | |
251 (defconst x-pointer-target 128) | |
252 (defconst x-pointer-tcross 130) | |
253 (defconst x-pointer-top-left-arrow 132) | |
254 (defconst x-pointer-top-left-corner 134) | |
255 (defconst x-pointer-top-right-corner 136) | |
256 (defconst x-pointer-top-side 138) | |
257 (defconst x-pointer-top-tee 140) | |
258 (defconst x-pointer-trek 142) | |
259 (defconst x-pointer-ul-angle 144) | |
260 (defconst x-pointer-umbrella 146) | |
261 (defconst x-pointer-ur-angle 148) | |
262 (defconst x-pointer-watch 150) | |
263 (defconst x-pointer-xterm 152) | |
264 | |
265 ;; | |
266 ;; Available colors | |
267 ;; | |
268 | |
269 (defvar x-colors '("aquamarine" | |
270 "Aquamarine" | |
271 "medium aquamarine" | |
272 "MediumAquamarine" | |
273 "black" | |
274 "Black" | |
275 "blue" | |
276 "Blue" | |
277 "cadet blue" | |
278 "CadetBlue" | |
279 "cornflower blue" | |
280 "CornflowerBlue" | |
281 "dark slate blue" | |
282 "DarkSlateBlue" | |
283 "light blue" | |
284 "LightBlue" | |
285 "light steel blue" | |
286 "LightSteelBlue" | |
287 "medium blue" | |
288 "MediumBlue" | |
289 "medium slate blue" | |
290 "MediumSlateBlue" | |
291 "midnight blue" | |
292 "MidnightBlue" | |
293 "navy blue" | |
294 "NavyBlue" | |
295 "navy" | |
296 "Navy" | |
297 "sky blue" | |
298 "SkyBlue" | |
299 "slate blue" | |
300 "SlateBlue" | |
301 "steel blue" | |
302 "SteelBlue" | |
303 "coral" | |
304 "Coral" | |
305 "cyan" | |
306 "Cyan" | |
307 "firebrick" | |
308 "Firebrick" | |
309 "brown" | |
310 "Brown" | |
311 "gold" | |
312 "Gold" | |
313 "goldenrod" | |
314 "Goldenrod" | |
315 "medium goldenrod" | |
316 "MediumGoldenrod" | |
317 "green" | |
318 "Green" | |
319 "dark green" | |
320 "DarkGreen" | |
321 "dark olive green" | |
322 "DarkOliveGreen" | |
323 "forest green" | |
324 "ForestGreen" | |
325 "lime green" | |
326 "LimeGreen" | |
327 "medium forest green" | |
328 "MediumForestGreen" | |
329 "medium sea green" | |
330 "MediumSeaGreen" | |
331 "medium spring green" | |
332 "MediumSpringGreen" | |
333 "pale green" | |
334 "PaleGreen" | |
335 "sea green" | |
336 "SeaGreen" | |
337 "spring green" | |
338 "SpringGreen" | |
339 "yellow green" | |
340 "YellowGreen" | |
341 "dark slate grey" | |
342 "DarkSlateGrey" | |
343 "dark slate gray" | |
344 "DarkSlateGray" | |
345 "dim grey" | |
346 "DimGrey" | |
347 "dim gray" | |
348 "DimGray" | |
349 "light grey" | |
350 "LightGrey" | |
351 "light gray" | |
352 "LightGray" | |
353 "gray" | |
354 "grey" | |
355 "Gray" | |
356 "Grey" | |
357 "khaki" | |
358 "Khaki" | |
359 "magenta" | |
360 "Magenta" | |
361 "maroon" | |
362 "Maroon" | |
363 "orange" | |
364 "Orange" | |
365 "orchid" | |
366 "Orchid" | |
367 "dark orchid" | |
368 "DarkOrchid" | |
369 "medium orchid" | |
370 "MediumOrchid" | |
371 "pink" | |
372 "Pink" | |
373 "plum" | |
374 "Plum" | |
375 "red" | |
376 "Red" | |
377 "indian red" | |
378 "IndianRed" | |
379 "medium violet red" | |
380 "MediumVioletRed" | |
381 "orange red" | |
382 "OrangeRed" | |
383 "violet red" | |
384 "VioletRed" | |
385 "salmon" | |
386 "Salmon" | |
387 "sienna" | |
388 "Sienna" | |
389 "tan" | |
390 "Tan" | |
391 "thistle" | |
392 "Thistle" | |
393 "turquoise" | |
394 "Turquoise" | |
395 "dark turquoise" | |
396 "DarkTurquoise" | |
397 "medium turquoise" | |
398 "MediumTurquoise" | |
399 "violet" | |
400 "Violet" | |
401 "blue violet" | |
402 "BlueViolet" | |
403 "wheat" | |
404 "Wheat" | |
405 "white" | |
406 "White" | |
407 "yellow" | |
408 "Yellow" | |
409 "green yellow" | |
410 "GreenYellow") | |
411 "The full list of X colors from the rgb.text file.") | |
412 | |
413 (defun x-defined-colors () | |
414 "Return a list of colors supported by the current X-Display." | |
415 (let ((all-colors x-colors) | |
416 (this-color nil) | |
417 (defined-colors nil)) | |
418 (while all-colors | |
419 (setq this-color (car all-colors) | |
420 all-colors (cdr all-colors)) | |
421 (and (x-defined-color this-color) | |
422 (setq defined-colors (cons this-color defined-colors)))) | |
423 defined-colors)) | |
396 | 424 |
425 ;;;; Function keys | |
426 | |
2145
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
427 ;;; Give some common function keys reasonable definitions. |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
428 (define-key global-map [home] 'beginning-of-line) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
429 (define-key global-map [left] 'backward-char) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
430 (define-key global-map [up] 'previous-line) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
431 (define-key global-map [right] 'forward-char) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
432 (define-key global-map [down] 'next-line) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
433 (define-key global-map [prior] 'scroll-down) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
434 (define-key global-map [next] 'scroll-up) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
435 (define-key global-map [M-next] 'scroll-other-window) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
436 (define-key global-map [begin] 'beginning-of-buffer) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
437 (define-key global-map [end] 'end-of-buffer) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
438 |
872 | 439 (define-key global-map "\C-z" 'iconify-frame) |
1546 | 440 |
2145
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
441 ;; Map certain keypad keys into ASCII characters |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
442 ;; that people usually expect. |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
443 (define-key function-key-map [backspace] [127]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
444 (define-key function-key-map [delete] [127]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
445 (define-key function-key-map [tab] [?\t]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
446 (define-key function-key-map [linefeed] [?\n]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
447 (define-key function-key-map [clear] [11]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
448 (define-key function-key-map [return] [13]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
449 (define-key function-key-map [escape] [?\e]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
450 (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
|
451 (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
|
452 (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
|
453 (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
|
454 (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
|
455 (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
|
456 (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
|
457 |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
458 ;; These tell read-char how to convert |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
459 ;; these special chars to ASCII. |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
460 (put 'backspace 'ascii-character 127) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
461 (put 'delete 'ascii-character 127) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
462 (put 'tab 'ascii-character ?\t) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
463 (put 'linefeed 'ascii-character ?\n) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
464 (put 'clear 'ascii-character 12) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
465 (put 'return 'ascii-character 13) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
466 (put 'escape 'ascii-character ?\e) |
54 | 467 |
1546 | 468 ;;;; Selections and cut buffers |
707 | 469 |
727 | 470 ;;; We keep track of the last text selected here, so we can check the |
471 ;;; current selection against it, and avoid passing back our own text | |
472 ;;; from x-cut-buffer-or-selection-value. | |
473 (defvar x-last-selected-text nil) | |
474 | |
707 | 475 ;;; Make TEXT, a string, the primary and clipboard X selections. |
476 ;;; If you are running xclipboard, this means you can effectively | |
477 ;;; have a window on a copy of the kill-ring. | |
478 ;;; 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
|
479 ;;; with older X applications. |
707 | 480 (defun x-select-text (text) |
1265 | 481 (x-set-cut-buffer 0 text) |
1817
5c2bdeb13f68
x-selection-value has been renamed to x-selection.
Jim Blandy <jimb@redhat.com>
parents:
1772
diff
changeset
|
482 (x-set-selection 'clipboard text) |
5c2bdeb13f68
x-selection-value has been renamed to x-selection.
Jim Blandy <jimb@redhat.com>
parents:
1772
diff
changeset
|
483 (x-set-selection 'primary text) |
727 | 484 (setq x-last-selected-text text)) |
643 | 485 |
707 | 486 ;;; Return the value of the current X selection. For compatibility |
487 ;;; with older X applications, this checks cut buffer 0 before | |
488 ;;; retrieving the value of the primary selection. | |
489 (defun x-cut-buffer-or-selection-value () | |
1266 | 490 (let (text) |
491 | |
492 ;; Consult the cut buffer, then the selection. Treat empty strings | |
493 ;; as if they were unset. | |
494 (setq text (x-get-cut-buffer 0)) | |
495 (if (string= text "") (setq text nil)) | |
1817
5c2bdeb13f68
x-selection-value has been renamed to x-selection.
Jim Blandy <jimb@redhat.com>
parents:
1772
diff
changeset
|
496 (or text (setq text (x-selection 'primary))) |
1266 | 497 (if (string= text "") (setq text nil)) |
498 | |
499 (cond | |
500 ((not text) nil) | |
501 ((eq text x-last-selected-text) nil) | |
502 ((string= text x-last-selected-text) | |
503 ;; Record the newer string, so subsequent calls can use the `eq' test. | |
504 (setq x-last-selected-text text) | |
505 nil) | |
506 (t | |
507 (setq x-last-selected-text text))))) | |
707 | 508 |
1546 | 509 |
510 ;;; Do the actual X Windows setup here; the above code just defines | |
511 ;;; functions and variables that we use now. | |
512 | |
513 (setq command-line-args (x-handle-args command-line-args)) | |
514 (x-open-connection (or x-display-name | |
515 (setq x-display-name (getenv "DISPLAY")))) | |
516 | |
517 (setq frame-creation-function 'x-create-frame) | |
2145
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
518 |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
519 (defun x-win-suspend-error () |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
520 (error "Suspending an emacs running under X makes no sense")) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
521 (add-hook 'suspend-hooks 'x-win-suspend-error) |
1546 | 522 |
707 | 523 ;;; Arrange for the kill and yank functions to set and check the clipboard. |
524 (setq interprogram-cut-function 'x-select-text) | |
525 (setq interprogram-paste-function 'x-cut-buffer-or-selection-value) | |
273 | 526 |
383 | 527 ;;; Turn off window-splitting optimization; X is usually fast enough |
528 ;;; that this is only annoying. | |
529 (setq split-window-keep-point t) | |
2157
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
530 |
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
531 ;;; x-win.el ends here |