Mercurial > emacs
comparison lisp/emulation/tpu-edt.el @ 7982:267ab8286077
(tpu-edt-off): Restore original global key map.
(tpu-next-file-buffer): Move to dired buffer too.
(tpu-make-file-buffer-list): New function.
(tpu-version): New version.
(tpu-set-mode-line): Added line-number-mode to mode-line.
(tpu-search-forward-exit, tpu-search-backward-exit): New functions,
key mappings.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 20 Jun 1994 22:22:40 +0000 |
parents | bdc1c93a09db |
children | ad36865ac28e |
comparison
equal
deleted
inserted
replaced
7981:54e029bb5894 | 7982:267ab8286077 |
---|---|
1 ;;; tpu-edt.el --- Emacs emulating TPU emulating EDT | 1 ;;; tpu-edt.el --- Emacs emulating TPU emulating EDT |
2 | 2 |
3 ;; Copyright (C) 1993 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: Rob Riepel <riepel@networking.stanford.edu> | 5 ;; Author: Rob Riepel <riepel@networking.stanford.edu> |
6 ;; Maintainer: Rob Riepel <riepel@networking.stanford.edu> | 6 ;; Maintainer: Rob Riepel <riepel@networking.stanford.edu> |
7 ;; Version: 3.2 | 7 ;; Version: 4.0 |
8 ;; Keywords: emulations | 8 ;; Keywords: emulations |
9 | 9 |
10 ;; This file is part of GNU Emacs. | 10 ;; This file is part of GNU Emacs. |
11 | 11 |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | 12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
21 | 21 |
22 ;; You should have received a copy of the GNU General Public License | 22 ;; You should have received a copy of the GNU General Public License |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to | 23 ;; along with GNU Emacs; see the file COPYING. If not, write to |
24 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | 24 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
25 | 25 |
26 ;; TPU-edt is based on tpu.el by Jeff Kowalski and Bob Covey. | |
27 | |
26 ;;; Code: | 28 ;;; Code: |
27 | 29 |
28 | 30 |
29 ;;; | 31 ;;; |
30 ;;; Revision and Version Information | 32 ;;; Version Information |
31 ;;; | 33 ;;; |
32 (defconst tpu-version "3.2" "TPU-edt version number.") | 34 (defconst tpu-version "4.0" "TPU-edt version number.") |
33 | 35 |
34 | 36 |
35 ;;; | 37 ;;; |
36 ;;; User Configurable Variables | 38 ;;; User Configurable Variables |
37 ;;; | 39 ;;; |
194 (purecopy " ") | 196 (purecopy " ") |
195 'global-mode-string | 197 'global-mode-string |
196 (purecopy " ") | 198 (purecopy " ") |
197 'tpu-mark-flag | 199 'tpu-mark-flag |
198 (purecopy " %[(") | 200 (purecopy " %[(") |
199 'mode-name 'mode-line-process 'minor-mode-alist "%n" | 201 'mode-name 'mode-line-process 'minor-mode-alist |
200 (purecopy ")%]----") | 202 (purecopy "%n") |
203 (purecopy ")%]--") | |
204 (purecopy '(line-number-mode "L%l--")) | |
201 (purecopy '(-3 . "%p")) | 205 (purecopy '(-3 . "%p")) |
202 (purecopy "-%-"))) | 206 (purecopy "-%-"))) |
203 (or (assq 'tpu-newline-and-indent-p minor-mode-alist) | 207 (or (assq 'tpu-newline-and-indent-p minor-mode-alist) |
204 (setq minor-mode-alist | 208 (setq minor-mode-alist |
205 (cons '(tpu-newline-and-indent-p | 209 (cons '(tpu-newline-and-indent-p |
797 "Go to next buffer in ring." | 801 "Go to next buffer in ring." |
798 (interactive) | 802 (interactive) |
799 (switch-to-buffer (car (reverse (buffer-list))))) | 803 (switch-to-buffer (car (reverse (buffer-list))))) |
800 | 804 |
801 (defun tpu-next-file-buffer nil | 805 (defun tpu-next-file-buffer nil |
802 "Go to next buffer in ring that is visiting a file." | 806 "Go to next buffer in ring that is visiting a file or directory." |
803 (interactive) | 807 (interactive) |
804 (let ((starting-buffer (buffer-name))) | 808 (let ((list (tpu-make-file-buffer-list (buffer-list)))) |
805 (switch-to-buffer (car (reverse (buffer-list)))) | 809 (setq list (delq (current-buffer) list)) |
806 (while (and (not (equal (buffer-name) starting-buffer)) | 810 (if (not list) (error "No other buffers.")) |
807 (not (buffer-file-name))) | 811 (switch-to-buffer (car (reverse list))))) |
808 (switch-to-buffer (car (reverse (buffer-list))))) | 812 |
809 (if (equal (buffer-name) starting-buffer) (error "No other buffers.")))) | 813 (defun tpu-make-file-buffer-list (buffer-list) |
814 "Returns names from BUFFER-LIST excluding those beginning with a space or star." | |
815 (delq nil (mapcar '(lambda (b) | |
816 (if (or (= (aref (buffer-name b) 0) ? ) | |
817 (= (aref (buffer-name b) 0) ?*)) nil b)) | |
818 buffer-list))) | |
810 | 819 |
811 (defun tpu-next-window nil | 820 (defun tpu-next-window nil |
812 "Move to the next window." | 821 "Move to the next window." |
813 (interactive) | 822 (interactive) |
814 (if (one-window-p) (message "There is only one window on screen.") | 823 (if (one-window-p) (message "There is only one window on screen.") |
873 ;; search function. It should be called whenever the direction changes, or | 882 ;; search function. It should be called whenever the direction changes, or |
874 ;; the regular expression mode is turned on or off. It can also be called | 883 ;; the regular expression mode is turned on or off. It can also be called |
875 ;; to ensure that the next search will be in the current direction. It is | 884 ;; to ensure that the next search will be in the current direction. It is |
876 ;; called from: | 885 ;; called from: |
877 | 886 |
878 ;; tpu-advance tpu-backup | 887 ;; tpu-advance tpu-backup |
879 ;; tpu-toggle-regexp tpu-toggle-search-direction (t) | 888 ;; tpu-toggle-regexp tpu-toggle-search-direction (t) |
880 ;; tpu-search tpu-lm-replace | 889 ;; tpu-search tpu-lm-replace |
881 ;; tpu-search-forward (t) tpu-search-reverse (t) | 890 ;; tpu-search-forward (t) tpu-search-reverse (t) |
891 ;; tpu-search-forward-exit (t) tpu-search-backward-exit (t) | |
882 | 892 |
883 (defun tpu-set-search (&optional arg) | 893 (defun tpu-set-search (&optional arg) |
884 "Set the search functions and set the search direction to the current | 894 "Set the search functions and set the search direction to the current |
885 direction. If an argument is specified, don't set the search direction." | 895 direction. If an argument is specified, don't set the search direction." |
886 (if (not arg) (setq tpu-searching-forward (if tpu-advance t nil))) | 896 (if (not arg) (setq tpu-searching-forward (if tpu-advance t nil))) |
949 (tpu-set-search t) | 959 (tpu-set-search t) |
950 (and (interactive-p) | 960 (and (interactive-p) |
951 (message "Searching %sward." | 961 (message "Searching %sward." |
952 (if tpu-searching-forward "for" "back")))) | 962 (if tpu-searching-forward "for" "back")))) |
953 | 963 |
964 (defun tpu-search-forward-exit nil | |
965 "Set search direction forward and exit minibuffer." | |
966 (interactive) | |
967 (setq tpu-searching-forward t) | |
968 (tpu-set-search t) | |
969 (exit-minibuffer)) | |
970 | |
971 (defun tpu-search-backward-exit nil | |
972 "Set search direction backward and exit minibuffer." | |
973 (interactive) | |
974 (setq tpu-searching-forward nil) | |
975 (tpu-set-search t) | |
976 (exit-minibuffer)) | |
977 | |
954 | 978 |
955 ;;; | 979 ;;; |
956 ;;; Select / Unselect | 980 ;;; Select / Unselect |
957 ;;; | 981 ;;; |
958 (defun tpu-select (&optional quiet) | 982 (defun tpu-select (&optional quiet) |
991 "Adjust point and mark to mark upper left and lower right | 1015 "Adjust point and mark to mark upper left and lower right |
992 corners of a rectangle." | 1016 corners of a rectangle." |
993 (let ((mc (current-column)) | 1017 (let ((mc (current-column)) |
994 (pc (progn (exchange-point-and-mark) (current-column)))) | 1018 (pc (progn (exchange-point-and-mark) (current-column)))) |
995 | 1019 |
996 (cond ((> (point) (tpu-mark)) ; point on lower line | 1020 (cond ((> (point) (tpu-mark)) ; point on lower line |
997 (cond ((> pc mc) ; point @ lower-right | 1021 (cond ((> pc mc) ; point @ lower-right |
998 (exchange-point-and-mark)) ; point -> upper-left | 1022 (exchange-point-and-mark)) ; point -> upper-left |
999 | 1023 |
1000 (t ; point @ lower-left | 1024 (t ; point @ lower-left |
1001 (move-to-column-force mc) ; point -> lower-right | 1025 (move-to-column-force mc) ; point -> lower-right |
1958 (and (boundp 'repeat-complex-command-map) | 1982 (and (boundp 'repeat-complex-command-map) |
1959 (define-key repeat-complex-command-map "\eOM" 'exit-minibuffer)) | 1983 (define-key repeat-complex-command-map "\eOM" 'exit-minibuffer)) |
1960 | 1984 |
1961 | 1985 |
1962 ;;; | 1986 ;;; |
1987 ;;; Minibuffer map additions to set search direction | |
1988 ;;; | |
1989 (define-key minibuffer-local-map "\eOt" 'tpu-search-forward-exit) | |
1990 (define-key minibuffer-local-map "\eOu" 'tpu-search-backward-exit) | |
1991 | |
1992 | |
1993 ;;; | |
1963 ;;; Map control keys | 1994 ;;; Map control keys |
1964 ;;; | 1995 ;;; |
1965 (define-key global-map "\C-\\" 'quoted-insert) ; ^\ | 1996 (define-key global-map "\C-\\" 'quoted-insert) ; ^\ |
1966 (define-key global-map "\C-a" 'tpu-toggle-overwrite-mode) ; ^A | 1997 (define-key global-map "\C-a" 'tpu-toggle-overwrite-mode) ; ^A |
1967 (define-key global-map "\C-b" 'repeat-complex-command) ; ^B | 1998 (define-key global-map "\C-b" 'repeat-complex-command) ; ^B |
2138 (tpu-reset-control-keys nil) | 2169 (tpu-reset-control-keys nil) |
2139 (tpu-set-mode-line nil) | 2170 (tpu-set-mode-line nil) |
2140 (setq-default page-delimiter "^\f") | 2171 (setq-default page-delimiter "^\f") |
2141 (setq-default truncate-lines nil) | 2172 (setq-default truncate-lines nil) |
2142 (setq scroll-step 0) | 2173 (setq scroll-step 0) |
2174 (setq global-map (copy-keymap tpu-original-global-map)) | |
2143 (use-global-map global-map) | 2175 (use-global-map global-map) |
2144 (setq tpu-edt-mode nil)))) | 2176 (setq tpu-edt-mode nil)))) |
2145 | 2177 |
2146 | 2178 |
2147 ;;; | 2179 ;;; |