unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: vibhavp@gmail.com
To: Eli Zaretskii <eliz@gnu.org>
Cc: Gregor Zattler <telegraph@gmx.net>, emacs-devel@gnu.org
Subject: Re: Add function eshell/clear to clear current eshell buffer
Date: Mon, 09 Mar 2015 21:39:22 +0530	[thread overview]
Message-ID: <87a8zmf8zx.fsf@gmail.com> (raw)
In-Reply-To: <83twxu5fh5.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 09 Mar 2015 17:59:34 +0200")

[-- Attachment #1: Type: text/plain, Size: 127 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

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

Here you go.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: eshell-clear.patch --]
[-- Type: text/x-diff, Size: 999 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 36 bytes --]



-- 
Vibhav Pant
vibhavp@gmail.com

  reply	other threads:[~2015-03-09 16:09 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-08  5:22 [PATCH] Add function eshell/clear to clear current eshell buffer vibhavp
2015-03-08  5:23 ` Vibhav Pant
2015-03-08  7:08   ` Bozhidar Batsov
2015-03-08  7:19     ` vibhavp
2015-03-08  7:25       ` Bozhidar Batsov
2015-03-08 15:45 ` Eli Zaretskii
2015-03-08 19:28   ` vibhavp
2015-03-08 20:11     ` Eli Zaretskii
2015-03-09  6:16       ` vibhavp
2015-03-09 10:11         ` Gregor Zattler
2015-03-09 12:33           ` vibhavp
2015-03-09 12:39             ` vibhavp
2015-03-09 15:59           ` Eli Zaretskii
2015-03-09 16:09             ` vibhavp [this message]
2015-03-09 16:43               ` Eli Zaretskii
2015-03-10  3:27                 ` Vibhav Pant
2015-03-10  7:59                   ` Bozhidar Batsov
2015-03-10  8:20                     ` Ricardo Wurmus
2015-04-18 11:12             ` Ted Zlatanov
2015-04-18 12:39               ` Eli Zaretskii
2015-04-18 13:31                 ` Ted Zlatanov
2015-04-18 13:43                   ` Eli Zaretskii
2015-04-18 14:17                     ` Ted Zlatanov
2015-04-18 15:18                     ` vibhavp
2015-04-18 15:23                       ` Eli Zaretskii
2015-04-18 19:10                         ` chad
2015-04-18 19:23                           ` Eli Zaretskii
2015-04-18 20:13                         ` vibhavp
2015-04-18 23:06                           ` Ted Zlatanov
2015-04-19  4:26                             ` vibhavp
2015-04-19 14:40                               ` Eli Zaretskii
2015-04-19 18:06                                 ` vibhavp
2015-04-19 18:24                                   ` Eli Zaretskii
2015-04-19 18:49                                     ` vibhavp
2015-04-19 18:53                                       ` Eli Zaretskii
2015-04-20 12:50                                         ` Ted Zlatanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a8zmf8zx.fsf@gmail.com \
    --to=vibhavp@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=telegraph@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).