annotate lisp/x-win-sun.el @ 229:434959a2fba3 r20-5b13

Import from CVS: tag r20-5b13
author cvs
date Mon, 13 Aug 2007 10:13:02 +0200
parents 41ff10fd062f
children 157b30c96d03
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
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
4 ;; Authors: jwz@netscape.com, wing@666.com, mrb@eng.sun.com
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
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
20 ;; along with XEmacs; see the file COPYING. If not, write to the
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
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
69 (defun x-remap-keysyms-using-function-key-map (from-key to-key)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
70 (dolist (prefix '(() (shift) (control) (meta) (alt)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
71 (shift control) (shift alt) (shift meta)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
72 (control alt) (control meta) (alt meta)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
73 (shift control alt) (shift control meta)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
74 (shift alt meta) (control alt meta)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
75 (shift control alt meta)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
76 (define-key function-key-map
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
77 (append prefix (list from-key))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
78 (vector (append prefix (list to-key))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
79
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
80 ;; help is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
81 ;; num_lock is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
82 ;; up is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
83 ;; left is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
84 ;; right is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
85 ;; kp-add is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
86 ;; down is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
87 ;; insert is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
88 ;; delete is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
89 ;; kp-enter is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
90 ;; Sun Function keys
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
91 (loop for (x-name from-key to-key) in
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
92 `(("F21" f21 pause)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
93 ("F22" f22 print)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
94 ("F23" f23 scroll_lock)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
95
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
96 ;; X11 R6 mappings
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
97 ("SunProps" SunProps props)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
98 ("SunFront" SunFront front)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
99 ("SunOpen" SunOpen open)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
100 ("SunFind" SunFind find)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
101 ("Cancel" cancel stop)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
102 ("Undo" Undo undo)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
103 ("SunCopy" SunCopy copy)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
104 ("SunPaste" SunPaste paste)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
105 ("SunCut" SunCut cut)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
106
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
107 ("F13" f13 props)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
108 ("F14" f14 undo)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
109 ("F15" f15 front)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
110 ("F16" f16 copy)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
111 ("F17" f17 open)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
112 ("F18" f18 paste)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
113 ("F19" f19 find)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
114 ("F20" f20 cut)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
115
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
116 ("F25" f25 kp-divide)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
117 ("F26" f26 kp-multiply)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
118 ("F31" f31 kp-5)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
119
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
120 ;; Map f33 and r13 to end or kp-end
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
121 ,@(cond
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
122 ((not (x-keysym-on-keyboard-sans-modifiers-p "End"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
123 '(("F33" f33 end)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
124 ("R13" r13 end)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
125 ((not (x-keysym-on-keyboard-sans-modifiers-p "KP_End"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
126 '(("F33" f33 kp-end)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
127 ("R13" r13 kp-end))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
128
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
129 ,@(if (x-keysym-on-keyboard-sans-modifiers-p "F36")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
130 '(("F36" f36 stop)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
131 ("F37" f37 again)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
132
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
133 ;; Type 4 keyboards have a real kp-subtract and a f24 labelled `='
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
134 ;; Type 5 keyboards have no key labelled `=' and a f24 labelled `-'
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
135 ,@(when (x-keysym-on-keyboard-sans-modifiers-p "F24")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
136 `(("F24" f24 ,(if (x-keysym-on-keyboard-sans-modifiers-p "KP_Subtract")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
137 'kp-equal
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
138 'kp-subtract))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
139
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
140 ;; Map f27 to home or kp-home, as appropriate
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
141 ,@(cond ((not (x-keysym-on-keyboard-sans-modifiers-p "Home"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
142 '(("F27" f27 home)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
143 ((not (x-keysym-on-keyboard-sans-modifiers-p "KP_Home"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
144 '(("F27" f27 kp-home))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
145
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
146 ;; Map f29 to prior or kp-prior, as appropriate
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
147 ,@(cond ((not (x-keysym-on-keyboard-sans-modifiers-p "Prior"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
148 '(("F29" f29 prior)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
149 ((not (x-keysym-on-keyboard-sans-modifiers-p "KP_Prior"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
150 '(("F29" f29 kp-prior))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
151
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
152 ;; Map f35 to next or kp-next, as appropriate
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
153 ,@(cond ((not (x-keysym-on-keyboard-sans-modifiers-p "Next"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
154 '(("F35" f35 next)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
155 ((not (x-keysym-on-keyboard-sans-modifiers-p "KP_Next"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
156 '(("F35" f35 kp-next))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
157
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
158 ,@(cond ((x-keysym-on-keyboard-sans-modifiers-p "apRead") ; SunOS 4.1.1
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
159 '(("apRead" apRead f11) ("apEdit" apEdit f12)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
160 ((x-keysym-on-keyboard-sans-modifiers-p "SunF36") ; SunOS 5
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
161 '(("SunF36" SunF36 f11)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
162 ("SunF37" SunF37 f12)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
163 ("F11" f11 stop)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
164 ("F12" f12 again))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
165 )
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
166 do (when (x-keysym-on-keyboard-sans-modifiers-p x-name)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
167 (x-remap-keysyms-using-function-key-map from-key to-key)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
168
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
169 (unintern 'x-remap-keysyms-using-function-key-map)
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!)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
176 ; (while mapping
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
177 ; (let ((mods '(() (shift) (control) (meta) (alt))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
178 ; (while mods
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
179 ; (let ((k1 (vector (append (car mods) (list (car (car mapping))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
180 ; (k2 (vector (append (car mods) (list (cdr (car mapping)))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
181 ; (define-key global-map k1 k2))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
182 ; (setq mods (cdr mods))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
183 ; (setq mapping (cdr mapping))))
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
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
191 ;;; And I've made it into a function which is NOT called by default --mrb
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
192
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
193 (defun sun-x11-keyboard-translate ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
194 "Remap Sun's X11 keyboard.
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'."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
197 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
198
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
199 (keyboard-translate
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
200 'f11 'stop ; the type4 keyboard Sun/MIT name
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
201 'f36 'stop ; the type5 keyboard Sun name
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
202 'cancel 'stop ; R6 binding
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
203 'f12 'again ; the type4 keyboard Sun/MIT name
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
204 'f37 'again ; the type5 keyboard Sun name
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
205 'f13 'props ;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
206 'SunProps 'props ; R6 binding
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
207 'f14 'undo ;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
208 'f15 'front ;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
209 'SunFront 'front ; R6 binding
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
210 'f16 'copy ;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
211 'SunCopy 'copy ; R6 binding
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
212 'f17 'open ;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
213 'SunOpen 'open ; R6 binding
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
214 'f18 'paste ;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
215 'SunPaste 'paste ; R6 binding
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
216 'f19 'find ;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
217 'f20 'cut ;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
218 'SunCut 'cut ; R6 binding
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
219 ;; help is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
220 'f21 'pause
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
221 'f22 'prsc
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
222 'f23 'scroll
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
223 ;; num_lock is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
224 ;;'f24 'kp-equal) ; type4 only!
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
225 'f25 'kp-divide ;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
226 'f26 'kp-multiply ;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
227 'f24 'kp-subtract ; type5 only!
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
228 'f27 'kp-7 ;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
229 ;; up is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
230 'f29 'kp-9
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
231 ;; left is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
232 'f31 'kp-5
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
233 ;; right is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
234 ;; kp-add is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
235 'f33 'kp-1 ; the Sun name
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
236 'r13 'end ; the MIT name
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
237 ;; down is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
238 'f35 'kp-3
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
239 ;; insert is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
240 ;; delete is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
241 ;; kp-enter is ok
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
242 'SunF36 'f11 ; Type 5 keyboards
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
243 'SunF37 'f12 ; Used to be Stop & Again
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
244 ))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
245
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
246
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
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
253 (define-key global-map 'find 'ow-find)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
254 (define-key global-map '(shift find) 'ow-find-backward)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
255
229
434959a2fba3 Import from CVS: tag r20-5b13
cvs
parents: 209
diff changeset
256 )
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