]> code.delx.au - gnu-emacs/commitdiff
Add 'clear' functionality to eshell.
authorVibhav Pant <vibhavp@gmail.com>
Mon, 16 Mar 2015 23:31:59 +0000 (05:01 +0530)
committerVibhav Pant <vibhavp@gmail.com>
Mon, 16 Mar 2015 23:31:59 +0000 (05:01 +0530)
* eshell/esh-mode.el (eshell/clear): New function.

* etc/NEWS: Mention new built-in command.

etc/NEWS
lisp/ChangeLog
lisp/eshell/esh-mode.el

index 75d55de3f36979fbd4bfc6721ef416827750dd25..491d0d3de54e94b7358cbedfc71ada3dabdf2529 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -556,6 +556,10 @@ to avoid interfering with the kill ring.
 allow overriding the regular expression that recognizes the ldapsearch
 command line's password prompt.
 
+** Eshell
+
+*** The new built-in command `clear' can scroll window contents out of sight.
+
 +++
 ** tar-mode: new `tar-new-entry' command, allowing for new members to
 be added to the archive.
index c6fab7fba3d708a82c45542640b4f90e7163d2c5..3af4bb20b04ff69a9d4b69cb6a91bfaa6d1350bc 100644 (file)
@@ -1,3 +1,7 @@
+2015-03-16  Vibhav Pant  <vibhavp@gmail.com>
+
+       * eshell/esh-mode.el (eshell/clear): New function.
+
 2015-03-16  Alan Mackenzie  <acm@muc.de>
 
        Make Edebug work with Follow Mode.
index da83ec6a6ab9e622fdbca3a9436ae3aa36984c74..15120cb61d4ba65ced923739ff44cd458f363da2 100644 (file)
@@ -871,6 +871,13 @@ 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."
+  (interactive)
+  (let ((number-newlines (count-lines (window-start) (point))))
+    (insert (make-string number-newlines ?\n)))
+    (eshell-send-input))
+
 (defun eshell-get-old-input (&optional use-current-region)
   "Return the command input on the current line."
   (if use-current-region