comparison lisp/keydefs.el @ 209:41ff10fd062f r20-4b3

Import from CVS: tag r20-4b3
author cvs
date Mon, 13 Aug 2007 10:04:58 +0200
parents
children 2c611d1463a6
comparison
equal deleted inserted replaced
208:f427b8ec4379 209:41ff10fd062f
1 ;;; keydefs.el --- Define standard keybindings.
2
3 ;; Copyright (C) 1992-4, 1997 Free Software Foundation, Inc.
4
5 ;; Maintainer: XEmacs Development Team
6 ;; Keywords: internal, dumped
7
8 ;; This file is part of XEmacs.
9
10 ;; XEmacs is free software; you can redistribute it and/or modify it
11 ;; under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; XEmacs is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ;; General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with XEmacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;; All the global bindings should be here so that one can reload things
26 ;; like files.el without trashing one's personal bindings.
27
28 ;;; Synched up with: Not synched with FSF.
29
30 ;;; Commentary:
31
32 ;; This file is dumped with XEmacs
33
34 ;;; Code:
35
36 ;; created by C code
37 (defvar global-map (current-global-map) "\
38 Default global keymap mapping XEmacs keyboard input into commands.
39 The value is a keymap which is usually (but not necessarily) XEmacs's
40 global map.")
41
42 ;; created by C code
43 (defvar esc-map (symbol-function 'ESC-prefix) "\
44 Default keymap for ESC (meta) commands.
45 The normal global definition of the character ESC indirects to this keymap.")
46
47 (set-keymap-name global-map 'global-map)
48 (set-keymap-name esc-map 'ESC-prefix)
49
50 (define-prefix-command 'Control-X-prefix t)
51 (defvar ctl-x-map (symbol-function 'Control-X-prefix) "\
52 Default keymap for C-x commands.
53 The normal global definition of the character C-x indirects to this keymap.")
54 (define-key global-map "\C-x" 'Control-X-prefix)
55
56 (define-prefix-command 'ctl-x-4-prefix t)
57 (defvar ctl-x-4-map (symbol-function 'ctl-x-4-prefix) "\
58 Keymap for subcommands of C-x 4")
59 (define-key global-map "\C-x4" 'ctl-x-4-prefix)
60
61 (define-prefix-command 'ctl-x-5-prefix t)
62 (defvar ctl-x-5-map (symbol-function 'ctl-x-5-prefix) "\
63 Keymap for subcommands of C-x 5")
64 (define-key global-map "\C-x5" 'ctl-x-5-prefix)
65
66 (define-prefix-command 'mode-specific-command-prefix t)
67 (defvar mode-specific-map (symbol-function 'mode-specific-command-prefix) "\
68 Keymap for characters following C-c.")
69 (define-key global-map "\C-c" 'mode-specific-command-prefix)
70
71 ;; FSFmacs buffer.c
72
73 (define-key global-map "\C-xb" 'switch-to-buffer)
74 (define-key global-map "\C-xk" 'kill-buffer)
75 (define-key global-map "\C-x\C-b" 'list-buffers)
76 (put 'erase-buffer 'disabled t) ;from buffer.c
77
78 ;; FSFmacs casefiddle.c
79
80 (define-key global-map "\C-x\C-u" 'upcase-region)
81 ;; This is silly with zmacs regions
82 ;(put 'upcase-region 'disabled t)
83 (define-key global-map "\C-x\C-l" 'downcase-region)
84 ;; This is silly with zmacs regions
85 ;(put 'downcase-region 'disabled t)
86 (define-key global-map "\M-u" 'upcase-region-or-word)
87 (define-key global-map "\M-l" 'downcase-region-or-word)
88 (define-key global-map "\M-c" 'capitalize-region-or-word)
89
90 ;; FSFmacs cmds.c
91
92 (let ((n 33))
93 (while (<= n 255)
94 (if (not (= n 127))
95 (define-key global-map n 'self-insert-command))
96 (setq n (1+ n))))
97 (define-key global-map " " 'self-insert-command)
98
99 (define-key global-map "\C-a" 'beginning-of-line)
100 (define-key global-map "\C-b" 'backward-char)
101 (define-key global-map "\C-e" 'end-of-line)
102 (define-key global-map "\C-f" 'forward-char)
103 (define-key global-map "\C-d" 'delete-char)
104 (define-key global-map 'delete 'backward-or-forward-delete-char)
105 (define-key global-map '(meta delete) 'backward-or-forward-kill-word)
106 (define-key global-map [(control x) (delete)] 'backward-or-forward-kill-sentence)
107
108 ;; FSFmacs files.el
109
110 (define-key global-map "\C-x\C-f" 'find-file)
111 (define-key global-map "\C-x\C-q" 'toggle-read-only)
112 (define-key global-map "\C-x\C-r" 'find-file-read-only)
113 (define-key global-map "\C-x\C-v" 'find-alternate-file)
114 (define-key global-map "\C-x\C-s" 'save-buffer)
115 (define-key global-map "\C-xs" 'save-some-buffers)
116 (define-key global-map "\C-x\C-w" 'write-file)
117 (define-key global-map "\C-xi" 'insert-file)
118 (define-key global-map "\M-~" 'not-modified)
119 (define-key global-map "\C-x\C-d" 'list-directory)
120 (define-key global-map "\C-x\C-c" 'save-buffers-kill-emacs)
121
122 (define-key global-map "\C-x4f" 'find-file-other-window)
123 (define-key global-map "\C-x4r" 'find-file-read-only-other-window)
124 (define-key global-map "\C-x4\C-f" 'find-file-other-window)
125 (define-key global-map "\C-x4b" 'switch-to-buffer-other-window)
126 (define-key global-map "\C-x4\C-o" 'display-buffer)
127
128 (define-key global-map "\C-x5b" 'switch-to-buffer-other-frame)
129 (define-key global-map "\C-x5f" 'find-file-other-frame)
130 (define-key global-map "\C-x5\C-f" 'find-file-other-frame)
131 (define-key global-map "\C-x5r" 'find-file-read-only-other-frame)
132
133 ;; FSFmacs frame.c
134 ;FSFmacs has these. It's probably a good idea to provide ways of hooking
135 ;these events, but it's unlikely that it's a good idea to do it this way.
136 ;Just provide a hook, like the existing `select-frame-hook',
137 ;`deselect-frame-hook', `map-frame-hook', and `unmap-frame-hook'.
138 ;#### ergo need hooks for delete-frame and iconify-frame
139 ;(define-key global-map 'switch-frame 'handle-switch-frame)
140 ;(define-key global-map 'delete-frame 'handle-delete-frame)
141 ;(define-key global-map 'iconify-frame 'ignore-event)
142 ;(define-key global-map 'make-frame-visible 'ignore-event)
143
144 ;; FSFmacs frame.el
145
146 ;; New FSF19 bindings: C-x 5 as prefix for window commands
147 (define-key global-map "\C-x52" 'make-frame)
148 (define-key global-map "\C-x50" 'delete-frame)
149 (define-key global-map "\C-x5o" 'other-frame)
150
151 ;; FSFmacs help.el
152
153 (define-key global-map (vector help-char) 'help-command)
154 (define-key global-map 'help 'help-command)
155 (define-key global-map 'f1 'help-command)
156
157 ;; FSFmacs indent.el
158
159 ;;(define-key global-map "\t" 'self-insert-command)
160 (define-key global-map "\t" 'indent-for-tab-command)
161 (define-key global-map "\M-\C-\\" 'indent-region)
162 (define-key global-map "\C-x\t" 'indent-rigidly)
163 (define-key global-map "\M-i" 'tab-to-tab-stop)
164 ;; XEmacs addition:
165 (define-key global-map [(shift tab)] 'tab-to-tab-stop)
166
167 ;; FSFmacs isearch.el
168
169 (define-key global-map "\C-s" 'isearch-forward)
170 (define-key global-map "\C-r" 'isearch-backward)
171 (define-key global-map "\M-\C-s" 'isearch-forward-regexp)
172 (define-key global-map "\M-\C-r" 'isearch-backward-regexp)
173
174 ;; FSFmacs keyboard.c
175
176 (define-key global-map "\C-z" 'suspend-emacs-or-iconify-frame)
177 (define-key global-map "\C-x\C-z" 'suspend-or-iconify-emacs)
178
179 ;; FSFmacs loaddefs.el
180
181 ;; New FSF19 bindings: C-x n as a prefix for narrowing commands.
182 (define-key global-map "\C-xn" (let ((map (make-sparse-keymap)))
183 (set-keymap-name map 'narrowing-prefix)
184 map))
185 (put 'narrow-to-region 'disabled t)
186 (define-key global-map "\C-xnn" 'narrow-to-region)
187 (define-key global-map "\C-xnw" 'widen)
188 (define-key global-map "\C-xnd" 'narrow-to-defun)
189 ;; Old v18 bindings
190 ;(define-key global-map "\C-xn" 'narrow-to-region)
191 ;(define-key global-map "\C-xw" 'widen)
192
193 (define-key global-map "\C-j" 'newline-and-indent)
194 (define-key global-map "\C-m" 'newline)
195 (define-key global-map "\C-o" 'open-line)
196 (define-key global-map "\M-\C-o" 'split-line)
197 (define-key global-map "\C-q" 'quoted-insert)
198 (define-key global-map "\M-^" 'delete-indentation)
199 (define-key global-map "\M-\\" 'delete-horizontal-space)
200 (define-key global-map "\M-m" 'back-to-indentation)
201 (define-key global-map "\C-x\C-o" 'delete-blank-lines)
202 (define-key global-map "\M- " 'just-one-space)
203 (define-key global-map "\M-z" 'zap-to-char)
204 (define-key global-map "\M-=" 'count-lines-region)
205 (define-key global-map "\C-x=" 'what-cursor-position)
206 (define-key global-map "\M-:" 'eval-expression)
207 ;; Define ESC ESC : like ESC : for people who type ESC ESC out of habit.
208 (define-key global-map "\M-\e:" 'eval-expression)
209 ;(define-key global-map "\M-\e" 'eval-expression)
210 ;; Do we really need to disable this now that it is harder to type
211 ;; by accident?
212 ;; (put 'eval-expression 'disabled t)
213 ;; Changed from C-x ESC so that function keys work following C-x.
214 (define-key global-map "\C-x\e\e" 'repeat-complex-command)
215 ;(define-key global-map "\C-x\e" 'repeat-complex-command)
216 (define-key global-map "\C-xu" 'advertised-undo)
217 ;; Many people are used to typing C-/ on X terminals and getting C-_.
218 (define-key global-map '(control /) 'undo)
219 (define-key global-map "\C-_" 'undo)
220 (define-key global-map "\M-!" 'shell-command)
221 (define-key global-map "\M-|" 'shell-command-on-region)
222
223 (define-key global-map "\C-u" 'universal-argument)
224 ;; Make Control-0 - Control-9 set the prefix argument, like Meta-0.
225 (let ((i ?0))
226 (while (<= i ?9)
227 (define-key global-map (list 'meta i) 'digit-argument)
228 (define-key global-map (list 'control i) 'digit-argument)
229 (define-key global-map (list 'control 'meta i) 'digit-argument)
230 (setq i (1+ i))))
231 (define-key global-map '(meta -) 'negative-argument)
232 (define-key global-map '(control -) 'negative-argument)
233 (define-key global-map '(control meta -) 'negative-argument)
234
235 (define-key global-map "\C-k" 'kill-line)
236 (define-key global-map "\C-w" 'kill-region)
237 (define-key global-map "\M-w" 'kill-ring-save)
238 (define-key global-map "\M-\C-w" 'append-next-kill)
239 (define-key global-map "\C-y" 'yank)
240 (define-key global-map "\M-y" 'yank-pop)
241
242 ;; Old v18 binding
243 ;(define-key global-map "\C-xa" 'append-to-buffer)
244
245 (define-key global-map "\C-@" 'set-mark-command)
246 ;; Many people are used to typing C-SPC and getting C-@.
247 (define-key global-map '(control ? ) 'set-mark-command)
248 (define-key global-map "\C-x\C-x" 'exchange-point-and-mark)
249 (define-key global-map "\C-x\C-@" 'pop-global-mark)
250 (define-key global-map [(control x) (control ? )] 'pop-global-mark)
251
252 (define-key global-map "\C-n" 'next-line)
253 (define-key global-map "\C-p" 'previous-line)
254 ;(define-key global-map "\C-x\C-n" 'set-goal-column)
255 ;; XEmacs:
256 ;;; Many people have said they rarely use this feature, and often type
257 ;;; it by accident. Maybe it shouldn't even be on a key.
258 ;;; Done. -hniksic
259 ;(put 'set-goal-column 'disabled t)
260
261 (define-key global-map [menu] 'execute-extended-command)
262 (define-key global-map [find] 'search-forward)
263
264 (define-key global-map "\C-t" 'transpose-chars)
265 (define-key global-map "\M-t" 'transpose-words)
266 (define-key global-map "\M-\C-t" 'transpose-sexps)
267 (define-key global-map "\C-x\C-t" 'transpose-lines)
268
269 (define-key global-map "\M-;" 'indent-for-comment)
270 (define-key global-map "\M-j" 'indent-new-comment-line)
271 (define-key global-map "\M-\C-j" 'indent-new-comment-line)
272 (define-key global-map "\C-x;" 'set-comment-column)
273 (define-key global-map "\C-xf" 'set-fill-column)
274 (define-key global-map "\C-x$" 'set-selective-display)
275
276 (define-key global-map "\M-@" 'mark-word)
277 (define-key global-map "\M-f" 'forward-word)
278 (define-key global-map "\M-b" 'backward-word)
279 (define-key global-map "\M-d" 'kill-word)
280
281 (define-key global-map "\M-<" 'beginning-of-buffer)
282 (define-key global-map "\M->" 'end-of-buffer)
283 (define-key global-map "\C-xh" 'mark-whole-buffer)
284 (define-key global-map "\M-\\" 'delete-horizontal-space)
285
286 (define-key global-map "\M-\C-f" 'forward-sexp)
287 (define-key global-map "\M-\C-b" 'backward-sexp)
288 (define-key global-map "\M-\C-u" 'backward-up-list)
289 (define-key global-map "\M-\C-@" 'mark-sexp)
290 (define-key global-map "\M-\C-d" 'down-list)
291 (define-key global-map "\M-\C-k" 'kill-sexp)
292 (define-key global-map "\M-\C-n" 'forward-list)
293 (define-key global-map "\M-\C-p" 'backward-list)
294 (define-key global-map "\M-\C-a" 'beginning-of-defun)
295 (define-key global-map "\M-\C-e" 'end-of-defun)
296 (define-key global-map "\M-\C-h" 'mark-defun)
297 (define-key global-map "\M-\(" 'insert-parentheses)
298 (define-key global-map "\M-\)" 'move-past-close-and-reindent)
299 (define-key global-map "\M-\t" 'lisp-complete-symbol)
300
301 (define-key global-map '(control meta backspace) 'backward-kill-sexp)
302 (define-key global-map '(control meta delete) 'backward-or-forward-kill-sexp)
303
304
305 (define-key global-map "\C-x/" 'point-to-register)
306 (define-key global-map "\C-xj" 'jump-to-register)
307 (define-key global-map "\C-xx" 'copy-to-register)
308 (define-key global-map "\C-xg" 'insert-register)
309 ;; Old v18 binding
310 ;(define-key global-map "\C-xr" 'copy-rectangle-to-register)
311
312 ;; New FSF19 bindings: C-x r as a prefix for register commands
313 (define-key global-map "\C-xr" (let ((map (make-sparse-keymap)))
314 (set-keymap-name map 'rectangle-prefix)
315 map))
316 (define-key global-map "\C-xr\C-@" 'point-to-register)
317 (define-key global-map "\C-xr " 'point-to-register)
318 (define-key global-map "\C-xrj" 'jump-to-register)
319 (define-key global-map "\C-xrs" 'copy-to-register)
320 (define-key global-map "\C-xrx" 'copy-to-register)
321 (define-key global-map "\C-xri" 'insert-register)
322 (define-key global-map "\C-xrg" 'insert-register)
323 (define-key global-map "\C-xrr" 'copy-rectangle-to-register)
324 (define-key global-map "\C-xrc" 'clear-rectangle)
325 (define-key global-map "\C-xrk" 'kill-rectangle)
326 (define-key global-map "\C-xry" 'yank-rectangle)
327 (define-key global-map "\C-xro" 'open-rectangle)
328 (define-key global-map "\C-xrt" 'string-rectangle)
329 (define-key global-map "\C-xrw" 'window-configuration-to-register)
330 ;(define-key global-map "\C-xrf" 'frame-configuration-to-register)
331
332 (define-key global-map "\M-q" 'fill-paragraph-or-region)
333 ;(define-key global-map "\M-q" 'fill-paragraph)
334 ;(define-key global-map "\M-g" 'fill-region) ;now bound to goto-line
335 (define-key global-map "\C-x." 'set-fill-prefix)
336
337 ; Using {} instead of [] is 1) FSF compatible and 2) allows function
338 ; keys to work on ttys. M-[ is the beginning of most the function key
339 ; sequences.
340 (define-key global-map "\M-{" 'backward-paragraph)
341 (define-key global-map "\M-}" 'forward-paragraph)
342 (define-key global-map "\M-h" 'mark-paragraph)
343 (define-key global-map "\M-a" 'backward-sentence)
344 (define-key global-map "\M-e" 'forward-sentence)
345 (define-key global-map "\M-k" 'kill-sentence)
346 ;;(define-key global-map "\C-x\177" 'backward-kill-sentence)
347
348 (define-key global-map "\C-x[" 'backward-page)
349 (define-key global-map "\C-x]" 'forward-page)
350 (define-key global-map "\C-x\C-p" 'mark-page)
351 (define-key global-map "\C-xl" 'count-lines-page)
352 (define-key global-map "\C-xnp" 'narrow-to-page)
353 ;; Old v18 bindings
354 ;(define-key global-map "\C-xp" 'narrow-to-page)
355 (put 'narrow-to-page 'disabled t)
356
357 ;; Old v18 bindings
358 ;(define-key global-map "\C-x\C-a" 'add-mode-abbrev)
359 ;(define-key global-map "\C-x+" 'add-global-abbrev)
360 ;(define-key global-map "\C-x\C-h" 'inverse-add-mode-abbrev)
361 ;(define-key global-map "\C-x-" 'inverse-add-global-abbrev)
362
363 (define-key global-map "\M-'" 'abbrev-prefix-mark)
364 (define-key global-map "\C-x'" 'expand-abbrev)
365
366 ;; New FSF19 bindings: C-x a as a prefix for abbrev commands
367 (define-key global-map "\C-xal" 'add-mode-abbrev)
368 (define-key global-map "\C-xa\C-a" 'add-mode-abbrev)
369 (define-key global-map "\C-xag" 'add-global-abbrev)
370 (define-key global-map "\C-xa+" 'add-mode-abbrev)
371 (define-key global-map "\C-xaig" 'inverse-add-global-abbrev)
372 (define-key global-map "\C-xail" 'inverse-add-mode-abbrev)
373 (define-key global-map "\C-xa-" 'inverse-add-global-abbrev)
374 (define-key global-map "\C-xae" 'expand-abbrev)
375 (define-key global-map "\C-xa'" 'expand-abbrev)
376
377 (define-key global-map "\M-\C-l" 'switch-to-other-buffer)
378
379 ;; Default binding of "Backspace" is no longer the same as delete.
380 ;; Default binding of "Control-h" is help.
381 (define-key global-map 'backspace 'delete-backward-char)
382 (define-key global-map '(meta backspace) 'backward-kill-word)
383
384 (define-key global-map "\M-\C-z" 'activate-region)
385
386 ;; FSFmacs macros.c
387
388 (define-key global-map "\C-xe" 'call-last-kbd-macro)
389 (define-key global-map "\C-x\(" 'start-kbd-macro)
390 (define-key global-map "\C-x\)" 'end-kbd-macro)
391
392 ;; FSFmacs macros.el
393
394 (define-key global-map "\C-xq" 'kbd-macro-query)
395
396
397 ;; FSFmacs minibuffer.c
398 ; see also minibuf.el
399
400 (define-key global-map "\M-\C-c" 'exit-recursive-edit)
401 (define-key global-map "\C-]" 'abort-recursive-edit)
402 (define-key global-map "\M-x" 'execute-extended-command)
403
404 ;; FSFmacs window.c
405
406 (define-key global-map "\C-x0" 'delete-window)
407 (define-key global-map "\C-x1" 'delete-other-windows)
408 (define-key global-map "\C-x2" 'split-window-vertically)
409 (define-key global-map "\C-x3" 'split-window-horizontally)
410 ;; Old XEmacs binding
411 ;;(define-key global-map "\C-x5" 'split-window-horizontally)
412 (define-key global-map "\C-xo" 'other-window)
413 (define-key global-map "\C-x^" 'enlarge-window)
414 (define-key global-map "\C-x<" 'scroll-left)
415 (define-key global-map "\C-x>" 'scroll-right)
416
417 (define-key global-map "\C-v" 'scroll-up)
418 (define-key global-map "\M-v" 'scroll-down)
419 (define-key global-map "\M-\C-v" 'scroll-other-window)
420 ; meta-shift-V, that is.
421 (define-key global-map '(meta V) 'scroll-other-window-down)
422
423 (define-key global-map "\C-l" 'recenter)
424 (define-key global-map "\M-r" 'move-to-window-line)
425
426 ;; FSFmacs window.el
427
428 (define-key global-map "\C-x6" 'window-configuration-to-register)
429 ;(define-key global-map "\C-x7" 'jump-to-register);ie register-to-window-config
430 (define-key global-map "\C-x}" 'enlarge-window-horizontally)
431 (define-key global-map "\C-x{" 'shrink-window-horizontally)
432 ;; New FSF19 bindings
433 (define-key global-map "\C-x-" 'shrink-window-if-larger-than-buffer)
434 (define-key global-map "\C-x+" 'balance-windows)
435 (define-key ctl-x-4-map "0" 'kill-buffer-and-window)
436
437 ;;(define-key global-map "\C-g" 'keyboard-quit)
438 (let ((ch (quit-char)))
439 (if (or (characterp ch) (integerp ch))
440 (setq ch (char-to-string ch)))
441 (define-key global-map ch 'keyboard-quit))
442 (define-key global-map "\e\e\e" 'keyboard-escape-quit)
443
444
445
446
447
448
449 (define-key global-map "\M-%" 'query-replace)
450
451
452 ; autoloaded
453 ;(define-key global-map "\C-x4a" 'add-change-log-entry-other-window)
454
455 ; autoloaded
456 ;(define-key global-map "\C-x`" 'next-error)
457
458 ; autoloaded
459 ;(define-key global-map "\M-/" 'dabbrev-expand)
460
461 ; autoloaded
462 ;(define-key global-map "\C-xd" 'dired)
463
464 ; autoloaded
465 ;(define-key global-map "\C-x4d" 'dired-other-window)
466
467 (define-key global-map "\M-$" 'ispell-word)
468
469 (define-key global-map "\C-xm" 'compose-mail)
470 (define-key global-map "\C-x4m" 'compose-mail-other-window)
471 (define-key global-map "\C-x5m" 'compose-mail-other-frame)
472
473 (define-key global-map "\M-." 'find-tag)
474
475 (define-key global-map "\C-x4." 'find-tag-other-window)
476
477 (define-key global-map "\M-," 'tags-loop-continue)
478
479
480 (define-key global-map '(control <) 'mark-beginning-of-buffer)
481 (define-key global-map '(control >) 'mark-end-of-buffer)
482
483 (define-key global-map "\C-x\C-e" 'eval-last-sexp) ;bogus!
484
485
486 (define-key global-map "\M-g" 'goto-line)
487
488 ;; Keypad type things
489
490 ;; I removed all the fkey crap, because where-is is now smart enough
491 ;; to show all bindings. --ben
492
493 ;;; These aren't bound to kbd macros like "\C-b" so that they have the
494 ;; expected behavior even in, for example, vi-mode.
495
496 ;; We use here symbolic names, assuming that the corresponding keys will
497 ;; generate these keysyms. This is not true on Suns, but x-win-sun.el
498 ;; fixes that. If it turns out that the semantics of these keys should
499 ;; differ from server to server, this should be moved into server-specific
500 ;; files, but these appear to be the standard Motif and PC bindings.
501
502 ;; movement by units
503 (define-key global-map 'left 'backward-char)
504 (define-key global-map 'up 'previous-line)
505 (define-key global-map 'right 'forward-char)
506 (define-key global-map 'down 'next-line)
507
508 ;; movement by pages
509 (define-key global-map 'prior 'scroll-down)
510 (define-key global-map 'next 'scroll-up)
511
512 ;; movement to the limits
513 (define-key global-map 'home 'beginning-of-line)
514 (define-key global-map 'end 'end-of-line)
515
516 ;;; Miscellaneous key bindings
517 (define-key global-map 'again 'repeat-complex-command)
518 (define-key global-map 'insert 'overwrite-mode)
519
520 ;;; These aren't bound to kbd macros like "\C-b" so that they have the
521 ;; expected behavior even in, for example, vi-mode.
522
523 ;; We use here symbolic names, assuming that the corresponding keys will
524 ;; generate these keysyms. This is not true on Suns, but x-win-sun.el
525 ;; fixes that. If it turns out that the semantics of these keys should
526 ;; differ from server to server, this should be moved into server-specific
527 ;; files, but these appear to be the standard Motif and PC bindings.
528
529 ;; potential R6isms
530 (define-key global-map 'kp-left 'backward-char)
531 (define-key global-map 'kp-up 'previous-line)
532 (define-key global-map 'kp-right 'forward-char)
533 (define-key global-map 'kp-down 'next-line)
534
535
536 ;; movement by larger blocks
537 (define-key global-map '(control left) 'backward-word)
538 (define-key global-map '(control up) #'(lambda ()
539 (interactive "_")
540 (forward-line -6)))
541 (define-key global-map '(control right) 'forward-word)
542 (define-key global-map '(control down) #'(lambda ()
543 (interactive "_")
544 (forward-line 6)))
545
546 ;; context-sensitive movement
547 (define-key global-map '(meta left) 'backward-sexp)
548 (define-key global-map '(meta right) 'forward-sexp)
549 (define-key global-map '(meta up) 'backward-paragraph)
550 (define-key global-map '(meta down) 'forward-paragraph)
551
552 ;; movement by pages
553 (define-key global-map '(control prior) 'scroll-right)
554 (define-key global-map '(control next) 'scroll-left)
555 ;; potential R6isms
556 (define-key global-map 'kp-prior 'scroll-down)
557 (define-key global-map 'kp-next 'scroll-up)
558 (define-key global-map '(control kp-prior) 'scroll-right)
559 (define-key global-map '(control kp-next) 'scroll-left)
560
561
562 ;; movement to the limits
563 (define-key global-map '(control home) 'beginning-of-buffer)
564 (define-key global-map '(control end) 'end-of-buffer)
565 (define-key global-map 'begin 'beginning-of-line)
566 (define-key global-map '(control begin) 'beginning-of-buffer)
567 ;; potential R6isms
568 (define-key global-map 'kp-home 'beginning-of-line)
569 (define-key global-map '(control kp-home) 'beginning-of-buffer)
570 (define-key global-map 'kp-end 'end-of-line)
571 (define-key global-map '(control kp-end) 'end-of-buffer)
572
573 ;; movement between windows
574 (define-key global-map '(control tab) 'other-window)
575 (define-key global-map '(control shift tab) 'backward-other-window)
576
577 ;; movement in other windows
578 (define-key global-map '(meta next) 'scroll-other-window)
579 (define-key global-map '(meta prior) 'scroll-other-window-down)
580 (define-key global-map '(meta home) 'beginning-of-buffer-other-window)
581 (define-key global-map '(meta end) 'end-of-buffer-other-window)
582 ;; potential R6isms
583 (define-key global-map '(meta kp-next) 'scroll-other-window)
584 (define-key global-map '(meta kp-prior) 'scroll-other-window-down)
585 (define-key global-map '(meta kp-home) 'beginning-of-buffer-other-window)
586 (define-key global-map '(meta kp-end) 'end-of-buffer-other-window)
587
588 ;; potential R6isms
589 (define-key global-map 'redo 'repeat-complex-command)
590 (define-key global-map 'kp-insert 'overwrite-mode)
591 (define-key global-map 'kp-delete 'backward-delete-char-untabify)
592
593 (define-key global-map 'kp-enter [return]) ; do whatever RET does now
594 (define-key global-map 'kp-tab [tab])
595
596 (define-key global-map 'undo 'undo)
597 (define-key global-map 'help 'help-for-help)
598
599 (define-key global-map 'kp-space 'self-insert-command)
600 (define-key global-map 'kp-equal 'self-insert-command)
601 (define-key global-map 'kp-multiply 'self-insert-command)
602 (define-key global-map 'kp-add 'self-insert-command)
603 (define-key global-map 'kp-separator 'self-insert-command)
604 (define-key global-map 'kp-subtract 'self-insert-command)
605 (define-key global-map 'kp-decimal 'self-insert-command)
606 (define-key global-map 'kp-divide 'self-insert-command)
607
608 (define-key global-map 'kp-0 'self-insert-command)
609 (define-key global-map 'kp-1 'self-insert-command)
610 (define-key global-map 'kp-2 'self-insert-command)
611 (define-key global-map 'kp-3 'self-insert-command)
612 (define-key global-map 'kp-4 'self-insert-command)
613 (define-key global-map 'kp-5 'self-insert-command)
614 (define-key global-map 'kp-6 'self-insert-command)
615 (define-key global-map 'kp-7 'self-insert-command)
616 (define-key global-map 'kp-8 'self-insert-command)
617 (define-key global-map 'kp-9 'self-insert-command)
618
619 (define-key global-map 'select 'function-key-error)
620 (define-key global-map 'print 'function-key-error)
621 (define-key global-map 'execute 'execute-extended-command)
622 (define-key global-map 'clearline 'function-key-error)
623 (define-key global-map 'insertline 'open-line)
624 (define-key global-map 'deleteline 'kill-line)
625 (define-key global-map 'insertchar 'function-key-error)
626 (define-key global-map 'deletechar 'delete-char)
627
628 ;;; keydefs.el ends here