changeset 10833:77d7d3990300

Added comint-buffer-maximum-size and comint-truncate-buffer.
author Simon Marshall <simon@gnu.org>
date Sat, 25 Feb 1995 16:24:51 +0000
parents 32d4c4ca1ff8
children e79e5c9e7722
files lisp/comint.el
diffstat 1 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/comint.el	Sat Feb 25 16:16:57 1995 +0000
+++ b/lisp/comint.el	Sat Feb 25 16:24:51 1995 +0000
@@ -209,6 +209,11 @@
 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 @@
 	     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