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: Re: Add function eshell/clear to clear current eshell buffer
Date: Mon, 09 Mar 2015 18:09:14 +0530
Message-ID: <87r3syfiq5.fsf@gmail.com>
References: <874mpwhxml.fsf@gmail.com> <83lhj7lcgn.fsf@gnu.org>
	<87y4n7e1bn.fsf@gmail.com> <831tkz6yh1.fsf@gnu.org>
	<87oao23dbb.fsf@gmail.com> <20150309101126.GA11863@boo.workgroup>
	<87vbiafizd.fsf@gmail.com>
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Trace: ger.gmane.org 1425904757 11416 80.91.229.3 (9 Mar 2015 12:39:17 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 9 Mar 2015 12:39:17 +0000 (UTC)
To: emacs-devel <emacs-devel@gnu.org>
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 09 13:39:12 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 1YUwxj-0001Xj-Oy
	for ged-emacs-devel@m.gmane.org; Mon, 09 Mar 2015 13:39:11 +0100
Original-Received: from localhost ([::1]:43113 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 1YUwxi-0004yL-Ok
	for ged-emacs-devel@m.gmane.org; Mon, 09 Mar 2015 08:39:10 -0400
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51770)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vibhavp@gmail.com>) id 1YUwxe-0004xN-P3
	for emacs-devel@gnu.org; Mon, 09 Mar 2015 08:39:07 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vibhavp@gmail.com>) id 1YUwxb-0001DN-Gp
	for emacs-devel@gnu.org; Mon, 09 Mar 2015 08:39:06 -0400
Original-Received: from mail-pa0-x234.google.com ([2607:f8b0:400e:c03::234]:34808)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vibhavp@gmail.com>) id 1YUwxb-0001DA-9M
	for emacs-devel@gnu.org; Mon, 09 Mar 2015 08:39:03 -0400
Original-Received: by paceu11 with SMTP id eu11so58483353pac.1
	for <emacs-devel@gnu.org>; Mon, 09 Mar 2015 05:39:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=from:to:subject:references:date:in-reply-to:message-id:user-agent
	:mime-version:content-type;
	bh=uz/lmjf67Nw78zVtr2eHrZqOi6yvSWbh4Jx01IYoeCU=;
	b=AgTN5c3+7dmaGQLoRA/ZX6hGBxUOr8ia1QFNBovCJNXtcHxMh1FZcplFEY1C8R+7xi
	f7XGOwdUcYEcGikxf7hU+Ophc4QEWSmdXRmvYWOtRFAgTb1NnMVWV2/y2HAIJsQjUB1A
	WYzhE7ApnDi/yTiAty1bDbsjzDw/ODNTMhkAYyLz8h5k4tjIwOKqoMqxdmnqoNlshmVu
	dRv7B9o4G/4La9MafKxepSaD5LbzgTsiFsYmoA/jEMhOMgPWeXp7awmCyu+/gW7xuHCM
	MK8R+V92U9p8dgM1I6argu9PKE9iAbjyFx+yUJ6IIHcMGEUTZWfEFPU2H4pdxC8xmJeP
	sEVA==
X-Received: by 10.66.221.8 with SMTP id qa8mr32915395pac.62.1425904742266;
	Mon, 09 Mar 2015 05:39:02 -0700 (PDT)
Original-Received: from lenovog410 ([59.89.143.34])
	by mx.google.com with ESMTPSA id y2sm19142469pdm.31.2015.03.09.05.39.00
	for <emacs-devel@gnu.org>
	(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Mon, 09 Mar 2015 05:39:01 -0700 (PDT)
In-Reply-To: <87vbiafizd.fsf@gmail.com> (vibhavp@gmail.com's message of "Mon, 
	09 Mar 2015 18:03:42 +0530")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
	(bad octet value).
X-Received-From: 2607:f8b0:400e:c03::234
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:183743
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/183743>

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

> Yep, attached patch.

Oops, that wrong the wrong patch. Here's the correct one:

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

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 <vibhavp@gmail.com>
+
+	* eshell/esh-mode.el (eshell/clear): New function.
+
 2015-03-09  Nicolas Petton <nicolas@petton.fr>
 
 	* emacs-lisp/seq.el (seq-into): New function.
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index da83ec6..f134cb3 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 out of the eshell window by inserting newlines."
+  (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

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


-- 
Vibhav Pant
vibhavp@gmail.com

--=-=-=--