annotate lisp/x11/x-win-sun.el @ 52:461c7ba8286a r19-16-pre1

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