comparison lisp/keydefs.el @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 3ecd8885ac67
children 0784d089fdc9
comparison
equal deleted inserted replaced
441:72a7cfa4a488 442:abe6d1db359e
1 ;;; keydefs.el --- Define standard keybindings. 1 ;;; keydefs.el --- Define standard keybindings.
2 2
3 ;; Copyright (C) 1992-4, 1997 Free Software Foundation, Inc. 3 ;; Copyright (C) 1992-4, 1997 Free Software Foundation, Inc.
4 ;; Copyright (C) 2000 Ben Wing.
4 5
5 ;; Maintainer: XEmacs Development Team 6 ;; Maintainer: XEmacs Development Team
6 ;; Keywords: internal, dumped 7 ;; Keywords: internal, dumped
7 8
8 ;; This file is part of XEmacs. 9 ;; This file is part of XEmacs.
104 (define-key global-map "\C-a" 'beginning-of-line) 105 (define-key global-map "\C-a" 'beginning-of-line)
105 (define-key global-map "\C-b" 'backward-char-command) 106 (define-key global-map "\C-b" 'backward-char-command)
106 (define-key global-map "\C-e" 'end-of-line) 107 (define-key global-map "\C-e" 'end-of-line)
107 (define-key global-map "\C-f" 'forward-char-command) 108 (define-key global-map "\C-f" 'forward-char-command)
108 (define-key global-map "\C-d" 'delete-char) 109 (define-key global-map "\C-d" 'delete-char)
109 (define-key global-map 'delete 'backward-or-forward-delete-char)
110 (define-key global-map '(meta delete) 'backward-or-forward-kill-word)
111 (define-key global-map [(control x) (delete)] 'backward-or-forward-kill-sentence)
112 110
113 ;; FSFmacs files.el 111 ;; FSFmacs files.el
114 112
115 (define-key global-map "\C-x\C-f" 'find-file) 113 (define-key global-map "\C-x\C-f" 'find-file)
116 (define-key global-map "\C-x\C-q" 'toggle-read-only) 114 (define-key global-map "\C-x\C-q" 'toggle-read-only)
238 (define-key global-map '(meta -) 'negative-argument) 236 (define-key global-map '(meta -) 'negative-argument)
239 (define-key global-map '(control -) 'negative-argument) 237 (define-key global-map '(control -) 'negative-argument)
240 (define-key global-map '(control meta -) 'negative-argument) 238 (define-key global-map '(control meta -) 'negative-argument)
241 239
242 (define-key global-map "\C-k" 'kill-line) 240 (define-key global-map "\C-k" 'kill-line)
241 (define-key global-map '(control K) 'historical-kill-line)
243 (define-key global-map "\C-w" 'kill-region) 242 (define-key global-map "\C-w" 'kill-region)
244 (define-key global-map "\M-w" 'kill-ring-save) 243 (define-key global-map "\M-w" 'kill-ring-save)
245 (define-key global-map "\M-\C-w" 'append-next-kill) 244 (define-key global-map "\M-\C-w" 'append-next-kill)
246 (define-key global-map "\C-y" 'yank) 245 (define-key global-map "\C-y" 'yank)
247 (define-key global-map "\M-y" 'yank-pop) 246 (define-key global-map "\M-y" 'yank-pop)
270 269
271 (define-key global-map "\C-t" 'transpose-chars) 270 (define-key global-map "\C-t" 'transpose-chars)
272 (define-key global-map "\M-t" 'transpose-words) 271 (define-key global-map "\M-t" 'transpose-words)
273 (define-key global-map "\M-\C-t" 'transpose-sexps) 272 (define-key global-map "\M-\C-t" 'transpose-sexps)
274 (define-key global-map "\C-x\C-t" 'transpose-lines) 273 (define-key global-map "\C-x\C-t" 'transpose-lines)
274
275 ;; XEmacs: much more reasonable and useful key definitions.
276 (define-key global-map '(control T) 'transpose-line-down)
277 (define-key global-map '(meta T) 'transpose-line-up)
275 278
276 (define-key global-map "\M-;" 'indent-for-comment) 279 (define-key global-map "\M-;" 'indent-for-comment)
277 (define-key global-map "\M-j" 'indent-new-comment-line) 280 (define-key global-map "\M-j" 'indent-new-comment-line)
278 (define-key global-map "\M-\C-j" 'indent-new-comment-line) 281 (define-key global-map "\M-\C-j" 'indent-new-comment-line)
279 (define-key global-map "\C-x;" 'set-comment-column) 282 (define-key global-map "\C-x;" 'set-comment-column)
302 (define-key global-map "\M-\C-e" 'end-of-defun) 305 (define-key global-map "\M-\C-e" 'end-of-defun)
303 (define-key global-map "\M-\C-h" 'mark-defun) 306 (define-key global-map "\M-\C-h" 'mark-defun)
304 (define-key global-map "\M-\(" 'insert-parentheses) 307 (define-key global-map "\M-\(" 'insert-parentheses)
305 (define-key global-map "\M-\)" 'move-past-close-and-reindent) 308 (define-key global-map "\M-\)" 'move-past-close-and-reindent)
306 (define-key global-map "\M-\t" 'lisp-complete-symbol) 309 (define-key global-map "\M-\t" 'lisp-complete-symbol)
307
308 (define-key global-map '(control meta backspace) 'backward-kill-sexp)
309 (define-key global-map '(control meta delete) 'backward-or-forward-kill-sexp)
310 310
311 311
312 (define-key global-map "\C-x/" 'point-to-register) 312 (define-key global-map "\C-x/" 'point-to-register)
313 (define-key global-map "\C-xj" 'jump-to-register) 313 (define-key global-map "\C-xj" 'jump-to-register)
314 (define-key global-map "\C-xx" 'copy-to-register) 314 (define-key global-map "\C-xx" 'copy-to-register)
387 387
388 ;; Default binding of "Backspace" is no longer the same as delete. 388 ;; Default binding of "Backspace" is no longer the same as delete.
389 ;; Default binding of "Control-h" is help. 389 ;; Default binding of "Control-h" is help.
390 (define-key global-map 'backspace 'delete-backward-char) 390 (define-key global-map 'backspace 'delete-backward-char)
391 (define-key global-map '(meta backspace) 'backward-kill-word) 391 (define-key global-map '(meta backspace) 'backward-kill-word)
392 (define-key global-map [(control x) backspace] 'backward-kill-sentence)
392 393
393 (define-key global-map "\M-\C-z" 'activate-region) 394 (define-key global-map "\M-\C-z" 'activate-region)
394 395
395 ;; FSFmacs macros.c 396 ;; FSFmacs macros.c
396 397
508 ;; differ from server to server, this should be moved into server-specific 509 ;; differ from server to server, this should be moved into server-specific
509 ;; files, but these appear to be the standard Motif and PC bindings. 510 ;; files, but these appear to be the standard Motif and PC bindings.
510 511
511 ;; movement by units 512 ;; movement by units
512 (define-key global-map 'left 'backward-char-command) 513 (define-key global-map 'left 'backward-char-command)
514 (define-key global-map 'right 'forward-char-command)
513 (define-key global-map 'up 'previous-line) 515 (define-key global-map 'up 'previous-line)
514 (define-key global-map 'right 'forward-char-command)
515 (define-key global-map 'down 'next-line) 516 (define-key global-map 'down 'next-line)
517 (define-key global-map 'kp-left 'backward-char-command)
518 (define-key global-map 'kp-right 'forward-char-command)
519 (define-key global-map 'kp-up 'previous-line)
520 (define-key global-map 'kp-down 'next-line)
516 521
517 ;; movement by pages 522 ;; movement by pages
518 (define-key global-map 'prior 'scroll-down-command) 523 (define-key global-map 'prior 'scroll-down-command)
519 (define-key global-map 'next 'scroll-up-command) 524 (define-key global-map 'next 'scroll-up-command)
520
521 ;; movement to the limits
522 (define-key global-map 'home 'beginning-of-line)
523 (define-key global-map 'end 'end-of-line)
524
525 ;;; Miscellaneous key bindings
526 (define-key global-map 'again 'repeat-complex-command)
527 (define-key global-map 'insert 'overwrite-mode)
528
529 ;;; These aren't bound to kbd macros like "\C-b" so that they have the
530 ;; expected behavior even in, for example, vi-mode.
531
532 ;; We use here symbolic names, assuming that the corresponding keys will
533 ;; generate these keysyms. This is not true on Suns, but x-win-sun.el
534 ;; fixes that. If it turns out that the semantics of these keys should
535 ;; differ from server to server, this should be moved into server-specific
536 ;; files, but these appear to be the standard Motif and PC bindings.
537
538 ;; potential R6isms
539 (define-key global-map 'kp-left 'backward-char-command)
540 (define-key global-map 'kp-up 'previous-line)
541 (define-key global-map 'kp-right 'forward-char-command)
542 (define-key global-map 'kp-down 'next-line)
543
544
545 ;; movement by larger blocks
546 (define-key global-map '(control left) 'backward-word)
547 (define-key global-map '(control up) #'(lambda ()
548 (interactive "_")
549 (forward-line -6)))
550 (define-key global-map '(control right) 'forward-word)
551 (define-key global-map '(control down) #'(lambda ()
552 (interactive "_")
553 (forward-line 6)))
554
555 ;; context-sensitive movement
556 (define-key global-map '(meta left) 'backward-sexp)
557 (define-key global-map '(meta right) 'forward-sexp)
558 (define-key global-map '(meta up) 'backward-paragraph)
559 (define-key global-map '(meta down) 'forward-paragraph)
560
561 ;; movement by pages
562 (define-key global-map '(control prior) 'scroll-right) 525 (define-key global-map '(control prior) 'scroll-right)
563 (define-key global-map '(control next) 'scroll-left) 526 (define-key global-map '(control next) 'scroll-left)
564 ;; potential R6isms
565 (define-key global-map 'kp-prior 'scroll-down-command) 527 (define-key global-map 'kp-prior 'scroll-down-command)
566 (define-key global-map 'kp-next 'scroll-up-command) 528 (define-key global-map 'kp-next 'scroll-up-command)
567 (define-key global-map '(control kp-prior) 'scroll-right) 529 (define-key global-map '(control kp-prior) 'scroll-right)
568 (define-key global-map '(control kp-next) 'scroll-left) 530 (define-key global-map '(control kp-next) 'scroll-left)
569 531
570
571 ;; movement to the limits 532 ;; movement to the limits
533 (define-key global-map 'home 'beginning-of-line)
534 (define-key global-map 'end 'end-of-line)
572 (define-key global-map '(control home) 'beginning-of-buffer) 535 (define-key global-map '(control home) 'beginning-of-buffer)
573 (define-key global-map '(control end) 'end-of-buffer) 536 (define-key global-map '(control end) 'end-of-buffer)
537 (define-key global-map 'kp-home 'beginning-of-line)
538 (define-key global-map 'kp-end 'end-of-line)
539 (define-key global-map '(control kp-home) 'beginning-of-buffer)
540 (define-key global-map '(control kp-end) 'end-of-buffer)
541
542 ;; on which systems do these exist?
574 (define-key global-map 'begin 'beginning-of-line) 543 (define-key global-map 'begin 'beginning-of-line)
575 (define-key global-map '(control begin) 'beginning-of-buffer) 544 (define-key global-map '(control begin) 'beginning-of-buffer)
576 ;; potential R6isms 545
577 (define-key global-map 'kp-home 'beginning-of-line) 546 ;; movement by larger blocks
578 (define-key global-map '(control kp-home) 'beginning-of-buffer) 547 (define-key global-map '(control left) 'backward-word)
579 (define-key global-map 'kp-end 'end-of-line) 548 (define-key global-map '(control right) 'forward-word)
580 (define-key global-map '(control kp-end) 'end-of-buffer) 549 (define-key global-map '(control up) 'backward-block-of-lines)
550 (define-key global-map '(control down) 'forward-block-of-lines)
551 (define-key global-map '(control kp-left) 'backward-word)
552 (define-key global-map '(control kp-right) 'forward-word)
553 (define-key global-map '(control kp-up) 'backward-block-of-lines)
554 (define-key global-map '(control kp-down) 'forward-block-of-lines)
555
556 ;; context-sensitive movement
557 (define-key global-map '(meta left) 'backward-sexp)
558 (define-key global-map '(meta right) 'forward-sexp)
559 (define-key global-map '(meta up) 'backward-paragraph)
560 (define-key global-map '(meta down) 'forward-paragraph)
561 (define-key global-map '(meta control left) 'backward-sentence)
562 (define-key global-map '(meta control right) 'forward-sentence)
563 (define-key global-map '(meta control up) 'scroll-down-one)
564 (define-key global-map '(meta control down) 'scroll-up-one)
565 (define-key global-map '(meta control home) 'beginning-of-defun)
566 (define-key global-map '(meta control end) 'end-of-defun)
567 (define-key global-map '(meta control prior) 'backward-page)
568 (define-key global-map '(meta control next) 'forward-page)
569 (define-key global-map '(meta kp-left) 'backward-sexp)
570 (define-key global-map '(meta kp-right) 'forward-sexp)
571 (define-key global-map '(meta kp-up) 'backward-paragraph)
572 (define-key global-map '(meta kp-down) 'forward-paragraph)
573 (define-key global-map '(meta control kp-left) 'backward-sentence)
574 (define-key global-map '(meta control kp-right) 'forward-sentence)
575 (define-key global-map '(meta control kp-up) 'scroll-down-one)
576 (define-key global-map '(meta control kp-down) 'scroll-up-one)
577 (define-key global-map '(meta control kp-home) 'beginning-of-defun)
578 (define-key global-map '(meta control kp-end) 'end-of-defun)
579 (define-key global-map '(meta control kp-prior) 'backward-page)
580 (define-key global-map '(meta control kp-next) 'forward-page)
581 581
582 ;; movement between windows 582 ;; movement between windows
583 (define-key global-map '(control tab) 'other-window) 583 (define-key global-map '(control tab) 'other-window)
584 (define-key global-map '(control shift tab) 'backward-other-window) 584 (define-key global-map '(control shift tab) 'backward-other-window)
585 585
586 ;; movement in other windows 586 ;; movement in other windows
587 (define-key global-map '(meta next) 'scroll-other-window) 587 (define-key global-map '(meta next) 'scroll-other-window)
588 (define-key global-map '(meta prior) 'scroll-other-window-down) 588 (define-key global-map '(meta prior) 'scroll-other-window-down)
589 (define-key global-map '(meta home) 'beginning-of-buffer-other-window) 589 (define-key global-map '(meta home) 'beginning-of-buffer-other-window)
590 (define-key global-map '(meta end) 'end-of-buffer-other-window) 590 (define-key global-map '(meta end) 'end-of-buffer-other-window)
591 ;; potential R6isms
592 (define-key global-map '(meta kp-next) 'scroll-other-window) 591 (define-key global-map '(meta kp-next) 'scroll-other-window)
593 (define-key global-map '(meta kp-prior) 'scroll-other-window-down) 592 (define-key global-map '(meta kp-prior) 'scroll-other-window-down)
594 (define-key global-map '(meta kp-home) 'beginning-of-buffer-other-window) 593 (define-key global-map '(meta kp-home) 'beginning-of-buffer-other-window)
595 (define-key global-map '(meta kp-end) 'end-of-buffer-other-window) 594 (define-key global-map '(meta kp-end) 'end-of-buffer-other-window)
596 595
597 ;; potential R6isms 596 ;; the infamous delete key
597 (define-key global-map 'delete 'backward-or-forward-delete-char)
598 (define-key global-map '(meta delete) 'backward-or-forward-kill-word)
599 (define-key global-map [(control x) (delete)]
600 'backward-or-forward-kill-sentence)
601 (define-key global-map 'kp-delete 'backward-or-forward-delete-char)
602 (define-key global-map '(meta kp-delete) 'backward-or-forward-kill-word)
603 (define-key global-map [(control x) (kp-delete)]
604 'backward-or-forward-kill-sentence)
605
606 ;; don't try this one at home, kids.
607 (define-key global-map '(control meta delete) 'backward-or-forward-kill-sexp)
608 (define-key global-map '(control meta kp-delete) 'backward-or-forward-kill-sexp)
609 ;; or this one, either, on Linux.
610 (define-key global-map '(control meta backspace) 'backward-kill-sexp)
611
612
613 ;;; Miscellaneous key bindings
614 (define-key global-map 'insert 'overwrite-mode)
615 (define-key global-map 'kp-insert 'overwrite-mode)
616 (define-key global-map 'again 'repeat-complex-command)
598 (define-key global-map 'redo 'repeat-complex-command) 617 (define-key global-map 'redo 'repeat-complex-command)
599 (define-key global-map 'kp-insert 'overwrite-mode)
600 (define-key global-map 'kp-delete 'backward-delete-char-untabify)
601 618
602 (define-key global-map 'kp-enter [return]) ; do whatever RET does now 619 (define-key global-map 'kp-enter [return]) ; do whatever RET does now
603 (define-key global-map 'kp-tab [tab]) 620 (define-key global-map 'kp-tab [tab])
604 621
605 (define-key global-map 'undo 'undo) 622 (define-key global-map 'undo 'undo)