Function: eshell/clear
eshell/clear is an interactive and byte-compiled function defined in
esh-mode.el.gz.
Signature
(eshell/clear &optional CLEAR-SCROLLBACK)
Documentation
Scroll contents of the Eshell window out of sight, leaving a blank window.
If CLEAR-SCROLLBACK is non-nil, clear the scrollback contents.
Otherwise, the behavior depends on eshell-scroll-show-maximum-output.
If non-nil, fill newlines before the current prompt so that the prompt
is the last line in the window; if nil, just scroll the window so that
the prompt is the first line in the window.
This command is for use as an Eshell command (entered at the prompt);
for clearing the Eshell buffer from elsewhere (e.g. via
M-x (execute-extended-command)), use eshell-clear.
Probably introduced at or before Emacs version 31.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/esh-mode.el.gz
(defun eshell/clear (&optional clear-scrollback)
"Scroll contents of the Eshell window out of sight, leaving a blank window.
If CLEAR-SCROLLBACK is non-nil, clear the scrollback contents.
Otherwise, the behavior depends on `eshell-scroll-show-maximum-output'.
If non-nil, fill newlines before the current prompt so that the prompt
is the last line in the window; if nil, just scroll the window so that
the prompt is the first line in the window.
This command is for use as an Eshell command (entered at the prompt);
for clearing the Eshell buffer from elsewhere (e.g. via
\\[execute-extended-command]), use `eshell-clear'."
(interactive)
(cond
((null eshell-current-handles)
(eshell-clear clear-scrollback))
(clear-scrollback
(let ((inhibit-read-only t))
(erase-buffer)))
(eshell-scroll-show-maximum-output
(let ((eshell-input-filter-functions nil))
(ignore (eshell-interactive-print (make-string (window-size) ?\n)))))
(t
(recenter 0))))