summaryrefslogtreecommitdiff
path: root/lisp/eshell/esh-mode.el
diff options
context:
space:
mode:
authorJan D <jan.h.d@swipnet.se>2015-04-26 13:55:01 +0200
committerJan D <jan.h.d@swipnet.se>2015-04-26 13:55:01 +0200
commitf92ac2e82ed199d6f25d2a59508e08addb1150ac (patch)
treed7d7756e3dbce10d8f73c27815d815499f78c2bd /lisp/eshell/esh-mode.el
parent5a094119ce79723108abd90a1fcc33721e964823 (diff)
parenta40869789fc5502e3d4e393b7c31d78cb7f29aa1 (diff)
downloademacs-f92ac2e82ed199d6f25d2a59508e08addb1150ac.tar.gz
Merge branch 'master' into cairo
Diffstat (limited to 'lisp/eshell/esh-mode.el')
-rw-r--r--lisp/eshell/esh-mode.el18
1 files changed, 13 insertions, 5 deletions
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index 15120cb61d4..222e801301b 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -871,12 +871,20 @@ When run interactively, widen the buffer first."
(goto-char (point-max))
(recenter -1))
-(defun eshell/clear ()
- "Scroll contents of eshell window out of sight, leaving a blank window."
+(defun eshell/clear (&optional scrollback)
+ "Scroll contents of eshell window out of sight, leaving a blank window.
+If SCROLLBACK is non-nil, clear the scrollback contents."
(interactive)
- (let ((number-newlines (count-lines (window-start) (point))))
- (insert (make-string number-newlines ?\n)))
- (eshell-send-input))
+ (if scrollback
+ (eshell/clear-scrollback)
+ (let ((number-newlines (count-lines (window-start) (point))))
+ (insert (make-string number-newlines ?\n))
+ (eshell-send-input))))
+
+(defun eshell/clear-scrollback ()
+ "Clear the scrollback content of the eshell window."
+ (let ((inhibit-read-only t))
+ (erase-buffer)))
(defun eshell-get-old-input (&optional use-current-region)
"Return the command input on the current line."