diff options
| author | Miles Bader | 2000-10-19 02:12:30 +0000 |
|---|---|---|
| committer | Miles Bader | 2000-10-19 02:12:30 +0000 |
| commit | d134a19f84bf990f04b034fa2e2def31aba8a95a (patch) | |
| tree | d89faafbcecb2d15ad5fc53df2e7b93d930a2df1 /lisp/comint.el | |
| parent | e50517d90e8d95c0eb2363d834cf95319288f6fd (diff) | |
| download | emacs-d134a19f84bf990f04b034fa2e2def31aba8a95a.tar.gz emacs-d134a19f84bf990f04b034fa2e2def31aba8a95a.zip | |
(comint-write-output, comint-append-output-to-file): New functions.
(comint-mode-map): Add them to the menu.
Diffstat (limited to 'lisp/comint.el')
| -rw-r--r-- | lisp/comint.el | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/lisp/comint.el b/lisp/comint.el index 318e1566b0d..2569ce434d9 100644 --- a/lisp/comint.el +++ b/lisp/comint.el | |||
| @@ -574,6 +574,10 @@ Entry to this mode runs the hooks on `comint-mode-hook'." | |||
| 574 | (cons "In/Out" (make-sparse-keymap "In/Out"))) | 574 | (cons "In/Out" (make-sparse-keymap "In/Out"))) |
| 575 | (define-key comint-mode-map [menu-bar inout delete-output] | 575 | (define-key comint-mode-map [menu-bar inout delete-output] |
| 576 | '("Delete Current Output Group" . comint-delete-output)) | 576 | '("Delete Current Output Group" . comint-delete-output)) |
| 577 | (define-key comint-mode-map [menu-bar inout write-output] | ||
| 578 | '("Write Current Output Group to File" . comint-write-output)) | ||
| 579 | (define-key comint-mode-map [menu-bar inout append-output-to-file] | ||
| 580 | '("Append Current Output Group to File" . comint-append-output-to-file)) | ||
| 577 | (define-key comint-mode-map [menu-bar inout next-prompt] | 581 | (define-key comint-mode-map [menu-bar inout next-prompt] |
| 578 | '("Forward Output Group" . comint-next-prompt)) | 582 | '("Forward Output Group" . comint-next-prompt)) |
| 579 | (define-key comint-mode-map [menu-bar inout previous-prompt] | 583 | (define-key comint-mode-map [menu-bar inout previous-prompt] |
| @@ -1870,7 +1874,7 @@ This function could be in the list `comint-output-filter-functions'." | |||
| 1870 | ;; Random input hackage | 1874 | ;; Random input hackage |
| 1871 | 1875 | ||
| 1872 | (defun comint-delete-output () | 1876 | (defun comint-delete-output () |
| 1873 | "Kill all output from interpreter since last input. | 1877 | "Delete all output from interpreter since last input. |
| 1874 | Does not delete the prompt." | 1878 | Does not delete the prompt." |
| 1875 | (interactive) | 1879 | (interactive) |
| 1876 | (let ((proc (get-buffer-process (current-buffer))) | 1880 | (let ((proc (get-buffer-process (current-buffer))) |
| @@ -1889,6 +1893,33 @@ Does not delete the prompt." | |||
| 1889 | (defalias 'comint-kill-output 'comint-delete-output) | 1893 | (defalias 'comint-kill-output 'comint-delete-output) |
| 1890 | (make-obsolete 'comint-kill-output 'comint-delete-output "21.1") | 1894 | (make-obsolete 'comint-kill-output 'comint-delete-output "21.1") |
| 1891 | 1895 | ||
| 1896 | (defun comint-write-output (filename &optional mustbenew) | ||
| 1897 | "Write output from interpreter since last input to FILENAME. | ||
| 1898 | Any prompt at the end of the output is not written. | ||
| 1899 | |||
| 1900 | If the optional argument MUSTBENEW (the prefix argument when interactive), | ||
| 1901 | is non-nil, check for an existing file with the same name. If MUSTBENEW | ||
| 1902 | is `excl', that means to get an error if the file already exists; never | ||
| 1903 | overwrite. If MUSTBENEW is neither nil nor `excl', that means ask for | ||
| 1904 | confirmation before overwriting, but do go ahead and overwrite the file | ||
| 1905 | if the user confirms." | ||
| 1906 | (interactive "FWrite output to file: \np") | ||
| 1907 | (save-excursion | ||
| 1908 | (goto-char (process-mark (get-buffer-process (current-buffer)))) | ||
| 1909 | (forward-line 0) | ||
| 1910 | (write-region comint-last-input-end (point) | ||
| 1911 | filename nil nil nil mustbenew))) | ||
| 1912 | |||
| 1913 | (defun comint-append-output-to-file (filename) | ||
| 1914 | "Append output from interpreter since last input to FILENAME. | ||
| 1915 | Any prompt at the end of the output is not written." | ||
| 1916 | (interactive "FAppend output to file: ") | ||
| 1917 | (save-excursion | ||
| 1918 | (goto-char (process-mark (get-buffer-process (current-buffer)))) | ||
| 1919 | (forward-line 0) | ||
| 1920 | (write-region comint-last-input-end (point) filename t))) | ||
| 1921 | |||
| 1922 | |||
| 1892 | (defun comint-show-output () | 1923 | (defun comint-show-output () |
| 1893 | "Display start of this batch of interpreter output at top of window. | 1924 | "Display start of this batch of interpreter output at top of window. |
| 1894 | Sets mark to the value of point when this command is run." | 1925 | Sets mark to the value of point when this command is run." |