]> code.delx.au - gnu-emacs/blobdiff - lisp/eshell/esh-mode.el
No longer set dired-directory in eshell. (Bug#16477)
[gnu-emacs] / lisp / eshell / esh-mode.el
index 27f3411b4a93e34649e18c7d82f4701266e8633c..22ccf4e91f95379e7a696eb9b4035378d3d39212 100644 (file)
@@ -1,6 +1,6 @@
 ;;; 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>
 
@@ -206,7 +206,7 @@ This is used by `eshell-watch-for-password-prompt'."
 
 ;; 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)
@@ -344,7 +344,6 @@ and the hook `eshell-exit-hook'."
 
   (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))
 
@@ -871,6 +870,21 @@ When run interactively, widen the buffer first."
   (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