diff options
author | Miles Bader <miles@gnu.org> | 2000-10-19 04:21:09 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 2000-10-19 04:21:09 +0000 |
commit | 0da5c14acdea6faa69328149aa6dcdeff22a2fb4 (patch) | |
tree | 1a868517f803b982254212fe657de5c12194c996 /lisp/comint.el | |
parent | e40a778f54f5558c874153ac0d5c58e49338fc18 (diff) | |
download | emacs-0da5c14acdea6faa69328149aa6dcdeff22a2fb4.tar.gz |
(comint-write-output): Add APPEND argument. Rework interactive spec.
(comint-append-output-to-file): Function removed.
Diffstat (limited to 'lisp/comint.el')
-rw-r--r-- | lisp/comint.el | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/lisp/comint.el b/lisp/comint.el index 382b15f4a74..296d5b64f14 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -1894,32 +1894,32 @@ Does not delete the prompt." (defalias 'comint-kill-output 'comint-delete-output) (make-obsolete 'comint-kill-output 'comint-delete-output "21.1") -(defun comint-write-output (filename &optional mustbenew) +(defun comint-write-output (filename &optional append mustbenew) "Write output from interpreter since last input to FILENAME. Any prompt at the end of the output is not written. -If the optional argument MUSTBENEW (the prefix argument when interactive), -is non-nil, check for an existing file with the same name. If MUSTBENEW -is `excl', that means to get an error if the file already exists; never -overwrite. If MUSTBENEW is neither nil nor `excl', that means ask for -confirmation before overwriting, but do go ahead and overwrite the file -if the user confirms." - (interactive "FWrite output to file: \np") +If the optional argument APPEND (the prefix argument when interactive) +is non-nil, the output is appended to the file instead. + +If the optional argument MUSTBENEW is non-nil, check for an existing +file with the same name. If MUSTBENEW is `excl', that means to get an +error if the file already exists; never overwrite. If MUSTBENEW is +neither nil nor `excl', that means ask for confirmation before +overwriting, but do go ahead and overwrite the file if the user +confirms. When interactive, MUSTBENEW is nil when appending, and t +otherwise." + (interactive + (list (read-file-name + (if current-prefix-arg + "Append output to file: " + "Write output to file: ")) + current-prefix-arg + (not current-prefix-arg))) (save-excursion (goto-char (process-mark (get-buffer-process (current-buffer)))) (forward-line 0) - (write-region comint-last-input-end (point) - filename nil nil nil mustbenew))) - -(defun comint-append-output-to-file (filename) - "Append output from interpreter since last input to FILENAME. -Any prompt at the end of the output is not written." - (interactive "FAppend output to file: ") - (save-excursion - (goto-char (process-mark (get-buffer-process (current-buffer)))) - (forward-line 0) - (write-region comint-last-input-end (point) filename t))) - + (write-region comint-last-input-end (point) filename + append nil nil mustbenew))) (defun comint-show-output () "Display start of this batch of interpreter output at top of window. |