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: [PATCH] Add function eshell/clear to clear current eshell buffer
Date: Mon, 09 Mar 2015 11:46:56 +0530
Message-ID: <87oao23dbb.fsf@gmail.com>
References: <874mpwhxml.fsf@gmail.com> <83lhj7lcgn.fsf@gnu.org>
	<87y4n7e1bn.fsf@gmail.com> <831tkz6yh1.fsf@gnu.org>
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Trace: ger.gmane.org 1425881826 2461 80.91.229.3 (9 Mar 2015 06:17:06 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 9 Mar 2015 06:17:06 +0000 (UTC)
Cc: 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 07:17:06 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 1YUqzx-0007fp-RH
	for ged-emacs-devel@m.gmane.org; Mon, 09 Mar 2015 07:17:05 +0100
Original-Received: from localhost ([::1]:41637 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 1YUqzx-0007ay-8A
	for ged-emacs-devel@m.gmane.org; Mon, 09 Mar 2015 02:17:05 -0400
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57625)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vibhavp@gmail.com>) id 1YUqzj-0007ap-9W
	for emacs-devel@gnu.org; Mon, 09 Mar 2015 02:16:52 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vibhavp@gmail.com>) id 1YUqzf-0003Uv-8Q
	for emacs-devel@gnu.org; Mon, 09 Mar 2015 02:16:51 -0400
Original-Received: from mail-pa0-x233.google.com ([2607:f8b0:400e:c03::233]:34533)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vibhavp@gmail.com>)
	id 1YUqze-0003US-Vj; Mon, 09 Mar 2015 02:16:47 -0400
Original-Received: by paceu11 with SMTP id eu11so56221905pac.1;
	Sun, 08 Mar 2015 23:16:45 -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=XSHStJz2ZmyycdJ9vXygMUriDUv0EfgLQ24zFbT2PYA=;
	b=gQOQrP+HsLJR4bgjB41l5AWqYi2hoiHNkmR2YDNuPNLaZVU2qPKd4jUwgra7UOofMD
	1jFb0AiOmijvZJejxbM5DYAcPML6O3JmrHLO8Tf3AEFi0lDquniNBx4O5e03XJmci94k
	QnuIdGKe2+17zSaDer95M370AN7k/+dVSrxSbANyKJnJg7BjKeI2pN8zHg28oGk5lHyA
	nEQq5V2fAWapFF54Y1JatqD81YTuws/rsziLAev/keiWzXNJoQQBDoLN2elpzZ7vR3b9
	4J80wqkj9R9tgvjP/XDijcRj8RJq5fjYW7SbR9nfjF4jpmpQpH9Obw8k/gM1L/UvorZ5
	JFtg==
X-Received: by 10.70.47.70 with SMTP id b6mr49459657pdn.136.1425881805491;
	Sun, 08 Mar 2015 23:16:45 -0700 (PDT)
Original-Received: from lenovog410 ([59.89.143.34])
	by mx.google.com with ESMTPSA id t13sm8950248pdl.20.2015.03.08.23.16.42
	(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Sun, 08 Mar 2015 23:16:43 -0700 (PDT)
In-Reply-To: <831tkz6yh1.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 08 Mar
	2015 22:11:38 +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::233
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:183738
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/183738>

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

Eli Zaretskii <eliz@gnu.org> writes:

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

Done, does this look good?

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

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  <vibhavp@gmail.com>
+
+	* eshell/esh-mode.el (eshell/clear): New function.
+
 2015-03-09  Dmitry Gutov  <dgutov@yandex.ru>
 
 	* 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

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


Thanks
-- 
Vibhav Pant
vibhavp@gmail.com

--=-=-=--