diff options
| author | Stefan Monnier | 2008-01-04 07:03:47 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-01-04 07:03:47 +0000 |
| commit | db7552d5751acbf9f01648a8a80cc54ed6d598c1 (patch) | |
| tree | bf0b9ff2fe018894384d899e664c93f97a5056c5 | |
| parent | 88a83b17ecb9a1aec1de95401c8d36178f9a1b3e (diff) | |
| download | emacs-db7552d5751acbf9f01648a8a80cc54ed6d598c1.tar.gz emacs-db7552d5751acbf9f01648a8a80cc54ed6d598c1.zip | |
Misc comment and docstring fixes to better follow conventions.
| -rw-r--r-- | lisp/emulation/tpu-edt.el | 134 |
1 files changed, 66 insertions, 68 deletions
diff --git a/lisp/emulation/tpu-edt.el b/lisp/emulation/tpu-edt.el index 4cd8b9e0d62..686a79c9350 100644 --- a/lisp/emulation/tpu-edt.el +++ b/lisp/emulation/tpu-edt.el | |||
| @@ -79,7 +79,7 @@ | |||
| 79 | ;; mark". The mark is set at one end of a selected region; the cursor is | 79 | ;; mark". The mark is set at one end of a selected region; the cursor is |
| 80 | ;; at the other. In cases where the selected region cannot be shown in | 80 | ;; at the other. In cases where the selected region cannot be shown in |
| 81 | ;; inverse video an at sign (@) appears in the mode line when mark is set. | 81 | ;; inverse video an at sign (@) appears in the mode line when mark is set. |
| 82 | ;; The native emacs command ^X^X (Control-X twice) exchanges the cursor | 82 | ;; The native Emacs command ^X^X (Control-X twice) exchanges the cursor |
| 83 | ;; with the mark; this provides a handy way to find the location of the | 83 | ;; with the mark; this provides a handy way to find the location of the |
| 84 | ;; mark. | 84 | ;; mark. |
| 85 | 85 | ||
| @@ -91,8 +91,8 @@ | |||
| 91 | ;; approximation of free mode, see the commentary in tpu-extras.el for | 91 | ;; approximation of free mode, see the commentary in tpu-extras.el for |
| 92 | ;; details. | 92 | ;; details. |
| 93 | 93 | ||
| 94 | ;; Like TPU, emacs uses multiple buffers. Some buffers are used to hold | 94 | ;; Like TPU, Emacs uses multiple buffers. Some buffers are used to hold |
| 95 | ;; files you are editing; other "internal" buffers are used for emacs' own | 95 | ;; files you are editing; other "internal" buffers are used for Emacs' own |
| 96 | ;; purposes (like showing you help). Here are some commands for dealing | 96 | ;; purposes (like showing you help). Here are some commands for dealing |
| 97 | ;; with buffers. | 97 | ;; with buffers. |
| 98 | 98 | ||
| @@ -114,9 +114,9 @@ | |||
| 114 | ;; Note that the buffers associated with deleted windows still exist! | 114 | ;; Note that the buffers associated with deleted windows still exist! |
| 115 | 115 | ||
| 116 | ;; Like TPU, TPU-edt has a "command" function, invoked with Gold-KP7 or | 116 | ;; Like TPU, TPU-edt has a "command" function, invoked with Gold-KP7 or |
| 117 | ;; Do. Most of the commands available are emacs commands. Some TPU | 117 | ;; Do. Most of the commands available are Emacs commands. Some TPU |
| 118 | ;; commands are available, they are: replace, exit, quit, include, and | 118 | ;; commands are available, they are: replace, exit, quit, include, and |
| 119 | ;; Get (unfortunately, "get" is an internal emacs function, so we are | 119 | ;; Get (unfortunately, "get" is an internal Emacs function, so we are |
| 120 | ;; stuck with "Get" - to make life easier, Get is available as Gold-g). | 120 | ;; stuck with "Get" - to make life easier, Get is available as Gold-g). |
| 121 | 121 | ||
| 122 | ;; TPU-edt supports the recall of commands, file names, and search | 122 | ;; TPU-edt supports the recall of commands, file names, and search |
| @@ -127,10 +127,10 @@ | |||
| 127 | ;; a small help file showing the default keypad layout, control key | 127 | ;; a small help file showing the default keypad layout, control key |
| 128 | ;; functions, and Gold key functions. Pressing any key inside of help | 128 | ;; functions, and Gold key functions. Pressing any key inside of help |
| 129 | ;; splits the screen and prints a description of the function of the | 129 | ;; splits the screen and prints a description of the function of the |
| 130 | ;; pressed key. Gold-PF2 invokes the native emacs help, with its | 130 | ;; pressed key. Gold-PF2 invokes the native Emacs help, with its |
| 131 | ;; zillions of options. | 131 | ;; zillions of options. |
| 132 | 132 | ||
| 133 | ;; Thanks to emacs, TPU-edt has some extensions that may make your life | 133 | ;; Thanks to Emacs, TPU-edt has some extensions that may make your life |
| 134 | ;; easier, or at least more interesting. For example, Gold-r toggles | 134 | ;; easier, or at least more interesting. For example, Gold-r toggles |
| 135 | ;; TPU-edt rectangular mode. In rectangular mode, Remove and Insert work | 135 | ;; TPU-edt rectangular mode. In rectangular mode, Remove and Insert work |
| 136 | ;; on rectangles. Likewise, Gold-* toggles TPU-edt regular expression | 136 | ;; on rectangles. Likewise, Gold-* toggles TPU-edt regular expression |
| @@ -146,27 +146,27 @@ | |||
| 146 | ;; twice) on a particular line moves you back to the original window | 146 | ;; twice) on a particular line moves you back to the original window |
| 147 | ;; at that line. Occur is on Gold-o. | 147 | ;; at that line. Occur is on Gold-o. |
| 148 | 148 | ||
| 149 | ;; Finally, as you edit, remember that all the power of emacs is at | 149 | ;; Finally, as you edit, remember that all the power of Emacs is at |
| 150 | ;; your disposal. It really is a fantastic tool. You may even want to | 150 | ;; your disposal. It really is a fantastic tool. You may even want to |
| 151 | ;; take some time and read the emacs tutorial; perhaps not to learn the | 151 | ;; take some time and read the Emacs tutorial; perhaps not to learn the |
| 152 | ;; native emacs key bindings, but to get a feel for all the things | 152 | ;; native Emacs key bindings, but to get a feel for all the things |
| 153 | ;; emacs can do for you. The emacs tutorial is available from the | 153 | ;; Emacs can do for you. The Emacs tutorial is available from the |
| 154 | ;; emacs help function: "Gold-PF2 t" | 154 | ;; Emacs help function: "Gold-PF2 t" |
| 155 | 155 | ||
| 156 | 156 | ||
| 157 | ;; %% Starting TPU-edt | 157 | ;; %% Starting TPU-edt |
| 158 | 158 | ||
| 159 | ;; All you have to do to start TPU-edt, is turn it on. This can be | 159 | ;; All you have to do to start TPU-edt, is turn it on. This can be |
| 160 | ;; done from the command line when running emacs. | 160 | ;; done from the command line when running Emacs. |
| 161 | 161 | ||
| 162 | ;; prompt> emacs -f tpu-edt | 162 | ;; prompt> emacs -f tpu-edt |
| 163 | 163 | ||
| 164 | ;; If you've already started emacs, turn on TPU-edt using the tpu-edt | 164 | ;; If you've already started Emacs, turn on TPU-edt using the tpu-edt |
| 165 | ;; command. First press `M-x' (that's usually `ESC' followed by `x') | 165 | ;; command. First press `M-x' (that's usually `ESC' followed by `x') |
| 166 | ;; and type `tpu-edt' followed by a carriage return. | 166 | ;; and type `tpu-edt' followed by a carriage return. |
| 167 | 167 | ||
| 168 | ;; If you like TPU-edt and want to use it all the time, you can start | 168 | ;; If you like TPU-edt and want to use it all the time, you can start |
| 169 | ;; TPU-edt using the emacs initialization file, .emacs. Simply create | 169 | ;; TPU-edt using the Emacs initialization file, .emacs. Simply create |
| 170 | ;; a .emacs file in your home directory containing the line: | 170 | ;; a .emacs file in your home directory containing the line: |
| 171 | 171 | ||
| 172 | ;; (tpu-edt) | 172 | ;; (tpu-edt) |
| @@ -176,10 +176,10 @@ | |||
| 176 | 176 | ||
| 177 | ;; %% Customizing TPU-edt using the Emacs Initialization File | 177 | ;; %% Customizing TPU-edt using the Emacs Initialization File |
| 178 | 178 | ||
| 179 | ;; The following is a sample emacs initialization file. It shows how to | 179 | ;; The following is a sample Emacs initialization file. It shows how to |
| 180 | ;; invoke TPU-edt, and how to customize it. | 180 | ;; invoke TPU-edt, and how to customize it. |
| 181 | 181 | ||
| 182 | ;; ; .emacs - a sample emacs initialization file | 182 | ;; ; .emacs - a sample Emacs initialization file |
| 183 | 183 | ||
| 184 | ;; ; Turn on TPU-edt | 184 | ;; ; Turn on TPU-edt |
| 185 | ;; (tpu-edt) | 185 | ;; (tpu-edt) |
| @@ -199,12 +199,12 @@ | |||
| 199 | ;; (setq require-final-newline t) | 199 | ;; (setq require-final-newline t) |
| 200 | 200 | ||
| 201 | ;; ; Emacs uses Control-s and Control-q. Problems can occur when using | 201 | ;; ; Emacs uses Control-s and Control-q. Problems can occur when using |
| 202 | ;; ; emacs on terminals that use these codes for flow control (Xon/Xoff | 202 | ;; ; Emacs on terminals that use these codes for flow control (Xon/Xoff |
| 203 | ;; ; flow control). These lines disable emacs' use of these characters. | 203 | ;; ; flow control). These lines disable Emacs' use of these characters. |
| 204 | ;; (global-unset-key "\C-s") | 204 | ;; (global-unset-key "\C-s") |
| 205 | ;; (global-unset-key "\C-q") | 205 | ;; (global-unset-key "\C-q") |
| 206 | 206 | ||
| 207 | ;; ; The emacs universal-argument function is very useful. | 207 | ;; ; The Emacs universal-argument function is very useful. |
| 208 | ;; ; This line maps universal-argument to Gold-PF1. | 208 | ;; ; This line maps universal-argument to Gold-PF1. |
| 209 | ;; (define-key tpu-gold-map [kp_f1] 'universal-argument) ; Gold-PF1 | 209 | ;; (define-key tpu-gold-map [kp_f1] 'universal-argument) ; Gold-PF1 |
| 210 | 210 | ||
| @@ -224,9 +224,9 @@ | |||
| 224 | ;; %% Regular Expressions in TPU-edt | 224 | ;; %% Regular Expressions in TPU-edt |
| 225 | 225 | ||
| 226 | ;; Gold-* toggles TPU-edt regular expression mode. In regular expression | 226 | ;; Gold-* toggles TPU-edt regular expression mode. In regular expression |
| 227 | ;; mode, find, find next, replace, and substitute accept emacs regular | 227 | ;; mode, find, find next, replace, and substitute accept Emacs regular |
| 228 | ;; expressions. A complete list of emacs regular expressions can be found | 228 | ;; expressions. A complete list of Emacs regular expressions can be found |
| 229 | ;; using the emacs "info" command (it's somewhat like the VMS help | 229 | ;; using the Emacs "info" command (it's somewhat like the VMS help |
| 230 | ;; command). Try the following sequence of commands: | 230 | ;; command). Try the following sequence of commands: |
| 231 | 231 | ||
| 232 | ;; DO info <enter info mode> | 232 | ;; DO info <enter info mode> |
| @@ -255,13 +255,13 @@ | |||
| 255 | ;; Gold-^ Add a string at BOL in region or buffer | 255 | ;; Gold-^ Add a string at BOL in region or buffer |
| 256 | ;; Gold-$ Add a string at EOL in region or buffer | 256 | ;; Gold-$ Add a string at EOL in region or buffer |
| 257 | 257 | ||
| 258 | ;; There is also a TPU-edt interface to the native emacs string replacement | 258 | ;; There is also a TPU-edt interface to the native Emacs string replacement |
| 259 | ;; commands. Gold-/ invokes this command. It accepts regular expressions | 259 | ;; commands. Gold-/ invokes this command. It accepts regular expressions |
| 260 | ;; if TPU-edt is in regular expression mode. Given a repeat count, it will | 260 | ;; if TPU-edt is in regular expression mode. Given a repeat count, it will |
| 261 | ;; perform the replacement without prompting for confirmation. | 261 | ;; perform the replacement without prompting for confirmation. |
| 262 | 262 | ||
| 263 | ;; This command replaces empty strings correctly, however, it has its | 263 | ;; This command replaces empty strings correctly, however, it has its |
| 264 | ;; drawbacks. As a native emacs command, it has a different interface | 264 | ;; drawbacks. As a native Emacs command, it has a different interface |
| 265 | ;; than the emulated TPU commands. Also, it works only in the forward | 265 | ;; than the emulated TPU commands. Also, it works only in the forward |
| 266 | ;; direction, regardless of the current TPU-edt direction. | 266 | ;; direction, regardless of the current TPU-edt direction. |
| 267 | 267 | ||
| @@ -291,7 +291,7 @@ | |||
| 291 | ;;; User Configurable Variables | 291 | ;;; User Configurable Variables |
| 292 | ;;; | 292 | ;;; |
| 293 | (defcustom tpu-have-ispell t | 293 | (defcustom tpu-have-ispell t |
| 294 | "If non-nil (default), TPU-edt uses ispell for spell checking." | 294 | "If non-nil (default), TPU-edt uses Ispell for spell checking." |
| 295 | :type 'boolean | 295 | :type 'boolean |
| 296 | :group 'tpu) | 296 | :group 'tpu) |
| 297 | 297 | ||
| @@ -694,15 +694,15 @@ GOLD is the ASCII 7-bit escape sequence <ESC>OP.") | |||
| 694 | (set-marker tpu-match-end-mark nil)) | 694 | (set-marker tpu-match-end-mark nil)) |
| 695 | 695 | ||
| 696 | (defun tpu-match-beginning nil | 696 | (defun tpu-match-beginning nil |
| 697 | "Returns the location of the last match beginning." | 697 | "Return the location of the last match beginning." |
| 698 | (marker-position tpu-match-beginning-mark)) | 698 | (marker-position tpu-match-beginning-mark)) |
| 699 | 699 | ||
| 700 | (defun tpu-match-end nil | 700 | (defun tpu-match-end nil |
| 701 | "Returns the location of the last match end." | 701 | "Return the location of the last match end." |
| 702 | (marker-position tpu-match-end-mark)) | 702 | (marker-position tpu-match-end-mark)) |
| 703 | 703 | ||
| 704 | (defun tpu-check-match nil | 704 | (defun tpu-check-match nil |
| 705 | "Returns t if point is between tpu-match markers. | 705 | "Return t if point is between tpu-match markers. |
| 706 | Otherwise sets the tpu-match markers to nil and returns nil." | 706 | Otherwise sets the tpu-match markers to nil and returns nil." |
| 707 | ;; make sure 1- marker is in this buffer | 707 | ;; make sure 1- marker is in this buffer |
| 708 | ;; 2- point is at or after beginning marker | 708 | ;; 2- point is at or after beginning marker |
| @@ -813,7 +813,7 @@ Top line is 0. Counts each text line only once, even if it wraps." | |||
| 813 | (message "Mark %d set." num)) | 813 | (message "Mark %d set." num)) |
| 814 | 814 | ||
| 815 | (defun tpu-goto-breadcrumb (num) | 815 | (defun tpu-goto-breadcrumb (num) |
| 816 | "Returns to a breadcrumb set with drop-breadcrumb." | 816 | "Return to a breadcrumb set with drop-breadcrumb." |
| 817 | (interactive "p") | 817 | (interactive "p") |
| 818 | (cond ((get tpu-breadcrumb-plist num) | 818 | (cond ((get tpu-breadcrumb-plist num) |
| 819 | (switch-to-buffer (car (get tpu-breadcrumb-plist num))) | 819 | (switch-to-buffer (car (get tpu-breadcrumb-plist num))) |
| @@ -872,7 +872,7 @@ With argument, fill and justify." | |||
| 872 | tpu-version)) | 872 | tpu-version)) |
| 873 | 873 | ||
| 874 | (defun tpu-reset-screen-size (height width) | 874 | (defun tpu-reset-screen-size (height width) |
| 875 | "Sets the screen size." | 875 | "Set the screen size." |
| 876 | (interactive "nnew screen height: \nnnew screen width: ") | 876 | (interactive "nnew screen height: \nnnew screen width: ") |
| 877 | (set-frame-height (selected-frame) height) | 877 | (set-frame-height (selected-frame) height) |
| 878 | (set-frame-width (selected-frame) width)) | 878 | (set-frame-width (selected-frame) width)) |
| @@ -894,8 +894,8 @@ With argument, fill and justify." | |||
| 894 | (if tpu-newline-and-indent-p " and indents." ".")))) | 894 | (if tpu-newline-and-indent-p " and indents." ".")))) |
| 895 | 895 | ||
| 896 | (defun tpu-spell-check nil | 896 | (defun tpu-spell-check nil |
| 897 | "Checks the spelling of the region, or of the entire buffer if no | 897 | "Check the spelling of the region, or of the entire buffer, |
| 898 | region is selected." | 898 | if no region is selected." |
| 899 | (interactive) | 899 | (interactive) |
| 900 | (cond (tpu-have-ispell | 900 | (cond (tpu-have-ispell |
| 901 | (if (tpu-mark) (ispell-region (tpu-mark) (point)) (ispell-buffer))) | 901 | (if (tpu-mark) (ispell-region (tpu-mark) (point)) (ispell-buffer))) |
| @@ -904,7 +904,7 @@ With argument, fill and justify." | |||
| 904 | (if (tpu-mark) (tpu-unselect t))) | 904 | (if (tpu-mark) (tpu-unselect t))) |
| 905 | 905 | ||
| 906 | (defun tpu-toggle-overwrite-mode nil | 906 | (defun tpu-toggle-overwrite-mode nil |
| 907 | "Switches in and out of overwrite mode" | 907 | "Switch in and out of overwrite mode." |
| 908 | (interactive) | 908 | (interactive) |
| 909 | (cond (overwrite-mode | 909 | (cond (overwrite-mode |
| 910 | (tpu-local-set-key "\177" tpu-saved-delete-func) | 910 | (tpu-local-set-key "\177" tpu-saved-delete-func) |
| @@ -915,8 +915,7 @@ With argument, fill and justify." | |||
| 915 | (overwrite-mode 1)))) | 915 | (overwrite-mode 1)))) |
| 916 | 916 | ||
| 917 | (defun tpu-special-insert (num) | 917 | (defun tpu-special-insert (num) |
| 918 | "Insert a character or control code according to | 918 | "Insert a character or control code according to its ASCII decimal value." |
| 919 | its ASCII decimal value." | ||
| 920 | (interactive "P") | 919 | (interactive "P") |
| 921 | (if overwrite-mode (delete-char 1)) | 920 | (if overwrite-mode (delete-char 1)) |
| 922 | (insert (if num num 0))) | 921 | (insert (if num num 0))) |
| @@ -934,19 +933,19 @@ This is useful for inserting control characters." | |||
| 934 | ;;; TPU line-mode commands | 933 | ;;; TPU line-mode commands |
| 935 | ;;; | 934 | ;;; |
| 936 | (defun tpu-include (file) | 935 | (defun tpu-include (file) |
| 937 | "TPU-like include file" | 936 | "TPU-like include file." |
| 938 | (interactive "fInclude file: ") | 937 | (interactive "fInclude file: ") |
| 939 | (insert-file-contents file) | 938 | (insert-file-contents file) |
| 940 | (message "")) | 939 | (message "")) |
| 941 | 940 | ||
| 942 | (defun tpu-get (file) | 941 | (defun tpu-get (file) |
| 943 | "TPU-like get file" | 942 | "TPU-like get file." |
| 944 | (interactive "FFile to get: ") | 943 | (interactive "FFile to get: ") |
| 945 | (find-file file find-file-wildcards)) | 944 | (find-file file find-file-wildcards)) |
| 946 | 945 | ||
| 947 | (defun tpu-what-line nil | 946 | (defun tpu-what-line nil |
| 948 | "Tells what line the point is on, | 947 | "Tell what line the point is on, |
| 949 | and the total number of lines in the buffer." | 948 | and the total number of lines in the buffer." |
| 950 | (interactive) | 949 | (interactive) |
| 951 | (if (eobp) | 950 | (if (eobp) |
| 952 | (message "You are at the End of Buffer. The last line is %d." | 951 | (message "You are at the End of Buffer. The last line is %d." |
| @@ -1215,12 +1214,12 @@ This is useful for inserting control characters." | |||
| 1215 | ;;; Auto-insert | 1214 | ;;; Auto-insert |
| 1216 | ;;; | 1215 | ;;; |
| 1217 | (defun tpu-insert-escape nil | 1216 | (defun tpu-insert-escape nil |
| 1218 | "Inserts an escape character, and so becomes the escape-key alias." | 1217 | "Insert an escape character, and so becomes the escape-key alias." |
| 1219 | (interactive) | 1218 | (interactive) |
| 1220 | (insert "\e")) | 1219 | (insert "\e")) |
| 1221 | 1220 | ||
| 1222 | (defun tpu-insert-formfeed nil | 1221 | (defun tpu-insert-formfeed nil |
| 1223 | "Inserts a formfeed character." | 1222 | "Insert a formfeed character." |
| 1224 | (interactive) | 1223 | (interactive) |
| 1225 | (insert "\C-L")) | 1224 | (insert "\C-L")) |
| 1226 | 1225 | ||
| @@ -1231,7 +1230,7 @@ This is useful for inserting control characters." | |||
| 1231 | (defvar tpu-saved-control-r nil "Saved value of Control-r.") | 1230 | (defvar tpu-saved-control-r nil "Saved value of Control-r.") |
| 1232 | 1231 | ||
| 1233 | (defun tpu-end-define-macro-key (key) | 1232 | (defun tpu-end-define-macro-key (key) |
| 1234 | "Ends the current macro definition" | 1233 | "End the current macro definition." |
| 1235 | (interactive "kPress the key you want to use to do what was just learned: ") | 1234 | (interactive "kPress the key you want to use to do what was just learned: ") |
| 1236 | (end-kbd-macro nil) | 1235 | (end-kbd-macro nil) |
| 1237 | (global-set-key key last-kbd-macro) | 1236 | (global-set-key key last-kbd-macro) |
| @@ -1249,7 +1248,7 @@ This is useful for inserting control characters." | |||
| 1249 | ;;; Buffers and Windows | 1248 | ;;; Buffers and Windows |
| 1250 | ;;; | 1249 | ;;; |
| 1251 | (defun tpu-kill-buffer nil | 1250 | (defun tpu-kill-buffer nil |
| 1252 | "Kills the current buffer. If tpu-kill-buffers-silently is non-nil, | 1251 | "Kill the current buffer. If tpu-kill-buffers-silently is non-nil, |
| 1253 | kills modified buffers without asking." | 1252 | kills modified buffers without asking." |
| 1254 | (interactive) | 1253 | (interactive) |
| 1255 | (if tpu-kill-buffers-silently (set-buffer-modified-p nil)) | 1254 | (if tpu-kill-buffers-silently (set-buffer-modified-p nil)) |
| @@ -1280,7 +1279,7 @@ kills modified buffers without asking." | |||
| 1280 | (switch-to-buffer (car (reverse list))))) | 1279 | (switch-to-buffer (car (reverse list))))) |
| 1281 | 1280 | ||
| 1282 | (defun tpu-make-file-buffer-list (buffer-list) | 1281 | (defun tpu-make-file-buffer-list (buffer-list) |
| 1283 | "Returns names from BUFFER-LIST excluding those beginning with a space or star." | 1282 | "Return names from BUFFER-LIST excluding those beginning with a space or star." |
| 1284 | (delq nil (mapcar '(lambda (b) | 1283 | (delq nil (mapcar '(lambda (b) |
| 1285 | (if (or (= (aref (buffer-name b) 0) ? ) | 1284 | (if (or (= (aref (buffer-name b) 0) ? ) |
| 1286 | (= (aref (buffer-name b) 0) ?*)) nil b)) | 1285 | (= (aref (buffer-name b) 0) ?*)) nil b)) |
| @@ -1303,7 +1302,7 @@ kills modified buffers without asking." | |||
| 1303 | ;;; Search | 1302 | ;;; Search |
| 1304 | ;;; | 1303 | ;;; |
| 1305 | (defun tpu-toggle-regexp nil | 1304 | (defun tpu-toggle-regexp nil |
| 1306 | "Switches in and out of regular expression search and replace mode." | 1305 | "Switch in and out of regular expression search and replace mode." |
| 1307 | (interactive) | 1306 | (interactive) |
| 1308 | (setq tpu-regexp-p (not tpu-regexp-p)) | 1307 | (setq tpu-regexp-p (not tpu-regexp-p)) |
| 1309 | (tpu-set-search) | 1308 | (tpu-set-search) |
| @@ -1369,8 +1368,8 @@ The search is performed in the current direction." | |||
| 1369 | (declare-function tpu-emacs-rev-search "tpu-edt") | 1368 | (declare-function tpu-emacs-rev-search "tpu-edt") |
| 1370 | 1369 | ||
| 1371 | (defun tpu-set-search (&optional arg) | 1370 | (defun tpu-set-search (&optional arg) |
| 1372 | "Set the search functions and set the search direction to the current | 1371 | "Set the search functions and set the search direction to the current direction. |
| 1373 | direction. If an argument is specified, don't set the search direction." | 1372 | If an argument is specified, don't set the search direction." |
| 1374 | (if (not arg) (setq tpu-searching-forward tpu-advance)) | 1373 | (if (not arg) (setq tpu-searching-forward tpu-advance)) |
| 1375 | (cond (tpu-searching-forward | 1374 | (cond (tpu-searching-forward |
| 1376 | (cond (tpu-regexp-p | 1375 | (cond (tpu-regexp-p |
| @@ -1427,7 +1426,7 @@ direction. If an argument is specified, don't set the search direction." | |||
| 1427 | (defalias 'tpu-search-internal-core (symbol-function 'tpu-search-internal)) | 1426 | (defalias 'tpu-search-internal-core (symbol-function 'tpu-search-internal)) |
| 1428 | 1427 | ||
| 1429 | (defun tpu-check-search-case (string) | 1428 | (defun tpu-check-search-case (string) |
| 1430 | "Returns t if string contains upper case." | 1429 | "Return t if string contains upper case." |
| 1431 | ;; if using regexp, eliminate upper case forms (\B \W \S.) | 1430 | ;; if using regexp, eliminate upper case forms (\B \W \S.) |
| 1432 | (if tpu-regexp-p | 1431 | (if tpu-regexp-p |
| 1433 | (let ((pat (copy-sequence string)) (case-fold-search nil) (pos 0)) | 1432 | (let ((pat (copy-sequence string)) (case-fold-search nil) (pos 0)) |
| @@ -1475,7 +1474,7 @@ Used for reversing a search in progress." | |||
| 1475 | ;;; Select / Unselect | 1474 | ;;; Select / Unselect |
| 1476 | ;;; | 1475 | ;;; |
| 1477 | (defun tpu-select (&optional quiet) | 1476 | (defun tpu-select (&optional quiet) |
| 1478 | "Sets the mark to define one end of a region." | 1477 | "Set the mark to define one end of a region." |
| 1479 | (interactive "P") | 1478 | (interactive "P") |
| 1480 | (cond ((tpu-mark) | 1479 | (cond ((tpu-mark) |
| 1481 | (tpu-unselect quiet)) | 1480 | (tpu-unselect quiet)) |
| @@ -1485,7 +1484,7 @@ Used for reversing a search in progress." | |||
| 1485 | (if (not quiet) (message "Move the text cursor to select text."))))) | 1484 | (if (not quiet) (message "Move the text cursor to select text."))))) |
| 1486 | 1485 | ||
| 1487 | (defun tpu-unselect (&optional quiet) | 1486 | (defun tpu-unselect (&optional quiet) |
| 1488 | "Removes the mark to unselect the current region." | 1487 | "Remove the mark to unselect the current region." |
| 1489 | (interactive "P") | 1488 | (interactive "P") |
| 1490 | (deactivate-mark) | 1489 | (deactivate-mark) |
| 1491 | (setq mark-ring nil) | 1490 | (setq mark-ring nil) |
| @@ -1508,8 +1507,7 @@ Used for reversing a search in progress." | |||
| 1508 | (if tpu-rectangular-p "en" "dis")))) | 1507 | (if tpu-rectangular-p "en" "dis")))) |
| 1509 | 1508 | ||
| 1510 | (defun tpu-arrange-rectangle nil | 1509 | (defun tpu-arrange-rectangle nil |
| 1511 | "Adjust point and mark to mark upper left and lower right | 1510 | "Adjust point and mark to upper left and lower right corners of a rectangle." |
| 1512 | corners of a rectangle." | ||
| 1513 | (let ((mc (current-column)) | 1511 | (let ((mc (current-column)) |
| 1514 | (pc (progn (exchange-point-and-mark) (current-column)))) | 1512 | (pc (progn (exchange-point-and-mark) (current-column)))) |
| 1515 | 1513 | ||
| @@ -1574,14 +1572,14 @@ The text is saved for the tpu-paste command." | |||
| 1574 | (tpu-error "No selection active.")))) | 1572 | (tpu-error "No selection active.")))) |
| 1575 | 1573 | ||
| 1576 | (defun tpu-cut (arg) | 1574 | (defun tpu-cut (arg) |
| 1577 | "Copy selected region to the cut buffer. In the absence of an | 1575 | "Copy selected region to the cut buffer. |
| 1578 | argument, delete the selected region too." | 1576 | In the absence of an argument, delete the selected region too." |
| 1579 | (interactive "P") | 1577 | (interactive "P") |
| 1580 | (if arg (tpu-store-text) (tpu-cut-text))) | 1578 | (if arg (tpu-store-text) (tpu-cut-text))) |
| 1581 | 1579 | ||
| 1582 | (defun tpu-append-region (arg) | 1580 | (defun tpu-append-region (arg) |
| 1583 | "Append selected region to the tpu-cut buffer. In the absence of an | 1581 | "Append selected region to the tpu-cut buffer. |
| 1584 | argument, delete the selected region too." | 1582 | In the absence of an argument, delete the selected region too." |
| 1585 | (interactive "P") | 1583 | (interactive "P") |
| 1586 | (cond ((tpu-mark) | 1584 | (cond ((tpu-mark) |
| 1587 | (let ((beg (region-beginning)) (end (region-end))) | 1585 | (let ((beg (region-beginning)) (end (region-end))) |
| @@ -1657,8 +1655,8 @@ They are saved for the TPU-edt undelete-words command." | |||
| 1657 | (delete-region beg (point)))) | 1655 | (delete-region beg (point)))) |
| 1658 | 1656 | ||
| 1659 | (defun tpu-delete-current-char (num) | 1657 | (defun tpu-delete-current-char (num) |
| 1660 | "Delete one or specified number of characters after point. The last | 1658 | "Delete one or specified number of characters after point. |
| 1661 | character deleted is saved for the TPU-edt undelete-char command." | 1659 | The last character deleted is saved for the TPU-edt undelete-char command." |
| 1662 | (interactive "p") | 1660 | (interactive "p") |
| 1663 | (while (and (> num 0) (not (eobp))) | 1661 | (while (and (> num 0) (not (eobp))) |
| 1664 | (setq tpu-last-deleted-char (char-after (point))) | 1662 | (setq tpu-last-deleted-char (char-after (point))) |
| @@ -1741,8 +1739,8 @@ With argument reinserts the character that many times." | |||
| 1741 | (tpu-error "No selection active.")))) | 1739 | (tpu-error "No selection active.")))) |
| 1742 | 1740 | ||
| 1743 | (defun tpu-substitute (num) | 1741 | (defun tpu-substitute (num) |
| 1744 | "Replace the selected region with the contents of the cut buffer, and | 1742 | "Replace the selected region with the contents of the cut buffer, |
| 1745 | repeat most recent search. A numeric argument serves as a repeat count. | 1743 | and repeat most recent search. A numeric argument serves as a repeat count. |
| 1746 | A negative argument means replace all occurrences of the search string." | 1744 | A negative argument means replace all occurrences of the search string." |
| 1747 | (interactive "p") | 1745 | (interactive "p") |
| 1748 | (cond ((or (tpu-mark) (tpu-check-match)) | 1746 | (cond ((or (tpu-mark) (tpu-check-match)) |
| @@ -1819,10 +1817,10 @@ A negative argument means replace all occurrences of the search string." | |||
| 1819 | (message "Replaced %s occurrence%s." strings (if (not (= 1 strings)) "s" "")))) | 1817 | (message "Replaced %s occurrence%s." strings (if (not (= 1 strings)) "s" "")))) |
| 1820 | 1818 | ||
| 1821 | (defun tpu-emacs-replace (&optional dont-ask) | 1819 | (defun tpu-emacs-replace (&optional dont-ask) |
| 1822 | "A TPU-edt interface to the Emacs replace functions. If TPU-edt is | 1820 | "A TPU-edt interface to the Emacs replace functions. |
| 1823 | currently in regular expression mode, the Emacs regular expression | 1821 | If TPU-edt is currently in regular expression mode, the Emacs regular |
| 1824 | replace functions are used. If an argument is supplied, replacements | 1822 | expression replace functions are used. If an argument is supplied, |
| 1825 | are performed without asking. Only works in forward direction." | 1823 | replacements are performed without asking. Only works in forward direction." |
| 1826 | (interactive "P") | 1824 | (interactive "P") |
| 1827 | (cond (dont-ask | 1825 | (cond (dont-ask |
| 1828 | (setq current-prefix-arg nil) | 1826 | (setq current-prefix-arg nil) |
| @@ -1871,7 +1869,7 @@ or each line of the entire buffer if no region is selected." | |||
| 1871 | (end-of-line) (insert text) (forward-line)))))) | 1869 | (end-of-line) (insert text) (forward-line)))))) |
| 1872 | 1870 | ||
| 1873 | (defun tpu-trim-line-ends nil | 1871 | (defun tpu-trim-line-ends nil |
| 1874 | "Removes trailing whitespace from every line in the buffer." | 1872 | "Remove trailing whitespace from every line in the buffer." |
| 1875 | (interactive) | 1873 | (interactive) |
| 1876 | (save-match-data | 1874 | (save-match-data |
| 1877 | (save-excursion | 1875 | (save-excursion |
| @@ -2273,7 +2271,7 @@ Accepts a prefix argument for the number of tpu-pan-columns to scroll." | |||
| 2273 | (setq tpu-control-keys tpu-style))) | 2271 | (setq tpu-control-keys tpu-style))) |
| 2274 | 2272 | ||
| 2275 | (defun tpu-toggle-control-keys nil | 2273 | (defun tpu-toggle-control-keys nil |
| 2276 | "Toggles control key bindings between TPU-edt and Emacs." | 2274 | "Toggle control key bindings between TPU-edt and Emacs." |
| 2277 | (interactive) | 2275 | (interactive) |
| 2278 | (tpu-reset-control-keys (not tpu-control-keys)) | 2276 | (tpu-reset-control-keys (not tpu-control-keys)) |
| 2279 | (and (interactive-p) | 2277 | (and (interactive-p) |
| @@ -2324,7 +2322,7 @@ Accepts a prefix argument for the number of tpu-pan-columns to scroll." | |||
| 2324 | (defun tpu-load-xkeys (file) | 2322 | (defun tpu-load-xkeys (file) |
| 2325 | "Load the TPU-edt X-windows key definitions FILE. | 2323 | "Load the TPU-edt X-windows key definitions FILE. |
| 2326 | If FILE is nil, try to load a default file. The default file names are | 2324 | If FILE is nil, try to load a default file. The default file names are |
| 2327 | `~/.tpu-lucid-keys' for Lucid emacs, and `~/.tpu-keys' for Emacs." | 2325 | `~/.tpu-lucid-keys' for XEmacs, and `~/.tpu-keys' for Emacs." |
| 2328 | (interactive "fX key definition file: ") | 2326 | (interactive "fX key definition file: ") |
| 2329 | (cond (file | 2327 | (cond (file |
| 2330 | (setq file (expand-file-name file))) | 2328 | (setq file (expand-file-name file))) |