Mercurial > hg > xemacs-beta
comparison lisp/events.el @ 2828:a25c824ed558
[xemacs-hg @ 2005-06-26 18:04:49 by aidan]
Rename the ascii-character property, support more keysyms.
author | aidan |
---|---|
date | Sun, 26 Jun 2005 18:05:05 +0000 |
parents | 3ecd8885ac67 |
children | 308d34e9f07d |
comparison
equal
deleted
inserted
replaced
2827:936a6576c655 | 2828:a25c824ed558 |
---|---|
118 | 118 |
119 See `keyboard-translate-table' for more information." | 119 See `keyboard-translate-table' for more information." |
120 (while pairs | 120 (while pairs |
121 (puthash (pop pairs) (pop pairs) keyboard-translate-table))) | 121 (puthash (pop pairs) (pop pairs) keyboard-translate-table))) |
122 | 122 |
123 (put 'tab 'ascii-character ?\t) | 123 (defun set-character-of-keysym (keysym character) |
124 (put 'linefeed 'ascii-character ?\n) | 124 "Make CHARACTER be inserted when KEYSYM is pressed, |
125 (put 'clear 'ascii-character 12) | 125 and the key has been bound to `self-insert-command'. " |
126 (put 'return 'ascii-character ?\r) | 126 (check-argument-type 'symbolp keysym) |
127 (put 'escape 'ascii-character ?\e) | 127 (check-argument-type 'characterp character) |
128 (put 'space 'ascii-character ? ) | 128 (put keysym 'character-of-keysym character)) |
129 | 129 |
130 ;; Do the same voodoo for the keypad keys. I used to bind these to keyboard | 130 (defun get-character-of-keysym (keysym) |
131 ;; macros (for instance, kp-0 was bound to "0") so that they would track the | 131 "Return the character inserted when KEYSYM is pressed, |
132 ;; bindings of the corresponding keys by default, but that made the display | 132 and the key is bound to `self-insert-command'. " |
133 ;; of M-x describe-bindings much harder to read, so now we'll just bind them | 133 (check-argument-type 'symbolp keysym) |
134 ;; to self-insert by default. Not a big difference... | 134 (event-to-character (make-event 'key-press (list 'key keysym)))) |
135 | |
136 (put 'kp-0 'ascii-character ?0) | |
137 (put 'kp-1 'ascii-character ?1) | |
138 (put 'kp-2 'ascii-character ?2) | |
139 (put 'kp-3 'ascii-character ?3) | |
140 (put 'kp-4 'ascii-character ?4) | |
141 (put 'kp-5 'ascii-character ?5) | |
142 (put 'kp-6 'ascii-character ?6) | |
143 (put 'kp-7 'ascii-character ?7) | |
144 (put 'kp-8 'ascii-character ?8) | |
145 (put 'kp-9 'ascii-character ?9) | |
146 | 135 |
147 (put 'kp-space 'ascii-character ? ) | 136 ;; We could take the first few of these out by removing the "/* Optimize for |
148 (put 'kp-tab 'ascii-character ?\t) | 137 ;; ASCII keysyms */" code in event-Xt.c, and I've a suspicion that may be |
149 (put 'kp-enter 'ascii-character ?\r) | 138 ;; the right thing to do anyway. |
150 (put 'kp-equal 'ascii-character ?=) | 139 |
151 (put 'kp-multiply 'ascii-character ?*) | 140 (loop for (keysym char) in |
152 (put 'kp-add 'ascii-character ?+) | 141 '((tab ?\t) |
153 (put 'kp-separator 'ascii-character ?,) | 142 (linefeed ?\n) |
154 (put 'kp-subtract 'ascii-character ?-) | 143 (clear ?\014) |
155 (put 'kp-decimal 'ascii-character ?.) | 144 (return ?\r) |
156 (put 'kp-divide 'ascii-character ?/) | 145 (escape ?\e) |
146 (space ? ) | |
147 | |
148 ;; Do the same voodoo for the keypad keys. I used to bind these to | |
149 ;; keyboard macros (for instance, kp-0 was bound to "0") so that they | |
150 ;; would track the bindings of the corresponding keys by default, but | |
151 ;; that made the display of M-x describe-bindings much harder to read, | |
152 ;; so now we'll just bind them to self-insert by default. Not a big | |
153 ;; difference... | |
154 | |
155 (kp-0 ?0) | |
156 (kp-1 ?1) | |
157 (kp-2 ?2) | |
158 (kp-3 ?3) | |
159 (kp-4 ?4) | |
160 (kp-5 ?5) | |
161 (kp-6 ?6) | |
162 (kp-7 ?7) | |
163 (kp-8 ?8) | |
164 (kp-9 ?9) | |
165 | |
166 (kp-space ? ) | |
167 (kp-tab ?\t) | |
168 (kp-enter ?\r) | |
169 (kp-equal ?=) | |
170 (kp-multiply ?*) | |
171 (kp-add ?+) | |
172 (kp-separator ?,) | |
173 (kp-subtract ?-) | |
174 (kp-decimal ?.) | |
175 (kp-divide ?/)) | |
176 do (set-character-of-keysym keysym char)) | |
157 | 177 |
158 ;;; events.el ends here | 178 ;;; events.el ends here |