Mercurial > emacs
annotate lisp/term/x-win.el @ 3549:a4d9c9bc3994
(outlinify-sticky): Renamed from outlineify-sticky.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 07 Jun 1993 18:48:08 +0000 |
parents | b37b09c0b43d |
children | ff9679293922 |
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 |
3287 | 2 ;; Copyright (C) 1993 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)) |
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) |
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) | |
85 ("-name" . x-handle-switch) | |
86 ("-T" . x-handle-switch) | |
87 ("-r" . x-handle-switch) | |
88 ("-rv" . x-handle-switch) | |
89 ("-reverse" . x-handle-switch) | |
90 ("-fn" . x-handle-switch) | |
91 ("-font" . x-handle-switch) | |
92 ("-ib" . x-handle-switch) | |
93 ("-g" . x-handle-geometry) | |
94 ("-geometry" . x-handle-geometry) | |
95 ("-fg" . x-handle-switch) | |
96 ("-foreground". x-handle-switch) | |
97 ("-bg" . x-handle-switch) | |
98 ("-background". x-handle-switch) | |
99 ("-ms" . x-handle-switch) | |
1547
2754d53edf5d
(command-switch-alist, x-switch-definitions):
Richard M. Stallman <rms@gnu.org>
parents:
1546
diff
changeset
|
100 ("-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
|
101 ("-i" . x-handle-switch) |
273 | 102 ("-iconic" . x-handle-switch) |
3081
63c51f1e885b
Pass x-command-line-resources to x-open-connection.
Richard M. Stallman <rms@gnu.org>
parents:
3070
diff
changeset
|
103 ("-rn" . x-handle-rn-switch) |
273 | 104 ("-cr" . x-handle-switch) |
105 ("-vb" . x-handle-switch) | |
106 ("-hb" . x-handle-switch) | |
107 ("-bd" . x-handle-switch)) | |
54 | 108 command-switch-alist)) |
109 | |
110 (defconst x-switch-definitions | |
111 '(("-name" name) | |
112 ("-T" name) | |
3068
32c1cb0149b3
* x-win.el (x-select-text): New arg PUSH.
Jim Blandy <jimb@redhat.com>
parents:
3036
diff
changeset
|
113 ("-r" reverse t) |
32c1cb0149b3
* x-win.el (x-select-text): New arg PUSH.
Jim Blandy <jimb@redhat.com>
parents:
3036
diff
changeset
|
114 ("-rv" reverse t) |
32c1cb0149b3
* x-win.el (x-select-text): New arg PUSH.
Jim Blandy <jimb@redhat.com>
parents:
3036
diff
changeset
|
115 ("-reverse" reverse t) |
54 | 116 ("-fn" font) |
117 ("-font" font) | |
118 ("-ib" internal-border-width) | |
119 ("-fg" foreground-color) | |
120 ("-foreground" foreground-color) | |
121 ("-bg" background-color) | |
122 ("-background" background-color) | |
123 ("-ms" mouse-color) | |
124 ("-cr" cursor-color) | |
1547
2754d53edf5d
(command-switch-alist, x-switch-definitions):
Richard M. Stallman <rms@gnu.org>
parents:
1546
diff
changeset
|
125 ("-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
|
126 ("-i" icon-type t) |
54 | 127 ("-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
|
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 | |
147 ;; Handler for switches of the form "-switch n" | |
148 (defun x-handle-numeric-switch (switch) | |
149 (let ((aelt (assoc switch x-switch-definitions))) | |
150 (if aelt | |
779 | 151 (setq default-frame-alist |
54 | 152 (cons (cons (nth 1 aelt) |
153 (string-to-int (car x-invocation-args))) | |
779 | 154 default-frame-alist) |
54 | 155 x-invocation-args |
156 (cdr x-invocation-args))))) | |
157 | |
3081
63c51f1e885b
Pass x-command-line-resources to x-open-connection.
Richard M. Stallman <rms@gnu.org>
parents:
3070
diff
changeset
|
158 ;; Handle the -rn option. |
63c51f1e885b
Pass x-command-line-resources to x-open-connection.
Richard M. Stallman <rms@gnu.org>
parents:
3070
diff
changeset
|
159 (defun x-handle-rn-switch (switch) |
63c51f1e885b
Pass x-command-line-resources to x-open-connection.
Richard M. Stallman <rms@gnu.org>
parents:
3070
diff
changeset
|
160 (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
|
161 (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
|
162 |
54 | 163 ;; Handle the geometry option |
164 (defun x-handle-geometry (switch) | |
2367
df7de9403e02
* x-win.el (x-defined-colors): Use x-color-defined-p instead of
Jim Blandy <jimb@redhat.com>
parents:
2366
diff
changeset
|
165 (setq initial-frame-alist |
df7de9403e02
* x-win.el (x-defined-colors): Use x-color-defined-p instead of
Jim Blandy <jimb@redhat.com>
parents:
2366
diff
changeset
|
166 (append initial-frame-alist |
df7de9403e02
* x-win.el (x-defined-colors): Use x-color-defined-p instead of
Jim Blandy <jimb@redhat.com>
parents:
2366
diff
changeset
|
167 (x-parse-geometry (car x-invocation-args))) |
54 | 168 x-invocation-args (cdr x-invocation-args))) |
169 | |
170 (defvar x-display-name nil | |
779 | 171 "The X display name specifying server and X frame.") |
54 | 172 |
173 (defun x-handle-display (switch) | |
174 (setq x-display-name (car x-invocation-args) | |
175 x-invocation-args (cdr x-invocation-args))) | |
176 | |
177 (defvar x-invocation-args nil) | |
178 | |
321 | 179 (defun x-handle-args (args) |
180 "Here the X-related command line options in ARGS are processed, | |
181 before the user's startup file is loaded. They are copied to | |
182 x-invocation args from which the X-related things are extracted, first | |
183 the switch (e.g., \"-fg\") in the following code, and possible values | |
184 (e.g., \"black\") in the option handler code (e.g., x-handle-switch). | |
185 This returns ARGS with the arguments that have been processed removed." | |
273 | 186 (setq x-invocation-args args |
187 args nil) | |
188 (while x-invocation-args | |
189 (let* ((this-switch (car x-invocation-args)) | |
190 (aelt (assoc this-switch command-switch-alist))) | |
191 (setq x-invocation-args (cdr x-invocation-args)) | |
192 (if aelt | |
193 (funcall (cdr aelt) this-switch) | |
194 (setq args (cons this-switch args))))) | |
195 (setq args (nreverse args))) | |
196 | |
279 | 197 |
54 | 198 |
199 ;; | |
200 ;; Standard X cursor shapes, courtesy of Mr. Fox, who wanted ALL of them. | |
201 ;; | |
202 | |
203 (defconst x-pointer-X-cursor 0) | |
204 (defconst x-pointer-arrow 2) | |
205 (defconst x-pointer-based-arrow-down 4) | |
206 (defconst x-pointer-based-arrow-up 6) | |
207 (defconst x-pointer-boat 8) | |
208 (defconst x-pointer-bogosity 10) | |
209 (defconst x-pointer-bottom-left-corner 12) | |
210 (defconst x-pointer-bottom-right-corner 14) | |
211 (defconst x-pointer-bottom-side 16) | |
212 (defconst x-pointer-bottom-tee 18) | |
213 (defconst x-pointer-box-spiral 20) | |
214 (defconst x-pointer-center-ptr 22) | |
215 (defconst x-pointer-circle 24) | |
216 (defconst x-pointer-clock 26) | |
217 (defconst x-pointer-coffee-mug 28) | |
218 (defconst x-pointer-cross 30) | |
219 (defconst x-pointer-cross-reverse 32) | |
220 (defconst x-pointer-crosshair 34) | |
221 (defconst x-pointer-diamond-cross 36) | |
222 (defconst x-pointer-dot 38) | |
223 (defconst x-pointer-dotbox 40) | |
224 (defconst x-pointer-double-arrow 42) | |
225 (defconst x-pointer-draft-large 44) | |
226 (defconst x-pointer-draft-small 46) | |
227 (defconst x-pointer-draped-box 48) | |
228 (defconst x-pointer-exchange 50) | |
229 (defconst x-pointer-fleur 52) | |
230 (defconst x-pointer-gobbler 54) | |
231 (defconst x-pointer-gumby 56) | |
232 (defconst x-pointer-hand1 58) | |
233 (defconst x-pointer-hand2 60) | |
234 (defconst x-pointer-heart 62) | |
235 (defconst x-pointer-icon 64) | |
236 (defconst x-pointer-iron-cross 66) | |
237 (defconst x-pointer-left-ptr 68) | |
238 (defconst x-pointer-left-side 70) | |
239 (defconst x-pointer-left-tee 72) | |
240 (defconst x-pointer-leftbutton 74) | |
241 (defconst x-pointer-ll-angle 76) | |
242 (defconst x-pointer-lr-angle 78) | |
243 (defconst x-pointer-man 80) | |
244 (defconst x-pointer-middlebutton 82) | |
245 (defconst x-pointer-mouse 84) | |
246 (defconst x-pointer-pencil 86) | |
247 (defconst x-pointer-pirate 88) | |
248 (defconst x-pointer-plus 90) | |
249 (defconst x-pointer-question-arrow 92) | |
250 (defconst x-pointer-right-ptr 94) | |
251 (defconst x-pointer-right-side 96) | |
252 (defconst x-pointer-right-tee 98) | |
253 (defconst x-pointer-rightbutton 100) | |
254 (defconst x-pointer-rtl-logo 102) | |
255 (defconst x-pointer-sailboat 104) | |
256 (defconst x-pointer-sb-down-arrow 106) | |
257 (defconst x-pointer-sb-h-double-arrow 108) | |
258 (defconst x-pointer-sb-left-arrow 110) | |
259 (defconst x-pointer-sb-right-arrow 112) | |
260 (defconst x-pointer-sb-up-arrow 114) | |
261 (defconst x-pointer-sb-v-double-arrow 116) | |
262 (defconst x-pointer-shuttle 118) | |
263 (defconst x-pointer-sizing 120) | |
264 (defconst x-pointer-spider 122) | |
265 (defconst x-pointer-spraycan 124) | |
266 (defconst x-pointer-star 126) | |
267 (defconst x-pointer-target 128) | |
268 (defconst x-pointer-tcross 130) | |
269 (defconst x-pointer-top-left-arrow 132) | |
270 (defconst x-pointer-top-left-corner 134) | |
271 (defconst x-pointer-top-right-corner 136) | |
272 (defconst x-pointer-top-side 138) | |
273 (defconst x-pointer-top-tee 140) | |
274 (defconst x-pointer-trek 142) | |
275 (defconst x-pointer-ul-angle 144) | |
276 (defconst x-pointer-umbrella 146) | |
277 (defconst x-pointer-ur-angle 148) | |
278 (defconst x-pointer-watch 150) | |
279 (defconst x-pointer-xterm 152) | |
280 | |
281 ;; | |
282 ;; Available colors | |
283 ;; | |
284 | |
285 (defvar x-colors '("aquamarine" | |
286 "Aquamarine" | |
287 "medium aquamarine" | |
288 "MediumAquamarine" | |
289 "black" | |
290 "Black" | |
291 "blue" | |
292 "Blue" | |
293 "cadet blue" | |
294 "CadetBlue" | |
295 "cornflower blue" | |
296 "CornflowerBlue" | |
297 "dark slate blue" | |
298 "DarkSlateBlue" | |
299 "light blue" | |
300 "LightBlue" | |
301 "light steel blue" | |
302 "LightSteelBlue" | |
303 "medium blue" | |
304 "MediumBlue" | |
305 "medium slate blue" | |
306 "MediumSlateBlue" | |
307 "midnight blue" | |
308 "MidnightBlue" | |
309 "navy blue" | |
310 "NavyBlue" | |
311 "navy" | |
312 "Navy" | |
313 "sky blue" | |
314 "SkyBlue" | |
315 "slate blue" | |
316 "SlateBlue" | |
317 "steel blue" | |
318 "SteelBlue" | |
319 "coral" | |
320 "Coral" | |
321 "cyan" | |
322 "Cyan" | |
323 "firebrick" | |
324 "Firebrick" | |
325 "brown" | |
326 "Brown" | |
327 "gold" | |
328 "Gold" | |
329 "goldenrod" | |
330 "Goldenrod" | |
331 "medium goldenrod" | |
332 "MediumGoldenrod" | |
333 "green" | |
334 "Green" | |
335 "dark green" | |
336 "DarkGreen" | |
337 "dark olive green" | |
338 "DarkOliveGreen" | |
339 "forest green" | |
340 "ForestGreen" | |
341 "lime green" | |
342 "LimeGreen" | |
343 "medium forest green" | |
344 "MediumForestGreen" | |
345 "medium sea green" | |
346 "MediumSeaGreen" | |
347 "medium spring green" | |
348 "MediumSpringGreen" | |
349 "pale green" | |
350 "PaleGreen" | |
351 "sea green" | |
352 "SeaGreen" | |
353 "spring green" | |
354 "SpringGreen" | |
355 "yellow green" | |
356 "YellowGreen" | |
357 "dark slate grey" | |
358 "DarkSlateGrey" | |
359 "dark slate gray" | |
360 "DarkSlateGray" | |
361 "dim grey" | |
362 "DimGrey" | |
363 "dim gray" | |
364 "DimGray" | |
365 "light grey" | |
366 "LightGrey" | |
367 "light gray" | |
368 "LightGray" | |
369 "gray" | |
370 "grey" | |
371 "Gray" | |
372 "Grey" | |
373 "khaki" | |
374 "Khaki" | |
375 "magenta" | |
376 "Magenta" | |
377 "maroon" | |
378 "Maroon" | |
379 "orange" | |
380 "Orange" | |
381 "orchid" | |
382 "Orchid" | |
383 "dark orchid" | |
384 "DarkOrchid" | |
385 "medium orchid" | |
386 "MediumOrchid" | |
387 "pink" | |
388 "Pink" | |
389 "plum" | |
390 "Plum" | |
391 "red" | |
392 "Red" | |
393 "indian red" | |
394 "IndianRed" | |
395 "medium violet red" | |
396 "MediumVioletRed" | |
397 "orange red" | |
398 "OrangeRed" | |
399 "violet red" | |
400 "VioletRed" | |
401 "salmon" | |
402 "Salmon" | |
403 "sienna" | |
404 "Sienna" | |
405 "tan" | |
406 "Tan" | |
407 "thistle" | |
408 "Thistle" | |
409 "turquoise" | |
410 "Turquoise" | |
411 "dark turquoise" | |
412 "DarkTurquoise" | |
413 "medium turquoise" | |
414 "MediumTurquoise" | |
415 "violet" | |
416 "Violet" | |
417 "blue violet" | |
418 "BlueViolet" | |
419 "wheat" | |
420 "Wheat" | |
421 "white" | |
422 "White" | |
423 "yellow" | |
424 "Yellow" | |
425 "green yellow" | |
426 "GreenYellow") | |
427 "The full list of X colors from the rgb.text file.") | |
428 | |
429 (defun x-defined-colors () | |
430 "Return a list of colors supported by the current X-Display." | |
431 (let ((all-colors x-colors) | |
432 (this-color nil) | |
433 (defined-colors nil)) | |
434 (while all-colors | |
435 (setq this-color (car all-colors) | |
436 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
|
437 (and (x-color-defined-p this-color) |
54 | 438 (setq defined-colors (cons this-color defined-colors)))) |
439 defined-colors)) | |
396 | 440 |
441 ;;;; Function keys | |
442 | |
2586
7fe45a326a98
(global-map): Dyke out the last two event-to-function bindings. These belong
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2563
diff
changeset
|
443 (substitute-key-definition 'suspend-emacs 'iconify-frame global-map) |
1546 | 444 |
2145
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
445 ;; Map certain keypad keys into ASCII characters |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
446 ;; that people usually expect. |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
447 (define-key function-key-map [backspace] [127]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
448 (define-key function-key-map [delete] [127]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
449 (define-key function-key-map [tab] [?\t]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
450 (define-key function-key-map [linefeed] [?\n]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
451 (define-key function-key-map [clear] [11]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
452 (define-key function-key-map [return] [13]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
453 (define-key function-key-map [escape] [?\e]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
454 (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
|
455 (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
|
456 (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
|
457 (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
|
458 (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
|
459 (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
|
460 (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
|
461 |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
462 ;; These tell read-char how to convert |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
463 ;; these special chars to ASCII. |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
464 (put 'backspace 'ascii-character 127) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
465 (put 'delete 'ascii-character 127) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
466 (put 'tab 'ascii-character ?\t) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
467 (put 'linefeed 'ascii-character ?\n) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
468 (put 'clear 'ascii-character 12) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
469 (put 'return 'ascii-character 13) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
470 (put 'escape 'ascii-character ?\e) |
54 | 471 |
1546 | 472 ;;;; Selections and cut buffers |
707 | 473 |
727 | 474 ;;; We keep track of the last text selected here, so we can check the |
475 ;;; current selection against it, and avoid passing back our own text | |
476 ;;; from x-cut-buffer-or-selection-value. | |
477 (defvar x-last-selected-text nil) | |
478 | |
707 | 479 ;;; Make TEXT, a string, the primary and clipboard X selections. |
480 ;;; If you are running xclipboard, this means you can effectively | |
481 ;;; have a window on a copy of the kill-ring. | |
482 ;;; 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
|
483 ;;; with older X applications. |
3036
98f500ca5593
(x-select-text): New arg PUSH.
Richard M. Stallman <rms@gnu.org>
parents:
2808
diff
changeset
|
484 (defun x-select-text (text &optional push) |
98f500ca5593
(x-select-text): New arg PUSH.
Richard M. Stallman <rms@gnu.org>
parents:
2808
diff
changeset
|
485 (x-set-cut-buffer text push) |
2366
ed9b74c46fb9
* x-win.el: Update copyright to 1993.
Jim Blandy <jimb@redhat.com>
parents:
2157
diff
changeset
|
486 (x-set-selection 'CLIPBOARD text) |
ed9b74c46fb9
* x-win.el: Update copyright to 1993.
Jim Blandy <jimb@redhat.com>
parents:
2157
diff
changeset
|
487 (x-set-selection 'PRIMARY text) |
727 | 488 (setq x-last-selected-text text)) |
643 | 489 |
707 | 490 ;;; Return the value of the current X selection. For compatibility |
491 ;;; with older X applications, this checks cut buffer 0 before | |
492 ;;; retrieving the value of the primary selection. | |
493 (defun x-cut-buffer-or-selection-value () | |
1266 | 494 (let (text) |
495 | |
496 ;; Consult the cut buffer, then the selection. Treat empty strings | |
497 ;; as if they were unset. | |
498 (setq text (x-get-cut-buffer 0)) | |
499 (if (string= text "") (setq text nil)) | |
2366
ed9b74c46fb9
* x-win.el: Update copyright to 1993.
Jim Blandy <jimb@redhat.com>
parents:
2157
diff
changeset
|
500 (or text (setq text (x-get-selection 'PRIMARY))) |
1266 | 501 (if (string= text "") (setq text nil)) |
502 | |
503 (cond | |
504 ((not text) nil) | |
505 ((eq text x-last-selected-text) nil) | |
506 ((string= text x-last-selected-text) | |
507 ;; Record the newer string, so subsequent calls can use the `eq' test. | |
508 (setq x-last-selected-text text) | |
509 nil) | |
510 (t | |
511 (setq x-last-selected-text text))))) | |
707 | 512 |
1546 | 513 |
514 ;;; Do the actual X Windows setup here; the above code just defines | |
515 ;;; functions and variables that we use now. | |
516 | |
517 (setq command-line-args (x-handle-args command-line-args)) | |
518 (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
|
519 (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
|
520 x-command-line-resources) |
1546 | 521 |
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
|
522 (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
|
523 |
3172
2a484b449183
* x-win.el: Check for a geometry resource, and apply it to the
Jim Blandy <jimb@redhat.com>
parents:
3081
diff
changeset
|
524 ;; 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
|
525 ;; 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
|
526 ;; precedence. |
2a484b449183
* x-win.el: Check for a geometry resource, and apply it to the
Jim Blandy <jimb@redhat.com>
parents:
3081
diff
changeset
|
527 (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
|
528 (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
|
529 (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
|
530 (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
|
531 |
3493
b37b09c0b43d
(x-selection-timeout): Set it, using x-get-resource.
Richard M. Stallman <rms@gnu.org>
parents:
3373
diff
changeset
|
532 ;; 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
|
533 (let ((res-selection-timeout |
b37b09c0b43d
(x-selection-timeout): Set it, using x-get-resource.
Richard M. Stallman <rms@gnu.org>
parents:
3373
diff
changeset
|
534 (x-get-resource "selectionTimeout" "SelectionTimeout"))) |
b37b09c0b43d
(x-selection-timeout): Set it, using x-get-resource.
Richard M. Stallman <rms@gnu.org>
parents:
3373
diff
changeset
|
535 (setq x-selection-timeout 5000) |
b37b09c0b43d
(x-selection-timeout): Set it, using x-get-resource.
Richard M. Stallman <rms@gnu.org>
parents:
3373
diff
changeset
|
536 (if res-selection-timeout |
b37b09c0b43d
(x-selection-timeout): Set it, using x-get-resource.
Richard M. Stallman <rms@gnu.org>
parents:
3373
diff
changeset
|
537 (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
|
538 |
2145
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
539 (defun x-win-suspend-error () |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
540 (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
|
541 (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
|
542 |
707 | 543 ;;; Arrange for the kill and yank functions to set and check the clipboard. |
544 (setq interprogram-cut-function 'x-select-text) | |
545 (setq interprogram-paste-function 'x-cut-buffer-or-selection-value) | |
273 | 546 |
383 | 547 ;;; Turn off window-splitting optimization; X is usually fast enough |
548 ;;; that this is only annoying. | |
549 (setq split-window-keep-point t) | |
2157
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
550 |
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
551 ;;; x-win.el ends here |