help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Clearing eshell screen


From: Oscar Fuentes
Subject: Re: Clearing eshell screen
Date: 25 Oct 2002 01:59:17 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]