[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Add function eshell/clear to clear current eshell buffer

From: vibhavp
Subject: [PATCH] Add function eshell/clear to clear current eshell buffer
Date: Sun, 08 Mar 2015 10:52:10 +0530

Eshell currently lacks a "clear" command. Since it cannot use the one
provided by the ncurses package, I added a patch which adds similar
functionality to eshell. It can be called by simply typing "clear" on
the eshell prompt.


diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0b277c7..409ca23 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
+2015-03-08  Vibhav Pant  <address@hidden>
+       * eshell/esh-mode.el (eshell/clear): New function.
 2015-03-07  Stefan Monnier  <address@hidden>
        * battery.el (battery-echo-area-format): Simplify default.
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index da83ec6..a1c71cc 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -902,6 +902,12 @@ When run interactively, widen the buffer first."
     (kill-buffer (current-buffer))))
+(defun eshell/clear ()
+  "Clear the eshell buffer."
+  (let ((inhibit-read-only t))
+    (erase-buffer)
+    (eshell-send-input)))
 (defun eshell-truncate-buffer ()
   "Truncate the buffer to `eshell-buffer-maximum-lines'.
 This function could be on `eshell-output-filter-functions' or bound to
Vibhav Pant

reply via email to

[Prev in Thread] Current Thread [Next in Thread]