Function: eshell-truncate-buffer

eshell-truncate-buffer is an interactive and byte-compiled function defined in esh-mode.el.gz.

Signature

(eshell-truncate-buffer)

Documentation

Truncate the buffer to eshell-buffer-maximum-lines.

This function could be on eshell-output-filter-functions or bound to a key.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-mode.el.gz
(defun eshell-truncate-buffer ()
  "Truncate the buffer to `eshell-buffer-maximum-lines'.
This function could be on `eshell-output-filter-functions' or bound to
a key."
  (interactive)
  (save-excursion
    (goto-char eshell-last-output-end)
    (let ((lines (count-lines 1 (point)))
	  (inhibit-read-only t))
      (forward-line (- eshell-buffer-maximum-lines))
      (beginning-of-line)
      (let ((pos (point)))
	(if (bobp)
	    (if (called-interactively-p 'interactive)
		(message "Buffer too short to truncate"))
	  (delete-region (point-min) (point))
	  (if (called-interactively-p 'interactive)
	      (message "Truncated buffer from %d to %d lines (%.1fk freed)"
		       lines eshell-buffer-maximum-lines
		       (/ pos 1024.0))))))))