diff options
| author | Stefan Monnier | 2007-10-22 04:42:10 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-10-22 04:42:10 +0000 |
| commit | faeb497761a1aa21ff6a382b12344a77884c18db (patch) | |
| tree | f87d27fed4a7d6400d2725594070cbf8a89896a6 | |
| parent | 7ccc8f7050dc4e56eca827bc79b263b01090edf2 (diff) | |
| download | emacs-faeb497761a1aa21ff6a382b12344a77884c18db.tar.gz emacs-faeb497761a1aa21ff6a382b12344a77884c18db.zip | |
(tpu-edt-old-global-values): New var.
(tpu-edt-off): Use it.
(tpu-edt-on): Set it. Make sure the tpu-global-map is not already on
the global-map before adding it to global-map.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/emulation/tpu-edt.el | 21 |
2 files changed, 19 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b401e6a8c9a..15d2eed13b6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2007-10-22 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2007-10-22 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * emulation/tpu-edt.el (tpu-edt-old-global-values): New var. | ||
| 4 | (tpu-edt-off): Use it. | ||
| 5 | (tpu-edt-on): Set it. Make sure the tpu-global-map is not already on | ||
| 6 | the global-map before adding it to global-map. | ||
| 7 | |||
| 3 | * menu-bar.el (global-buffers-menu-map): New var. | 8 | * menu-bar.el (global-buffers-menu-map): New var. |
| 4 | (global-map, menu-bar-update-buffers): Use it. | 9 | (global-map, menu-bar-update-buffers): Use it. |
| 5 | * msb.el (msb-menu-bar-update-buffers): Use it. | 10 | * msb.el (msb-menu-bar-update-buffers): Use it. |
diff --git a/lisp/emulation/tpu-edt.el b/lisp/emulation/tpu-edt.el index 9220090df25..1379bc43a55 100644 --- a/lisp/emulation/tpu-edt.el +++ b/lisp/emulation/tpu-edt.el | |||
| @@ -273,6 +273,7 @@ | |||
| 273 | 273 | ||
| 274 | ;;; Code: | 274 | ;;; Code: |
| 275 | 275 | ||
| 276 | (eval-when-compile (require 'cl)) | ||
| 276 | ;; we use picture-mode functions | 277 | ;; we use picture-mode functions |
| 277 | (require 'picture) | 278 | (require 'picture) |
| 278 | 279 | ||
| @@ -2435,6 +2436,7 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 2435 | (tpu-error (message "Sorry, couldn't copy - %s." (cdr conditions))))) | 2436 | (tpu-error (message "Sorry, couldn't copy - %s." (cdr conditions))))) |
| 2436 | (kill-buffer "*TPU-Notice*"))) | 2437 | (kill-buffer "*TPU-Notice*"))) |
| 2437 | 2438 | ||
| 2439 | (defvar tpu-edt-old-global-values nil) | ||
| 2438 | 2440 | ||
| 2439 | ;;; | 2441 | ;;; |
| 2440 | ;;; Start and Stop TPU-edt | 2442 | ;;; Start and Stop TPU-edt |
| @@ -2443,6 +2445,8 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 2443 | (defun tpu-edt-on () | 2445 | (defun tpu-edt-on () |
| 2444 | "Turn on TPU/edt emulation." | 2446 | "Turn on TPU/edt emulation." |
| 2445 | (interactive) | 2447 | (interactive) |
| 2448 | ;; To clean things up (and avoid cycles in the global map). | ||
| 2449 | (tpu-edt-off) | ||
| 2446 | ;; First, activate tpu-global-map, while protecting the original keymap. | 2450 | ;; First, activate tpu-global-map, while protecting the original keymap. |
| 2447 | (set-keymap-parent tpu-global-map global-map) | 2451 | (set-keymap-parent tpu-global-map global-map) |
| 2448 | (setq global-map tpu-global-map) | 2452 | (setq global-map tpu-global-map) |
| @@ -2453,9 +2457,12 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 2453 | (tpu-set-mode-line t) | 2457 | (tpu-set-mode-line t) |
| 2454 | (tpu-advance-direction) | 2458 | (tpu-advance-direction) |
| 2455 | ;; set page delimiter, display line truncation, and scrolling like TPU | 2459 | ;; set page delimiter, display line truncation, and scrolling like TPU |
| 2456 | (setq-default page-delimiter "\f") | 2460 | (dolist (varval '((page-delimiter . "\f") |
| 2457 | (setq-default truncate-lines t) | 2461 | (truncate-lines . t) |
| 2458 | (setq scroll-step 1) | 2462 | (scroll-step . 1))) |
| 2463 | (push (cons (car varval) (default-value (car varval))) | ||
| 2464 | tpu-edt-old-global-values) | ||
| 2465 | (set-default (car varval) (cdr varval))) | ||
| 2459 | (tpu-set-control-keys) | 2466 | (tpu-set-control-keys) |
| 2460 | (and window-system (tpu-load-xkeys nil)) | 2467 | (and window-system (tpu-load-xkeys nil)) |
| 2461 | (tpu-arrow-history) | 2468 | (tpu-arrow-history) |
| @@ -2472,9 +2479,9 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 2472 | (tpu-reset-control-keys nil) | 2479 | (tpu-reset-control-keys nil) |
| 2473 | (remove-hook 'post-command-hook 'tpu-search-highlight) | 2480 | (remove-hook 'post-command-hook 'tpu-search-highlight) |
| 2474 | (tpu-set-mode-line nil) | 2481 | (tpu-set-mode-line nil) |
| 2475 | (setq-default page-delimiter "^\f") | 2482 | (while tpu-edt-old-global-values |
| 2476 | (setq-default truncate-lines nil) | 2483 | (let ((varval (pop tpu-edt-old-global-values))) |
| 2477 | (setq scroll-step 0) | 2484 | (set-default (car varval) (cdr varval)))) |
| 2478 | ;; Remove tpu-global-map from the global map. | 2485 | ;; Remove tpu-global-map from the global map. |
| 2479 | (let ((map global-map)) | 2486 | (let ((map global-map)) |
| 2480 | (while map | 2487 | (while map |
| @@ -2482,7 +2489,7 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 2482 | (if (eq tpu-global-map parent) | 2489 | (if (eq tpu-global-map parent) |
| 2483 | (set-keymap-parent map (keymap-parent parent)) | 2490 | (set-keymap-parent map (keymap-parent parent)) |
| 2484 | (setq map parent))))) | 2491 | (setq map parent))))) |
| 2485 | (ad-disable-regexp "\\`tpu-") | 2492 | (ignore-errors (ad-disable-regexp "\\`tpu-")) |
| 2486 | (setq tpu-edt-mode nil)) | 2493 | (setq tpu-edt-mode nil)) |
| 2487 | 2494 | ||
| 2488 | (provide 'tpu-edt) | 2495 | (provide 'tpu-edt) |