diff options
| -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." | |||
| 1894 | (defalias 'comint-kill-output 'comint-delete-output) | 1894 | (defalias 'comint-kill-output 'comint-delete-output) |
| 1895 | (make-obsolete 'comint-kill-output 'comint-delete-output "21.1") | 1895 | (make-obsolete 'comint-kill-output 'comint-delete-output "21.1") |
| 1896 | 1896 | ||
| 1897 | (defun comint-write-output (filename &optional mustbenew) | 1897 | (defun comint-write-output (filename &optional append mustbenew) |
| 1898 | "Write output from interpreter since last input to FILENAME. | 1898 | "Write output from interpreter since last input to FILENAME. |
| 1899 | Any prompt at the end of the output is not written. | 1899 | Any prompt at the end of the output is not written. |
| 1900 | 1900 | ||
| 1901 | If the optional argument MUSTBENEW (the prefix argument when interactive), | 1901 | If the optional argument APPEND (the prefix argument when interactive) |
| 1902 | is non-nil, check for an existing file with the same name. If MUSTBENEW | 1902 | is non-nil, the output is appended to the file instead. |
| 1903 | is `excl', that means to get an error if the file already exists; never | 1903 | |
| 1904 | overwrite. If MUSTBENEW is neither nil nor `excl', that means ask for | 1904 | If the optional argument MUSTBENEW is non-nil, check for an existing |
| 1905 | confirmation before overwriting, but do go ahead and overwrite the file | 1905 | file with the same name. If MUSTBENEW is `excl', that means to get an |
| 1906 | if the user confirms." | 1906 | error if the file already exists; never overwrite. If MUSTBENEW is |
| 1907 | (interactive "FWrite output to file: \np") | 1907 | neither nil nor `excl', that means ask for confirmation before |
| 1908 | overwriting, but do go ahead and overwrite the file if the user | ||
| 1909 | confirms. When interactive, MUSTBENEW is nil when appending, and t | ||
| 1910 | otherwise." | ||
| 1911 | (interactive | ||
| 1912 | (list (read-file-name | ||
| 1913 | (if current-prefix-arg | ||
| 1914 | "Append output to file: " | ||
| 1915 | "Write output to file: ")) | ||
| 1916 | current-prefix-arg | ||
| 1917 | (not current-prefix-arg))) | ||
| 1908 | (save-excursion | 1918 | (save-excursion |
| 1909 | (goto-char (process-mark (get-buffer-process (current-buffer)))) | 1919 | (goto-char (process-mark (get-buffer-process (current-buffer)))) |
| 1910 | (forward-line 0) | 1920 | (forward-line 0) |
| 1911 | (write-region comint-last-input-end (point) | 1921 | (write-region comint-last-input-end (point) filename |
| 1912 | filename nil nil nil mustbenew))) | 1922 | append nil nil mustbenew))) |
| 1913 | |||
| 1914 | (defun comint-append-output-to-file (filename) | ||
| 1915 | "Append output from interpreter since last input to FILENAME. | ||
| 1916 | Any prompt at the end of the output is not written." | ||
| 1917 | (interactive "FAppend output to file: ") | ||
| 1918 | (save-excursion | ||
| 1919 | (goto-char (process-mark (get-buffer-process (current-buffer)))) | ||
| 1920 | (forward-line 0) | ||
| 1921 | (write-region comint-last-input-end (point) filename t))) | ||
| 1922 | |||
| 1923 | 1923 | ||
| 1924 | (defun comint-show-output () | 1924 | (defun comint-show-output () |
| 1925 | "Display start of this batch of interpreter output at top of window. | 1925 | "Display start of this batch of interpreter output at top of window. |