diff options
author | Simon Marshall <simon@gnu.org> | 1995-02-25 16:10:01 +0000 |
---|---|---|
committer | Simon Marshall <simon@gnu.org> | 1995-02-25 16:10:01 +0000 |
commit | 375a3a9c892833e7fa27ecb9b4785866f8f1c757 (patch) | |
tree | 7486aa00d91f9436aed016a7a654d374b07f2668 /lisp/shell.el | |
parent | 14d64f5b7de4bc4aeb7aea4aa517d19c6dc0cfcc (diff) | |
download | emacs-375a3a9c892833e7fa27ecb9b4785866f8f1c757.tar.gz |
Added shell-truncate-buffer function to restrict buffer size to
at most shell-buffer-maximum-size lines in length.
Diffstat (limited to 'lisp/shell.el')
-rw-r--r-- | lisp/shell.el | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/lisp/shell.el b/lisp/shell.el index cfd92282a87..64b52c4f1ef 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -156,6 +156,10 @@ This mirrors the optional behavior of tcsh. Detecting executability of files may slow command completion considerably.") +(defvar shell-buffer-maximum-size 1024 + "*The maximum size in lines for shell buffers. +Shell buffers are truncated from the top to be no greater than this number.") + (defvar shell-popd-regexp "popd" "*Regexp to match subshell commands equivalent to popd.") @@ -249,10 +253,10 @@ Thus, this does not include the shell's current directory.") (defun shell-mode () "Major mode for interacting with an inferior shell. -Return after the end of the process' output sends the text from the - end of process to the end of the current line. -Return before end of process output copies the current line (except - for the prompt) to the end of the buffer and sends it. +\\[comint-send-input] after the end of the process' output sends the text from + the end of process to the end of the current line. +\\[comint-send-input] before end of process output copies the current line minus the prompt to + the end of the buffer and sends it (\\[comint-copy-old-input] just copies the current line). \\[send-invisible] reads a line of text without echoing it, and sends it to the shell. This is useful for entering passwords. Or, add the function `comint-watch-for-password-prompt' to `comint-output-filter-functions'. @@ -260,6 +264,9 @@ Return before end of process output copies the current line (except If you want to make multiple shell buffers, rename the `*shell*' buffer using \\[rename-buffer] or \\[rename-uniquely] and start a new shell. +If you want to make shell buffers limited in length, add the function +`shell-truncate-buffer' to `comint-output-filter-functions'. + If you accidentally suspend your process, use \\[comint-continue-subjob] to continue it. @@ -624,6 +631,14 @@ command again." (setq ds (cdr ds)))) (message msg))) +(defun shell-truncate-buffer (string) + "Truncate the buffer to `shell-buffer-maximum-size'." + (save-excursion + (goto-char (point-max)) + (forward-line (- shell-buffer-maximum-size)) + (beginning-of-line) + (delete-region (point-min) (point)))) + (defun shell-forward-command (&optional arg) "Move forward across ARG shell command(s). Does not cross lines. See `shell-command-regexp'." |