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 21:39:22 +0530
Message-ID: <87a8zmf8zx.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>
	<83twxu5fh5.fsf@gnu.org>
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Trace: ger.gmane.org 1425917377 7235 80.91.229.3 (9 Mar 2015 16:09:37 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 9 Mar 2015 16:09:37 +0000 (UTC)
Cc: Gregor Zattler <telegraph@gmx.net>, emacs-devel@gnu.org
To: Eli Zaretskii <eliz@gnu.org>
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 09 17:09:33 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 1YV0FI-0001Wu-N3
	for ged-emacs-devel@m.gmane.org; Mon, 09 Mar 2015 17:09:32 +0100
Original-Received: from localhost ([::1]:44121 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 1YV0FH-0003BI-UV
	for ged-emacs-devel@m.gmane.org; Mon, 09 Mar 2015 12:09:31 -0400
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42290)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vibhavp@gmail.com>) id 1YV0F2-0003B7-4e
	for emacs-devel@gnu.org; Mon, 09 Mar 2015 12:09:16 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vibhavp@gmail.com>) id 1YV0Ex-00038S-8C
	for emacs-devel@gnu.org; Mon, 09 Mar 2015 12:09:16 -0400
Original-Received: from mail-pa0-x22f.google.com ([2607:f8b0:400e:c03::22f]:43119)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vibhavp@gmail.com>)
	id 1YV0Ex-00038B-14; Mon, 09 Mar 2015 12:09:11 -0400
Original-Received: by pablj1 with SMTP id lj1so64532481pab.10;
	Mon, 09 Mar 2015 09:09:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=from:to:cc:subject:references:date:in-reply-to:message-id
	:user-agent:mime-version:content-type;
	bh=G6PY6EwgTt9KS7IGQGYCVvDHxwWhdyMRKflfbrX6YpE=;
	b=lTle44NiEFwLwwOzzArk5A1YMVjSFBvYZN8joJaUdaphD/6DZwLQ5InDS/RJ2+okBh
	E0Crp/ed1U4g2YsPjGA6q1OId/ZMO1rhsOukW9hhzFTyXOiaQXCt/dPoL5yaW3l6pbke
	OHRAErB+ZKxrHCMDA/BQHGHxHw0nP1NzMzG0mQjdsLsO/k8cbjG8vx86JiyTRBFA/Dq1
	W/d9zb285No4q1FkYiCiUdBl+xDRaWHM19wnHg1Qp4TTwqnytbjNUPrxw22qTP3hVu/c
	Hv23IUO+V1kCooTskI6VD/YzGdvyVC9hXnobv1aHfazqDaCRybPNDfh+IpymJm3aolOu
	+wHw==
X-Received: by 10.70.126.225 with SMTP id nb1mr55804514pdb.40.1425917350151;
	Mon, 09 Mar 2015 09:09:10 -0700 (PDT)
Original-Received: from lenovog410 ([59.89.143.34]) by mx.google.com with ESMTPSA id
	s17sm19855025pdn.87.2015.03.09.09.09.08
	(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Mon, 09 Mar 2015 09:09:09 -0700 (PDT)
In-Reply-To: <83twxu5fh5.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 09 Mar
	2015 17:59:34 +0200")
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::22f
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:183745
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/183745>

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

Eli Zaretskii <eliz@gnu.org> writes:

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

Here you go.

--=-=-=
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..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

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



-- 
Vibhav Pant
vibhavp@gmail.com

--=-=-=--