diff options
author | Simon Marshall <simon@gnu.org> | 1995-02-25 16:24:51 +0000 |
---|---|---|
committer | Simon Marshall <simon@gnu.org> | 1995-02-25 16:24:51 +0000 |
commit | 07ba9e79eda4ebc680600f3a5bfeef81e16143c0 (patch) | |
tree | eb9d65411c41ad9c0633e1c38a7921a7761ac977 /lisp/comint.el | |
parent | 3f0f93a09eeb4c2319edc26b8e264f8255e5a5aa (diff) | |
download | emacs-07ba9e79eda4ebc680600f3a5bfeef81e16143c0.tar.gz |
Added comint-buffer-maximum-size and comint-truncate-buffer.
Diffstat (limited to 'lisp/comint.el')
-rw-r--r-- | lisp/comint.el | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lisp/comint.el b/lisp/comint.el index 045988e8c0a..a056ba51ea0 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -209,6 +209,11 @@ If non-nil, then show the maximum output when the window is scrolled. See variable `comint-scroll-to-bottom-on-output' and function `comint-postoutput-scroll-to-bottom'. This variable is buffer-local.") +(defvar comint-buffer-maximum-size 1024 + "*The maximum size in lines for comint buffers. +Comint buffers are truncated from the top to be no greater than this number, if +the function `comint-truncate-buffer' is on `comint-output-filter-functions'.") + (defvar comint-input-ring-size 32 "Size of input history ring.") @@ -1292,11 +1297,19 @@ This function should be in the list `comint-output-filter-functions'." nil t)) (set-buffer current)))) +(defun comint-truncate-buffer (&optional string) + "Truncate the buffer to `comint-buffer-maximum-size'. +This function could be on `comint-output-filter-functions' or bound to a key." + (interactive) + (save-excursion + (goto-char (point-max)) + (forward-line (- comint-buffer-maximum-size)) + (beginning-of-line) + (delete-region (point-min) (point)))) + (defun comint-strip-ctrl-m (&optional string) "Strip trailing `^M' characters from the current output group. - -This function could be in the list `comint-output-filter-functions' or bound to -a key." +This function could be on `comint-output-filter-functions' or bound to a key." (interactive) (let ((pmark (process-mark (get-buffer-process (current-buffer))))) (save-excursion |