annotate lisp/x11/x-win-sun.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 461c7ba8286a
children 54cc21c15cbb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; x-win-sun.el --- runtime initialization for Sun X servers and keyboards
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;; Copyright (C) 1993, 1994 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Authors: jwz@netscape.com, wing@666.com, mrb@eng.sun.com
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Keywords: terminals
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
20 ;; along with XEmacs; see the file COPYING. If not, write to the
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
22 ;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;; This file is loaded by x-win.el at run-time when we are sure that XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;; is running on the display of a Sun.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;; The Sun X server (both the MIT and OpenWindows varieties) have extremely
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; stupid names for their keypad and function keys. For example, the key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;; labeled 3 / PgDn, with R15 written on the front, is actually called F35.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;; There are 3 methods of dealing with the Sun key brokenness:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;; - Use xmodmap to give all keys more sensible names for all apps:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;; I use this shell script:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;; for i in 0 1 2 3 4 5 6 7 8 9 Add Subtract Multiply Divide Decimal ; do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;; echo "keysym KP_$i = KP_$i"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; done
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;; Clearly, as a good X11 citizen, we can't do this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;; - Use keyboard-translate-table to remap the keybindings at a low level.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;; This approach is taken in the function `sun-x11-keyboard-translate'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;; This is like running xmodmap within XEmacs only.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;; This is not the default, however, so that legacy keybindings in users'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;; .emacs files like (global-set-key [(f35)] 'foo) continue to work
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;; - Use keyboard macros to provide indirection for keybindings.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
51 ;; If we do (global-set-key [(f35)] [(kp_3)]), then the user's keybindings
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
52 ;; work whether he uses `f35' or `kp_3'.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ;; This is also compatible with FSF Emacs and other X11 apps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;; Although this has the disadvantage that these remappings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;; only work with the global key map, we use this as the default.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ;; - The Right Way to do this remains to be written...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ;; OK, here's another try at doing things the right way.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 ;; We use function-key-map, which honors explicit key-bindings for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ;; stupid Sun names, but also allows indirection if no explicit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;; key-binding exists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (defun x11-remap-keysyms-using-function-key-map (mapping)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (while mapping
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (let ((k1 (caar mapping))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (k2 (cdar mapping)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (mapc #'(lambda (prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (define-key function-key-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (append prefix (list k1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (vector (append prefix (list k2)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 '(() (shift) (control) (meta) (alt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (shift control) (shift alt) (shift meta)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (control alt) (control meta) (alt meta)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (shift control alt) (shift control meta)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (shift alt meta) (control alt meta)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (shift control alt meta))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (setq mapping (cdr mapping))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (x11-remap-keysyms-using-function-key-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 ;; help is ok
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 ;; num_lock is ok
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 ;; up is ok
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 ;; left is ok
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 ;; right is ok
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
90 ;; kp_add is ok
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 ;; down is ok
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 ;; insert is ok
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 ;; delete is ok
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
94 ;; kp_enter is ok
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (append
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 ;; Sun Function keys
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
97 (cond ((x-keysym-on-keyboard-p "F21")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
98 '((f21 . pause)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
99 (f22 . print)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
100 (f23 . scroll_lock))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
101
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (cond ((x-keysym-on-keyboard-p "SunCut") ; X11 R6 mappings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 '((SunProps . props) (Undo . undo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (SunFront . front) (SunCopy . copy)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (SunOpen . open) (SunPaste . paste)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (SunFind . find) (SunCut . cut)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (cancel . stop)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 ((x-keysym-on-keyboard-p "F20")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 '((f13 . props) (f14 . undo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (f15 . front) (f16 . copy)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (f17 . open) (f18 . paste)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (f19 . find) (f20 . cut))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (if (x-keysym-on-keyboard-p "F25") ; Sun Sparc keyboards
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (append
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 '((f21 . pause)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (f22 . prsc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (f23 . scroll)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
120 (f25 . kp_divide)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
121 (f26 . kp_multiply)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
122 (f31 . kp_5))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
123
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
124 ;; Map f33 and r13 to end or kp_end
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
125 (cond
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
126 ((not (x-keysym-on-keyboard-p "End"))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
127 '((f33 . end) (r13 . end)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
128 ((not (x-keysym-on-keyboard-p "KP_End"))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
129 '((f33 . kp_end) (r13 . kp_end))))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
130
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (if (x-keysym-on-keyboard-p "F36")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 '((f36 . stop) (f37 . again)) ; MIT Type 5 name
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
133 '((f11 . stop) (f12 . again))) ; Sun name or MIT Type 4 name
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
135 ;; Type 4 keyboards have a real kp_subtract and a f24 labelled `='
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
136 ;; Type 5 keyboards have no key labelled `=' and a f24 labelled `-'
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
137 (if (x-keysym-on-keyboard-p "F24")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
138 (if (x-keysym-on-keyboard-p "KP_Subtract")
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
139 '((f24 . kp_equal))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
140 '((f24 . kp_subtract))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
142 ;; Map f27 to home or kp_home, as appropriate
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
143 (cond ((not (x-keysym-on-keyboard-p "Home")) '((f27 . home)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
144 ((not (x-keysym-on-keyboard-p "KP_Home")) '((f27 . kp_home))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
146 ;; Map f29 to prior or kp_prior, as appropriate
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
147 (cond ((not (x-keysym-on-keyboard-p "Prior")) '((f29 . prior)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
148 ((not (x-keysym-on-keyboard-p "KP_Prior")) '((f29 . kp_prior))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
150 ;; Map f35 to next or kp_next, as appropriate
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
151 (cond ((not (x-keysym-on-keyboard-p "Next")) '((f35 . next)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
152 ((not (x-keysym-on-keyboard-p "KP_Next")) '((f35 . kp_next))))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
153 ))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (cond ((x-keysym-on-keyboard-p "apRead") ; SunOS 4.1.1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 '((apRead . f11) (apEdit . f12)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 ((x-keysym-on-keyboard-p "SunF36") ; SunOS 5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 '((SunF36 . f11) (SunF37 . f12))))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
159
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
160 ;; !@#$ SunOS 4 with SunOS5 X server
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
161 (if (string-match "sunos4.1" system-configuration)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
162 '((unknown_keysym_0xFF9A . kp_prior)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
163 (unknown_keysym_0xFF9B . kp_next)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
164 (unknown_keysym_0xFF95 . kp_home)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
165 (unknown_keysym_0xFF9C . kp_end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
166 (unknown_keysym_0xFF96 . kp_left)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
167 (unknown_keysym_0xFF97 . kp_up)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
168 (unknown_keysym_0xFF98 . kp_right)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
169 (unknown_keysym_0xFF99 . kp_down)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
170 (unknown_keysym_0xFF9E . kp_insert)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (fmakunbound 'x11-remap-keysyms-using-function-key-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 ;; for each element in the left column of the above table, alias it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 ;; to the thing in the right column. Then do the same for mamy, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 ;; not all, modifier combinations.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 ;; (Well, we omit hyper and super. #### Handle this some other way!)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 ; (while mapping
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ; (let ((mods '(() (shift) (control) (meta) (alt))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 ; (while mods
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 ; (let ((k1 (vector (append (car mods) (list (car (car mapping))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 ; (k2 (vector (append (car mods) (list (cdr (car mapping)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 ; (define-key global-map k1 k2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 ; (setq mods (cdr mods))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 ; (setq mapping (cdr mapping))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 ;;; I've extended keyboard-translate-table to work over keysyms.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 ;;; [FSF Emacs has something called `system-key-alist' that is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 ;;; supposed to accomplish approximately the same thing. Unfortunately,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 ;;; it's brain-dead in the typically FSF way, and associates *numbers*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 ;;; (who knows where the hell they come from?) with symbols.] --ben
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 ;;; And I've made it into a function which is not called by default --mrb
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (defun sun-x11-keyboard-translate ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 "Remap Sun's X11 keyboard.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 Keys with names like `f35' are remapped, at a low level,
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
201 to more mnemonic ones,like `kp_3'."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (keyboard-translate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 'f11 'stop ; the type4 keyboard Sun/MIT name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 'f36 'stop ; the type5 keyboard Sun name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 'cancel 'stop ; R6 binding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 'f12 'again ; the type4 keyboard Sun/MIT name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 'f37 'again ; the type5 keyboard Sun name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 'f13 'props ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 'SunProps 'props ; R6 binding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 'f14 'undo ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 'f15 'front ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 'SunFront 'front ; R6 binding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 'f16 'copy ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 'SunCopy 'copy ; R6 binding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 'f17 'open ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 'SunOpen 'open ; R6 binding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 'f18 'paste ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 'SunPaste 'paste ; R6 binding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 'f19 'find ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 'f20 'cut ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 'SunCut 'cut ; R6 binding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 ;; help is ok
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 'f21 'pause
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 'f22 'prsc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 'f23 'scroll
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 ;; num_lock is ok
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
229 ;;'f24 'kp_equal) ; type4 only!
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
230 'f25 'kp_divide ;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
231 'f26 'kp_multiply ;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
232 'f24 'kp_subtract ; type5 only!
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
233 'f27 'kp_7 ;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 ;; up is ok
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
235 'f29 'kp_9
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 ;; left is ok
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
237 'f31 'kp_5
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 ;; right is ok
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
239 ;; kp_add is ok
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
240 'f33 'kp_1 ; the Sun name
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 'r13 'end ; the MIT name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 ;; down is ok
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
243 'f35 'kp_3
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 ;; insert is ok
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 ;; delete is ok
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 52
diff changeset
246 ;; kp_enter is ok
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 'SunF36 'f11 ; Type 5 keyboards
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 'SunF37 'f12 ; Used to be Stop & Again
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 ;;; OpenWindows-like "find" processing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 ;;; As far as I know, the `find' key is a Sunism, so we do that binding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 ;;; here. This is the only Sun-specific keybinding. (The functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 ;;; themselves are in x-win.el in case someone wants to use them when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 ;;; not running on a Sun display.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (define-key global-map 'find 'ow-find)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (define-key global-map '(shift find) 'ow-find-backward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 ;;; x-win-sun.el ends here