;;; esh-mode.el --- user interface -*- lexical-binding:t -*-
-;; Copyright (C) 1999-2014 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2015 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@gnu.org>
;; Internal Variables:
-;; these are only set to `nil' initially for the sake of the
+;; these are only set to nil initially for the sake of the
;; byte-compiler, when compiling other files which `require' this one
(defvar eshell-mode nil)
(defvar eshell-mode-map nil)
(setq local-abbrev-table eshell-mode-abbrev-table)
- (set (make-local-variable 'dired-directory) default-directory)
(set (make-local-variable 'list-buffers-directory)
(expand-file-name default-directory))
(goto-char (point-max))
(recenter -1))
+(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)
+ (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."
(if use-current-region