annotate lisp/x-win-sun.el @ 284:558f606b08ae r21-0b40

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