emacs-devel
[Top][All Lists]
Advanced

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

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


From: vibhavp
Subject: Re: [PATCH] Add function eshell/clear to clear current eshell buffer
Date: Mon, 09 Mar 2015 11:46:56 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

> Yes, exactly.  It shouldn't be hard.

Done, does this look good?
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b284ef1..3133cef 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
+2015-03-09  Vibhav Pant  <address@hidden>
+
+       * eshell/esh-mode.el (eshell/clear): New function.
+
 2015-03-09  Dmitry Gutov  <address@hidden>
 
        * progmodes/ruby-mode.el (ruby-font-lock-keywords): Don't consider
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index da83ec6..41ee132 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -871,6 +871,13 @@ When run interactively, widen the buffer first."
   (goto-char (point-max))
   (recenter -1))
 
+(defun eshell/clear ()
+  "Clear the eshell-buffer"
+  (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
Thanks
-- 
Vibhav Pant
address@hidden

reply via email to

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