diff options
| author | Richard M. Stallman | 1993-08-10 04:17:38 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-08-10 04:17:38 +0000 |
| commit | 09ac6f3b576e90928965ddde415490b22a8e9471 (patch) | |
| tree | d2d3320ac80b8719475971db05f4e956b5a4ab8d | |
| parent | 7fa8a8981fe0cf960e901622fa4acfc7717ced8a (diff) | |
| download | emacs-09ac6f3b576e90928965ddde415490b22a8e9471.tar.gz emacs-09ac6f3b576e90928965ddde415490b22a8e9471.zip | |
(tpu-version): Print version number rather than the RCS revision number.
(tpu-next-file-buffer): Bind starting-buffer with let.
(tpu-load-xkeys): Check value of tpu-xkeys-file.
Make sure to use the "*scratch*" buffer.
(tpu-lm-replace): Changed variable searching-forward
to tpu-searching-forward.
(tpu-substitute): Likewise.
(tpu-toggle-search-direction): Likewise.
(tpu-search-forward, tpu-search-reverse, tpu-set-search): Likewise.
(tpu-search-internal, tpu-adjust-search): Likewise.
| -rw-r--r-- | lisp/emulation/tpu-edt.el | 74 |
1 files changed, 42 insertions, 32 deletions
diff --git a/lisp/emulation/tpu-edt.el b/lisp/emulation/tpu-edt.el index 70492129b28..0e9263d6f02 100644 --- a/lisp/emulation/tpu-edt.el +++ b/lisp/emulation/tpu-edt.el | |||
| @@ -1,9 +1,10 @@ | |||
| 1 | ;;; tpu-edt.el --- Emacs emulating TPU emulating EDT | 1 | ;;; tpu-edt.el --- Emacs emulating TPU emulating EDT |
| 2 | |||
| 2 | ;; Copyright (C) 1993 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1993 Free Software Foundation, Inc. |
| 3 | 4 | ||
| 4 | ;; Author: Rob Riepel <riepel@networking.stanford.edu> | 5 | ;; Author: Rob Riepel <riepel@networking.stanford.edu> |
| 5 | ;; Maintainer: Rob Riepel <riepel@networking.stanford.edu> | 6 | ;; Maintainer: Rob Riepel <riepel@networking.stanford.edu> |
| 6 | ;; Version: 3.0 | 7 | ;; Version: 3.1 |
| 7 | ;; Keywords: tpu edt tpu-edt | 8 | ;; Keywords: tpu edt tpu-edt |
| 8 | 9 | ||
| 9 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| @@ -22,14 +23,14 @@ | |||
| 22 | ;; 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 |
| 23 | ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | 24 | ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
| 24 | 25 | ||
| 26 | ;;; Code: | ||
| 27 | |||
| 25 | 28 | ||
| 26 | ;;; | 29 | ;;; |
| 27 | ;;; Revision Information | 30 | ;;; Revision and Version Information |
| 28 | ;;; | 31 | ;;; |
| 29 | (defconst tpu-revision "$Revision: 6.6 $" | 32 | (defconst tpu-version "3.1" "TPU-edt version number.") |
| 30 | "Revision number of TPU-edt.") | 33 | (defconst tpu-revision "$Revision: 6.10 $" "Revision number of TPU-edt.") |
| 31 | (defconst tpu-revision-date "$Date: 1993/08/01 21:45:31 $" | ||
| 32 | "Date current revision of TPU-edt was created.") | ||
| 33 | 34 | ||
| 34 | 35 | ||
| 35 | ;;; | 36 | ;;; |
| @@ -91,6 +92,7 @@ GOLD is the ASCII 7-bit escape sequence <ESC>OP.") | |||
| 91 | (defvar GOLD-SS3-map (make-sparse-keymap) | 92 | (defvar GOLD-SS3-map (make-sparse-keymap) |
| 92 | "Maps the function keys on the VT100 keyboard preceeded by GOLD-SS3.") | 93 | "Maps the function keys on the VT100 keyboard preceeded by GOLD-SS3.") |
| 93 | 94 | ||
| 95 | (defvar tpu-global-map nil "TPU-edt global keymap.") | ||
| 94 | (defvar tpu-original-global-map (copy-keymap global-map) | 96 | (defvar tpu-original-global-map (copy-keymap global-map) |
| 95 | "Original global keymap.") | 97 | "Original global keymap.") |
| 96 | 98 | ||
| @@ -116,6 +118,8 @@ GOLD is the ASCII 7-bit escape sequence <ESC>OP.") | |||
| 116 | (defvar tpu-last-deleted-char "" | 118 | (defvar tpu-last-deleted-char "" |
| 117 | "Last character deleted by a TPU-edt character-delete command.") | 119 | "Last character deleted by a TPU-edt character-delete command.") |
| 118 | 120 | ||
| 121 | (defvar tpu-searching-forward t | ||
| 122 | "If non-nil, TPU-edt is searching in the forward direction.") | ||
| 119 | (defvar tpu-search-last-string "" | 123 | (defvar tpu-search-last-string "" |
| 120 | "Last text searched for by the TPU-edt search commands.") | 124 | "Last text searched for by the TPU-edt search commands.") |
| 121 | 125 | ||
| @@ -129,6 +133,8 @@ GOLD is the ASCII 7-bit escape sequence <ESC>OP.") | |||
| 129 | "True when TPU-edt is operating in the backward direction.") | 133 | "True when TPU-edt is operating in the backward direction.") |
| 130 | (defvar tpu-control-keys t | 134 | (defvar tpu-control-keys t |
| 131 | "If non-nil, control keys are set to perform TPU functions.") | 135 | "If non-nil, control keys are set to perform TPU functions.") |
| 136 | (defvar tpu-xkeys-file nil | ||
| 137 | "File containing TPU-edt X key map.") | ||
| 132 | 138 | ||
| 133 | (defvar tpu-rectangle-string nil | 139 | (defvar tpu-rectangle-string nil |
| 134 | "Mode line string to identify rectangular mode.") | 140 | "Mode line string to identify rectangular mode.") |
| @@ -312,6 +318,8 @@ current version of emacs." | |||
| 312 | (read-from-minibuffer prompt nil nil nil history-symbol) | 318 | (read-from-minibuffer prompt nil nil nil history-symbol) |
| 313 | (read-string prompt))) | 319 | (read-string prompt))) |
| 314 | 320 | ||
| 321 | (defvar tpu-last-answer nil "Most recent response to tpu-y-or-n-p.") | ||
| 322 | |||
| 315 | (defun tpu-y-or-n-p (prompt &optional not-yes) | 323 | (defun tpu-y-or-n-p (prompt &optional not-yes) |
| 316 | "Prompt for a y or n answer with positive default. | 324 | "Prompt for a y or n answer with positive default. |
| 317 | Optional second argument NOT-YES changes default to negative. | 325 | Optional second argument NOT-YES changes default to negative. |
| @@ -415,11 +423,9 @@ With argument, fill and justify." | |||
| 415 | (defun tpu-version nil | 423 | (defun tpu-version nil |
| 416 | "Print the TPU-edt version number." | 424 | "Print the TPU-edt version number." |
| 417 | (interactive) | 425 | (interactive) |
| 418 | (message (concat "TPU-edt revision " | 426 | (message |
| 419 | (substring tpu-revision 11 -2) | 427 | "TPU-edt version %s by Rob Riepel (riepel@networking.stanford.edu)" |
| 420 | " by Rob Riepel (riepel@networking.stanford.edu) " | 428 | tpu-version)) |
| 421 | (substring tpu-revision-date 12 -11) "/" | ||
| 422 | (substring tpu-revision-date 9 11)))) | ||
| 423 | 429 | ||
| 424 | (defun tpu-reset-screen-size (height width) | 430 | (defun tpu-reset-screen-size (height width) |
| 425 | "Sets the screen size." | 431 | "Sets the screen size." |
| @@ -727,6 +733,8 @@ its ASCII decimal value." | |||
| 727 | ;;; | 733 | ;;; |
| 728 | ;;; Define key | 734 | ;;; Define key |
| 729 | ;;; | 735 | ;;; |
| 736 | (defvar tpu-saved-control-r nil "Saved value of Control-r.") | ||
| 737 | |||
| 730 | (defun tpu-end-define-macro-key (key) | 738 | (defun tpu-end-define-macro-key (key) |
| 731 | "Ends the current macro definition" | 739 | "Ends the current macro definition" |
| 732 | (interactive "kPress the key you want to use to do what was just learned: ") | 740 | (interactive "kPress the key you want to use to do what was just learned: ") |
| @@ -771,12 +779,12 @@ kills modified buffers without asking." | |||
| 771 | (defun tpu-next-file-buffer nil | 779 | (defun tpu-next-file-buffer nil |
| 772 | "Go to next buffer in ring that is visiting a file." | 780 | "Go to next buffer in ring that is visiting a file." |
| 773 | (interactive) | 781 | (interactive) |
| 774 | (setq starting-buffer (buffer-name)) | 782 | (let ((starting-buffer (buffer-name))) |
| 775 | (switch-to-buffer (car (reverse (buffer-list)))) | 783 | (switch-to-buffer (car (reverse (buffer-list)))) |
| 776 | (while (and (not (equal (buffer-name) starting-buffer)) | 784 | (while (and (not (equal (buffer-name) starting-buffer)) |
| 777 | (not (buffer-file-name))) | 785 | (not (buffer-file-name))) |
| 778 | (switch-to-buffer (car (reverse (buffer-list))))) | 786 | (switch-to-buffer (car (reverse (buffer-list))))) |
| 779 | (if (equal (buffer-name) starting-buffer) (error "No other buffers."))) | 787 | (if (equal (buffer-name) starting-buffer) (error "No other buffers.")))) |
| 780 | 788 | ||
| 781 | (defun tpu-next-window nil | 789 | (defun tpu-next-window nil |
| 782 | "Move to the next window." | 790 | "Move to the next window." |
| @@ -821,7 +829,7 @@ The search is performed in the current direction." | |||
| 821 | "Search for a string or regular expression. | 829 | "Search for a string or regular expression. |
| 822 | The search is begins in the forward direction." | 830 | The search is begins in the forward direction." |
| 823 | (interactive) | 831 | (interactive) |
| 824 | (setq searching-forward t) | 832 | (setq tpu-searching-forward t) |
| 825 | (tpu-set-search t) | 833 | (tpu-set-search t) |
| 826 | (tpu-search-internal "")) | 834 | (tpu-search-internal "")) |
| 827 | 835 | ||
| @@ -829,7 +837,7 @@ The search is begins in the forward direction." | |||
| 829 | "Search for a string or regular expression. | 837 | "Search for a string or regular expression. |
| 830 | The search is begins in the reverse direction." | 838 | The search is begins in the reverse direction." |
| 831 | (interactive) | 839 | (interactive) |
| 832 | (setq searching-forward nil) | 840 | (setq tpu-searching-forward nil) |
| 833 | (tpu-set-search t) | 841 | (tpu-set-search t) |
| 834 | (tpu-search-internal "")) | 842 | (tpu-search-internal "")) |
| 835 | 843 | ||
| @@ -853,8 +861,8 @@ The search is performed in the current direction." | |||
| 853 | (defun tpu-set-search (&optional arg) | 861 | (defun tpu-set-search (&optional arg) |
| 854 | "Set the search functions and set the search direction to the current | 862 | "Set the search functions and set the search direction to the current |
| 855 | direction. If an argument is specified, don't set the search direction." | 863 | direction. If an argument is specified, don't set the search direction." |
| 856 | (if (not arg) (setq searching-forward (if tpu-advance t nil))) | 864 | (if (not arg) (setq tpu-searching-forward (if tpu-advance t nil))) |
| 857 | (cond (searching-forward | 865 | (cond (tpu-searching-forward |
| 858 | (cond (tpu-regexp-p | 866 | (cond (tpu-regexp-p |
| 859 | (fset 'tpu-emacs-search 're-search-forward) | 867 | (fset 'tpu-emacs-search 're-search-forward) |
| 860 | (fset 'tpu-emacs-rev-search 're-search-backward)) | 868 | (fset 'tpu-emacs-rev-search 're-search-backward)) |
| @@ -884,7 +892,7 @@ direction. If an argument is specified, don't set the search direction." | |||
| 884 | (tpu-adjust-search t) | 892 | (tpu-adjust-search t) |
| 885 | (let ((found nil) (pos nil)) | 893 | (let ((found nil) (pos nil)) |
| 886 | (save-excursion | 894 | (save-excursion |
| 887 | (let ((searching-forward (not searching-forward))) | 895 | (let ((tpu-searching-forward (not tpu-searching-forward))) |
| 888 | (tpu-adjust-search) | 896 | (tpu-adjust-search) |
| 889 | (setq found (tpu-emacs-rev-search tpu-search-last-string nil t)) | 897 | (setq found (tpu-emacs-rev-search tpu-search-last-string nil t)) |
| 890 | (setq pos (match-beginning 0)))) | 898 | (setq pos (match-beginning 0)))) |
| @@ -892,7 +900,7 @@ direction. If an argument is specified, don't set the search direction." | |||
| 892 | (cond (found | 900 | (cond (found |
| 893 | (cond ((tpu-y-or-n-p | 901 | (cond ((tpu-y-or-n-p |
| 894 | (format "Found in %s direction. Go there? " | 902 | (format "Found in %s direction. Go there? " |
| 895 | (if searching-forward "reverse" "forward"))) | 903 | (if tpu-searching-forward "reverse" "forward"))) |
| 896 | (goto-char pos) (tpu-set-match) | 904 | (goto-char pos) (tpu-set-match) |
| 897 | (tpu-toggle-search-direction)))) | 905 | (tpu-toggle-search-direction)))) |
| 898 | 906 | ||
| @@ -907,7 +915,7 @@ direction. If an argument is specified, don't set the search direction." | |||
| 907 | (defun tpu-adjust-search (&optional arg) | 915 | (defun tpu-adjust-search (&optional arg) |
| 908 | "For forward searches, move forward a character before searching, | 916 | "For forward searches, move forward a character before searching, |
| 909 | and backward a character after a failed search. Arg means end of search." | 917 | and backward a character after a failed search. Arg means end of search." |
| 910 | (if searching-forward | 918 | (if tpu-searching-forward |
| 911 | (cond (arg (if (not (bobp)) (forward-char -1))) | 919 | (cond (arg (if (not (bobp)) (forward-char -1))) |
| 912 | (t (if (not (eobp)) (forward-char 1)))))) | 920 | (t (if (not (eobp)) (forward-char 1)))))) |
| 913 | 921 | ||
| @@ -915,11 +923,11 @@ and backward a character after a failed search. Arg means end of search." | |||
| 915 | "Toggle the TPU-edt search direction. | 923 | "Toggle the TPU-edt search direction. |
| 916 | Used for reversing a search in progress." | 924 | Used for reversing a search in progress." |
| 917 | (interactive) | 925 | (interactive) |
| 918 | (setq searching-forward (not searching-forward)) | 926 | (setq tpu-searching-forward (not tpu-searching-forward)) |
| 919 | (tpu-set-search t) | 927 | (tpu-set-search t) |
| 920 | (and (interactive-p) | 928 | (and (interactive-p) |
| 921 | (message "Searching %sward." | 929 | (message "Searching %sward." |
| 922 | (if searching-forward "for" "back")))) | 930 | (if tpu-searching-forward "for" "back")))) |
| 923 | 931 | ||
| 924 | 932 | ||
| 925 | ;;; | 933 | ;;; |
| @@ -1199,7 +1207,7 @@ A negative argument means replace all occurrences of the search string." | |||
| 1199 | (while (and (not (= num 0)) (or (tpu-mark) (tpu-check-match))) | 1207 | (while (and (not (= num 0)) (or (tpu-mark) (tpu-check-match))) |
| 1200 | (let ((beg (point))) | 1208 | (let ((beg (point))) |
| 1201 | (tpu-replace) | 1209 | (tpu-replace) |
| 1202 | (if searching-forward (forward-char -1) (goto-char beg)) | 1210 | (if tpu-searching-forward (forward-char -1) (goto-char beg)) |
| 1203 | (if (= num 1) (tpu-search-internal tpu-search-last-string) | 1211 | (if (= num 1) (tpu-search-internal tpu-search-last-string) |
| 1204 | (tpu-search-internal-core tpu-search-last-string))) | 1212 | (tpu-search-internal-core tpu-search-last-string))) |
| 1205 | (setq num (1- num)))) | 1213 | (setq num (1- num)))) |
| @@ -1230,7 +1238,7 @@ A negative argument means replace all occurrences of the search string." | |||
| 1230 | (let ((beg (point))) | 1238 | (let ((beg (point))) |
| 1231 | (replace-match to (not case-replace) (not tpu-regexp-p)) | 1239 | (replace-match to (not case-replace) (not tpu-regexp-p)) |
| 1232 | (setq strings (1+ strings)) | 1240 | (setq strings (1+ strings)) |
| 1233 | (if searching-forward (forward-char -1) (goto-char beg))) | 1241 | (if tpu-searching-forward (forward-char -1) (goto-char beg))) |
| 1234 | (tpu-search-internal from t)) | 1242 | (tpu-search-internal from t)) |
| 1235 | 1243 | ||
| 1236 | ((or (= ans ?n) (= ans ?N) (= ans ?\C-?)) | 1244 | ((or (= ans ?n) (= ans ?N) (= ans ?\C-?)) |
| @@ -1241,13 +1249,13 @@ A negative argument means replace all occurrences of the search string." | |||
| 1241 | (let ((beg (point))) | 1249 | (let ((beg (point))) |
| 1242 | (replace-match to (not case-replace) (not tpu-regexp-p)) | 1250 | (replace-match to (not case-replace) (not tpu-regexp-p)) |
| 1243 | (setq strings (1+ strings)) | 1251 | (setq strings (1+ strings)) |
| 1244 | (if searching-forward (forward-char -1) (goto-char beg))) | 1252 | (if tpu-searching-forward (forward-char -1) (goto-char beg))) |
| 1245 | (tpu-search-internal-core from t) | 1253 | (tpu-search-internal-core from t) |
| 1246 | (while (tpu-check-match) | 1254 | (while (tpu-check-match) |
| 1247 | (let ((beg (point))) | 1255 | (let ((beg (point))) |
| 1248 | (replace-match to (not case-replace) (not tpu-regexp-p)) | 1256 | (replace-match to (not case-replace) (not tpu-regexp-p)) |
| 1249 | (setq strings (1+ strings)) | 1257 | (setq strings (1+ strings)) |
| 1250 | (if searching-forward (forward-char -1) (goto-char beg))) | 1258 | (if tpu-searching-forward (forward-char -1) (goto-char beg))) |
| 1251 | (tpu-search-internal-core from t))) | 1259 | (tpu-search-internal-core from t))) |
| 1252 | (setq doit nil)) | 1260 | (setq doit nil)) |
| 1253 | 1261 | ||
| @@ -1255,7 +1263,7 @@ A negative argument means replace all occurrences of the search string." | |||
| 1255 | (let ((beg (point))) | 1263 | (let ((beg (point))) |
| 1256 | (replace-match to (not case-replace) (not tpu-regexp-p)) | 1264 | (replace-match to (not case-replace) (not tpu-regexp-p)) |
| 1257 | (setq strings (1+ strings)) | 1265 | (setq strings (1+ strings)) |
| 1258 | (if searching-forward (forward-char -1) (goto-char beg))) | 1266 | (if tpu-searching-forward (forward-char -1) (goto-char beg))) |
| 1259 | (setq doit nil)) | 1267 | (setq doit nil)) |
| 1260 | 1268 | ||
| 1261 | ((or (= ans ?q) (= ans ?Q)) | 1269 | ((or (= ans ?q) (= ans ?Q)) |
| @@ -2034,7 +2042,7 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 2034 | (interactive "fX key definition file: ") | 2042 | (interactive "fX key definition file: ") |
| 2035 | (cond (file | 2043 | (cond (file |
| 2036 | (setq file (expand-file-name file))) | 2044 | (setq file (expand-file-name file))) |
| 2037 | ((boundp 'tpu-xkeys-file) | 2045 | (tpu-xkeys-file |
| 2038 | (setq file (expand-file-name tpu-xkeys-file))) | 2046 | (setq file (expand-file-name tpu-xkeys-file))) |
| 2039 | (tpu-gnu-emacs19-p | 2047 | (tpu-gnu-emacs19-p |
| 2040 | (setq file (expand-file-name "~/.tpu-gnu-keys"))) | 2048 | (setq file (expand-file-name "~/.tpu-gnu-keys"))) |
| @@ -2043,6 +2051,8 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 2043 | (cond ((file-readable-p file) | 2051 | (cond ((file-readable-p file) |
| 2044 | (load-file file)) | 2052 | (load-file file)) |
| 2045 | (t | 2053 | (t |
| 2054 | (switch-to-buffer "*scratch*") | ||
| 2055 | (erase-buffer) | ||
| 2046 | (insert " | 2056 | (insert " |
| 2047 | 2057 | ||
| 2048 | Ack!! You're running TPU-edt under X-windows without loading an | 2058 | Ack!! You're running TPU-edt under X-windows without loading an |