emacs-devel
[Top][All Lists]
Advanced

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

Re: Add function eshell/clear to clear current eshell buffer


From: vibhavp
Subject: Re: Add function eshell/clear to clear current eshell buffer
Date: Mon, 09 Mar 2015 21:39:22 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>   Scroll contents of eshell window out of sight, leaving a blank window.

Here you go.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d8330a4..efb160c 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  Nicolas Petton <address@hidden>
 
        * emacs-lisp/seq.el (seq-into): New function.
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index da83ec6..15120cb 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 ()
+  "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

-- 
Vibhav Pant
address@hidden

reply via email to

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