diff options
| author | Miles Bader | 2007-05-20 23:29:14 +0000 |
|---|---|---|
| committer | Miles Bader | 2007-05-20 23:29:14 +0000 |
| commit | 7be1c21aedb2f8e7b7831d494e065a31afe13146 (patch) | |
| tree | a998f949002bf05307fe6b59969e6ebfb0c88b8d /lisp/emulation | |
| parent | 3c28868aeb2d445830019837294e96f432456754 (diff) | |
| parent | 26114bc08f03789f30f0acca925955f2139df690 (diff) | |
| download | emacs-7be1c21aedb2f8e7b7831d494e065a31afe13146.tar.gz emacs-7be1c21aedb2f8e7b7831d494e065a31afe13146.zip | |
Merged from emacs--devo--0
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-744
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-745
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-746
Merge from emacs--rel--22
* emacs@sv.gnu.org/emacs--devo--0--patch-747
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-748
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-749
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-750
Merge from emacs--rel--22
* emacs@sv.gnu.org/emacs--devo--0--patch-751
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-752
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-753
Merge from emacs--rel--22
* emacs@sv.gnu.org/emacs--devo--0--patch-754
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-755
Merge from emacs--rel--22
* emacs@sv.gnu.org/emacs--devo--0--patch-756
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-757
Update from CVS: lisp/textmodes/sgml-mode.el: Revert last change.
* emacs@sv.gnu.org/emacs--devo--0--patch-758
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-759
Merge from emacs--rel--22
* emacs@sv.gnu.org/emacs--devo--0--patch-760
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-761
Update from CVS
* emacs@sv.gnu.org/emacs--rel--22--patch-14
Update from CVS
* emacs@sv.gnu.org/emacs--rel--22--patch-15
Update from CVS
* emacs@sv.gnu.org/emacs--rel--22--patch-16
Update from CVS: src/xterm.c (XTread_socket): Revert last change.
* emacs@sv.gnu.org/emacs--rel--22--patch-17
Update from CVS
* emacs@sv.gnu.org/emacs--rel--22--patch-18
Update from CVS
* emacs@sv.gnu.org/emacs--rel--22--patch-19
Update from CVS
* emacs@sv.gnu.org/emacs--rel--22--patch-20
Update from CVS
* emacs@sv.gnu.org/emacs--rel--22--patch-21
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-221
Update from CVS
Revision: emacs@sv.gnu.org/emacs--multi-tty--0--patch-12
Creator: Karoly Lorentey <karoly@lorentey.hu>
Diffstat (limited to 'lisp/emulation')
| -rw-r--r-- | lisp/emulation/tpu-edt.el | 104 |
1 files changed, 58 insertions, 46 deletions
diff --git a/lisp/emulation/tpu-edt.el b/lisp/emulation/tpu-edt.el index f6e00cbbea6..8d65a267c4e 100644 --- a/lisp/emulation/tpu-edt.el +++ b/lisp/emulation/tpu-edt.el | |||
| @@ -584,9 +584,12 @@ GOLD is the ASCII 7-bit escape sequence <ESC>OP.") | |||
| 584 | "Maps the SS3 function keys on the VT100 keyboard. | 584 | "Maps the SS3 function keys on the VT100 keyboard. |
| 585 | SS3 is DEC's name for the sequence <ESC>O.") | 585 | SS3 is DEC's name for the sequence <ESC>O.") |
| 586 | 586 | ||
| 587 | (defvar tpu-global-map nil "TPU-edt global keymap.") | 587 | (defvar tpu-global-map |
| 588 | (defvar tpu-original-global-map global-map | 588 | (let ((map (make-sparse-keymap))) |
| 589 | "Original non-TPU global keymap.") | 589 | (define-key map "\e[" CSI-map) |
| 590 | (define-key map "\eO" SS3-map) | ||
| 591 | map) | ||
| 592 | "TPU-edt global keymap.") | ||
| 590 | 593 | ||
| 591 | (and (not (boundp 'minibuffer-local-ns-map)) | 594 | (and (not (boundp 'minibuffer-local-ns-map)) |
| 592 | (defvar minibuffer-local-ns-map (make-sparse-keymap) | 595 | (defvar minibuffer-local-ns-map (make-sparse-keymap) |
| @@ -2267,46 +2270,43 @@ Accepts a prefix argument for the number of tpu-pan-columns to scroll." | |||
| 2267 | ;;; | 2270 | ;;; |
| 2268 | ;;; Functions to set, reset, and toggle the control key bindings | 2271 | ;;; Functions to set, reset, and toggle the control key bindings |
| 2269 | ;;; | 2272 | ;;; |
| 2270 | (defun tpu-set-control-keys nil | 2273 | |
| 2274 | (defvar tpu-control-keys-map | ||
| 2275 | (let ((map (make-sparse-keymap))) | ||
| 2276 | (define-key map "\C-\\" 'quoted-insert) ; ^\ | ||
| 2277 | (define-key map "\C-a" 'tpu-toggle-overwrite-mode) ; ^A | ||
| 2278 | (define-key map "\C-b" 'repeat-complex-command) ; ^B | ||
| 2279 | (define-key map "\C-e" 'tpu-current-end-of-line) ; ^E | ||
| 2280 | (define-key map "\C-h" 'tpu-next-beginning-of-line) ; ^H (BS) | ||
| 2281 | (define-key map "\C-j" 'tpu-delete-previous-word) ; ^J (LF) | ||
| 2282 | (define-key map "\C-k" 'tpu-define-macro-key) ; ^K | ||
| 2283 | (define-key map "\C-l" 'tpu-insert-formfeed) ; ^L (FF) | ||
| 2284 | (define-key map "\C-r" 'recenter) ; ^R | ||
| 2285 | (define-key map "\C-u" 'tpu-delete-to-bol) ; ^U | ||
| 2286 | (define-key map "\C-v" 'tpu-quoted-insert) ; ^V | ||
| 2287 | (define-key map "\C-w" 'redraw-display) ; ^W | ||
| 2288 | (define-key map "\C-z" 'tpu-exit) ; ^Z | ||
| 2289 | map)) | ||
| 2290 | |||
| 2291 | (defun tpu-set-control-keys () | ||
| 2271 | "Set control keys to TPU style functions." | 2292 | "Set control keys to TPU style functions." |
| 2272 | (define-key global-map "\C-\\" 'quoted-insert) ; ^\ | 2293 | (tpu-reset-control-keys 'tpu)) |
| 2273 | (define-key global-map "\C-a" 'tpu-toggle-overwrite-mode) ; ^A | ||
| 2274 | (define-key global-map "\C-b" 'repeat-complex-command) ; ^B | ||
| 2275 | (define-key global-map "\C-e" 'tpu-current-end-of-line) ; ^E | ||
| 2276 | (define-key global-map "\C-h" 'tpu-next-beginning-of-line) ; ^H (BS) | ||
| 2277 | (define-key global-map "\C-j" 'tpu-delete-previous-word) ; ^J (LF) | ||
| 2278 | (define-key global-map "\C-k" 'tpu-define-macro-key) ; ^K | ||
| 2279 | (define-key global-map "\C-l" 'tpu-insert-formfeed) ; ^L (FF) | ||
| 2280 | (define-key global-map "\C-r" 'recenter) ; ^R | ||
| 2281 | (define-key global-map "\C-u" 'tpu-delete-to-bol) ; ^U | ||
| 2282 | (define-key global-map "\C-v" 'tpu-quoted-insert) ; ^V | ||
| 2283 | (define-key global-map "\C-w" 'redraw-display) ; ^W | ||
| 2284 | (define-key global-map "\C-z" 'tpu-exit) ; ^Z | ||
| 2285 | (setq tpu-control-keys t)) | ||
| 2286 | 2294 | ||
| 2287 | (defun tpu-reset-control-keys (tpu-style) | 2295 | (defun tpu-reset-control-keys (tpu-style) |
| 2288 | "Set control keys to TPU or Emacs style functions." | 2296 | "Set control keys to TPU or Emacs style functions." |
| 2289 | (let* ((tpu (and tpu-style (not tpu-control-keys))) | 2297 | (let ((parent (keymap-parent tpu-global-map))) |
| 2290 | (emacs (and (not tpu-style) tpu-control-keys)) | 2298 | (if tpu-style |
| 2291 | (doit (or tpu emacs))) | 2299 | (if (eq parent tpu-control-keys-map) |
| 2292 | (cond (doit | 2300 | nil ;All done already. |
| 2293 | (if emacs (setq tpu-global-map (copy-keymap global-map))) | 2301 | ;; Insert tpu-control-keys-map in the global map. |
| 2294 | (let ((map (if tpu tpu-global-map tpu-original-global-map))) | 2302 | (set-keymap-parent tpu-control-keys-map parent) |
| 2295 | 2303 | (set-keymap-parent tpu-global-map tpu-control-keys-map)) | |
| 2296 | (define-key global-map "\C-\\" (lookup-key map "\C-\\")) ; ^\ | 2304 | (if (not (eq parent tpu-control-keys-map)) |
| 2297 | (define-key global-map "\C-a" (lookup-key map "\C-a")) ; ^A | 2305 | nil ;All done already. |
| 2298 | (define-key global-map "\C-b" (lookup-key map "\C-b")) ; ^B | 2306 | ;; Remove tpu-control-keys-map from the global map. |
| 2299 | (define-key global-map "\C-e" (lookup-key map "\C-e")) ; ^E | 2307 | (set-keymap-parent tpu-global-map (keymap-parent parent)) |
| 2300 | (define-key global-map "\C-h" (lookup-key map "\C-h")) ; ^H (BS) | 2308 | (set-keymap-parent tpu-control-keys-map nil))) |
| 2301 | (define-key global-map "\C-j" (lookup-key map "\C-j")) ; ^J (LF) | 2309 | (setq tpu-control-keys tpu-style))) |
| 2302 | (define-key global-map "\C-k" (lookup-key map "\C-k")) ; ^K | ||
| 2303 | (define-key global-map "\C-l" (lookup-key map "\C-l")) ; ^L (FF) | ||
| 2304 | (define-key global-map "\C-r" (lookup-key map "\C-r")) ; ^R | ||
| 2305 | (define-key global-map "\C-u" (lookup-key map "\C-u")) ; ^U | ||
| 2306 | (define-key global-map "\C-v" (lookup-key map "\C-v")) ; ^V | ||
| 2307 | (define-key global-map "\C-w" (lookup-key map "\C-w")) ; ^W | ||
| 2308 | (define-key global-map "\C-z" (lookup-key map "\C-z")) ; ^Z | ||
| 2309 | (setq tpu-control-keys tpu-style)))))) | ||
| 2310 | 2310 | ||
| 2311 | (defun tpu-toggle-control-keys nil | 2311 | (defun tpu-toggle-control-keys nil |
| 2312 | "Toggles control key bindings between TPU-edt and Emacs." | 2312 | "Toggles control key bindings between TPU-edt and Emacs." |
| @@ -2447,8 +2447,11 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 2447 | (defun tpu-edt-on () | 2447 | (defun tpu-edt-on () |
| 2448 | "Turn on TPU/edt emulation." | 2448 | "Turn on TPU/edt emulation." |
| 2449 | (interactive) | 2449 | (interactive) |
| 2450 | (and window-system (tpu-load-xkeys nil)) | 2450 | ;; First, activate tpu-global-map, while protecting the original keymap. |
| 2451 | (tpu-arrow-history) | 2451 | (set-keymap-parent tpu-global-map global-map) |
| 2452 | (setq global-map tpu-global-map) | ||
| 2453 | (use-global-map global-map) | ||
| 2454 | ;; Then do the normal TPU setup. | ||
| 2452 | (transient-mark-mode t) | 2455 | (transient-mark-mode t) |
| 2453 | (add-hook 'post-command-hook 'tpu-search-highlight) | 2456 | (add-hook 'post-command-hook 'tpu-search-highlight) |
| 2454 | (tpu-set-mode-line t) | 2457 | (tpu-set-mode-line t) |
| @@ -2457,10 +2460,14 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 2457 | (setq-default page-delimiter "\f") | 2460 | (setq-default page-delimiter "\f") |
| 2458 | (setq-default truncate-lines t) | 2461 | (setq-default truncate-lines t) |
| 2459 | (setq scroll-step 1) | 2462 | (setq scroll-step 1) |
| 2460 | (setq global-map (copy-keymap global-map)) | ||
| 2461 | (tpu-set-control-keys) | 2463 | (tpu-set-control-keys) |
| 2462 | (define-key global-map "\e[" CSI-map) | 2464 | (and window-system (tpu-load-xkeys nil)) |
| 2463 | (define-key global-map "\eO" SS3-map) | 2465 | (tpu-arrow-history) |
| 2466 | ;; Then protect tpu-global-map from user modifications. | ||
| 2467 | (let ((map (make-sparse-keymap))) | ||
| 2468 | (set-keymap-parent map global-map) | ||
| 2469 | (setq global-map map) | ||
| 2470 | (use-global-map map)) | ||
| 2464 | (setq tpu-edt-mode t)) | 2471 | (setq tpu-edt-mode t)) |
| 2465 | 2472 | ||
| 2466 | (defun tpu-edt-off () | 2473 | (defun tpu-edt-off () |
| @@ -2472,8 +2479,13 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 2472 | (setq-default page-delimiter "^\f") | 2479 | (setq-default page-delimiter "^\f") |
| 2473 | (setq-default truncate-lines nil) | 2480 | (setq-default truncate-lines nil) |
| 2474 | (setq scroll-step 0) | 2481 | (setq scroll-step 0) |
| 2475 | (setq global-map tpu-original-global-map) | 2482 | ;; Remove tpu-global-map from the global map. |
| 2476 | (use-global-map global-map) | 2483 | (let ((map global-map)) |
| 2484 | (while map | ||
| 2485 | (let ((parent (keymap-parent map))) | ||
| 2486 | (if (eq tpu-global-map parent) | ||
| 2487 | (set-keymap-parent map (keymap-parent parent)) | ||
| 2488 | (setq map parent))))) | ||
| 2477 | (setq tpu-edt-mode nil)) | 2489 | (setq tpu-edt-mode nil)) |
| 2478 | 2490 | ||
| 2479 | (provide 'tpu-edt) | 2491 | (provide 'tpu-edt) |