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