From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!not-for-mail
From: vibhavp@gmail.com
Newsgroups: gmane.emacs.devel
Subject: [PATCH] Add function eshell/clear to clear current eshell buffer
Date: Sun, 08 Mar 2015 10:52:10 +0530
Message-ID: <874mpwhxml.fsf@gmail.com>
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Trace: ger.gmane.org 1425792136 20663 80.91.229.3 (8 Mar 2015 05:22:16 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sun, 8 Mar 2015 05:22:16 +0000 (UTC)
To: emacs-devel@gnu.org
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 08 06:22:11 2015
Return-path: <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>
Envelope-to: ged-emacs-devel@m.gmane.org
Original-Received: from lists.gnu.org ([208.118.235.17])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>)
	id 1YUTfF-00069M-7h
	for ged-emacs-devel@m.gmane.org; Sun, 08 Mar 2015 06:22:09 +0100
Original-Received: from localhost ([::1]:37498 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>)
	id 1YUTfE-0004OK-Cj
	for ged-emacs-devel@m.gmane.org; Sun, 08 Mar 2015 00:22:08 -0500
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49425)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vibhavp@gmail.com>) id 1YUTfA-0004O3-LD
	for emacs-devel@gnu.org; Sun, 08 Mar 2015 00:22:05 -0500
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vibhavp@gmail.com>) id 1YUTf7-000395-EM
	for emacs-devel@gnu.org; Sun, 08 Mar 2015 00:22:04 -0500
Original-Received: from mail-pa0-x232.google.com ([2607:f8b0:400e:c03::232]:37952)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vibhavp@gmail.com>) id 1YUTf7-00038z-7c
	for emacs-devel@gnu.org; Sun, 08 Mar 2015 00:22:01 -0500
Original-Received: by pabrd3 with SMTP id rd3so39469694pab.5
	for <emacs-devel@gnu.org>; Sat, 07 Mar 2015 21:22:00 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=from:to:subject:date:message-id:mime-version:content-type;
	bh=h036HFFbIPMkAg/gGKzZr0QSFADoyoJtKExjdXPDIig=;
	b=vUki0bf5VJw7VFezBY0lrFUFDw10e3EUDnS4BU4bWy6PYN0/H1gv6MGGXbz1xnxDUX
	HwIHYSuo0Vn8gfdZPlu/weqjX6Gz852oyJz+/rERdmmrKLTEuBIEQO7+fsuhC6NkRc7q
	7HjAAz3u84TdosNA8GrxyXzQlm7Eon/EMwo64MY44KYEPAqBWWWmVIuVUwX8kodwDvxp
	gvJnswM+AbedGuCNXyjPG/B8c7KPE+Yc4WJSrh3AkPxD0z0A7KPmmuAtK/lBnnKkHD7a
	JbOdopAsvBlntJDTyzMB4rTN7oq7gTAu0Nd7CHaX52Eu/L4Wt5XAY7Y86MsAjo1YAMwX
	1plw==
X-Received: by 10.66.100.138 with SMTP id ey10mr35101037pab.142.1425792119785; 
	Sat, 07 Mar 2015 21:21:59 -0800 (PST)
Original-Received: from lenovog410 ([59.89.17.241])
	by mx.google.com with ESMTPSA id op5sm3731017pbc.3.2015.03.07.21.21.58
	for <emacs-devel@gnu.org>
	(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Sat, 07 Mar 2015 21:21:58 -0800 (PST)
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
	(bad octet value).
X-Received-From: 2607:f8b0:400e:c03::232
X-BeenThere: emacs-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Emacs development discussions." <emacs-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/emacs-devel>
List-Post: <mailto:emacs-devel@gnu.org>
List-Help: <mailto:emacs-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=subscribe>
Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org
Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org
Xref: news.gmane.org gmane.emacs.devel:183721
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/183721>

--=-=-=
Content-Type: text/plain

Hello,
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.

Thanks


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=eshell-clear.patch
Content-Description: eshell-clear patch

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  <vibhavp@gmail.com>
+
+	* eshell/esh-mode.el (eshell/clear): New function.
+
 2015-03-07  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* 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."
       (bury-buffer)
     (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

--=-=-=
Content-Type: text/plain

-- 
Vibhav Pant
vibhavp@gmail.com

--=-=-=--