unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Clearing eshell screen
@ 2002-10-24 20:06 Timur Aydin
  2002-10-24 23:18 ` Kevin Rodgers
  0 siblings, 1 reply; 4+ messages in thread
From: Timur Aydin @ 2002-10-24 20:06 UTC (permalink / raw)


Hi everybody,

How can I clear the eshell screen? A real clear though, not something
like the unix shells, where typing clear just scrolls the screen
upwards (kinda like sweeping the dirt under the carpet).

--
Timur

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Clearing eshell screen
  2002-10-24 20:06 Clearing eshell screen Timur Aydin
@ 2002-10-24 23:18 ` Kevin Rodgers
  2002-10-24 23:38   ` Oscar Fuentes
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Rodgers @ 2002-10-24 23:18 UTC (permalink / raw)


Timur Aydin wrote:

> How can I clear the eshell screen? A real clear though, not something
> like the unix shells, where typing clear just scrolls the screen
> upwards (kinda like sweeping the dirt under the carpet).


M-x erase-buffer RET


-- 
<a href="mailto:&lt;kevinr&#64;ihs.com&gt;">Kevin Rodgers</a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Clearing eshell screen
  2002-10-24 23:18 ` Kevin Rodgers
@ 2002-10-24 23:38   ` Oscar Fuentes
  2002-10-24 23:59     ` Oscar Fuentes
  0 siblings, 1 reply; 4+ messages in thread
From: Oscar Fuentes @ 2002-10-24 23:38 UTC (permalink / raw)


Kevin Rodgers <kevinr@ihs.com> writes:

> Timur Aydin wrote:
> 
> > How can I clear the eshell screen? A real clear though, not something
> > like the unix shells, where typing clear just scrolls the screen
> > upwards (kinda like sweeping the dirt under the carpet).
> 
> 
> M-x erase-buffer RET

--- Emacs output

You have invoked the disabled command erase-buffer:
Delete the entire contents of the current buffer.
Any narrowing restriction in effect (see `narrow-to-region') is removed,
so the buffer is truly empty after this.


You can now type
Space to try the command just this once, but leave it disabled,
Y to try it and enable it (no questions if you use it again),
! to try it and enable all commands in this session, or
N to do nothing (command remains disabled).

<SPC pressed>

Text is read-only

<Buffer remains unaffected>

---- End of Emacs output

So far, the only way I know of discarding the eshell buffer contents
is exiting. For me (Emacs 21.1.1 on Win2k and Linux) eshell doesn't
honor the eshell-buffer-maximum-lines variable either, which is
dangerous, as some commands (ex. a gcc bootstrap) outputs tons of
text. Eventually, you end with an eshell buffer using several
megabytes of memory.

-- 
Oscar

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Clearing eshell screen
  2002-10-24 23:38   ` Oscar Fuentes
@ 2002-10-24 23:59     ` Oscar Fuentes
  0 siblings, 0 replies; 4+ messages in thread
From: Oscar Fuentes @ 2002-10-24 23:59 UTC (permalink / raw)


Oscar Fuentes <ofv@wanadoo.es> writes:

[snip]
> For me (Emacs 21.1.1 on Win2k and Linux) eshell doesn't
> honor the eshell-buffer-maximum-lines variable either
[snip]

Ooops! As the documentation says, adding 'eshell-truncate-buffer' to
'eshell-output-filter-functions' does the trick. Sorry.

Maybe this modification of 'eshell-truncate-buffer' is useful for the
OP:

(defun eshell-clears-buffer ()
  "Deletes the contents of eshell buffer, except the last prompt"
  (interactive)
  (save-excursion
    (goto-char eshell-last-output-end)
    (let ((lines (count-lines 1 (point)))
	  (inhibit-read-only t))
      (beginning-of-line)
      (let ((pos (point)))
	(if (bobp)
	    (if (interactive-p)
		(error "Buffer too short to truncate"))
	  (delete-region (point-min) (point))
	  (if (interactive-p)
	      (message "Buffer cleared")))))))

-- 
Oscar

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-10-24 23:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-24 20:06 Clearing eshell screen Timur Aydin
2002-10-24 23:18 ` Kevin Rodgers
2002-10-24 23:38   ` Oscar Fuentes
2002-10-24 23:59     ` Oscar Fuentes

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