[Top][All Lists]

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

RE: clearing buffer

From: Stephen F. Heffner
Subject: RE: clearing buffer
Date: Mon, 09 Jul 2001 15:24:00 -0400

> Is there anyway to clear the shell buffer in emacs?  When I am testing a
> program I sometimes like to start each test with a clean screen so that I
> don't get current and previous test mixed up.

>From my .emacs:

(defun clear-buffer ()
Clear current buffer, putting erstwhile contents onto the kill ring.
Fails if buffer is read-only
    (interactive "*")                           ;;illegal if read-only buf
    (setq last-command nil)                     ;;don't append to prev kill
    (goto-char (point-min))                     ;;to buffer start
    (set-mark-command nil)                      ;;set the mark here
    (goto-char (point-max))                     ;;to buffer end
    (kill-region (mark) (point))                ;;kill buf to kill ring

(global-set-key "\C-x \C-c" 'clear-buffer)      ;;clr buffer, to kill ring


Stephen F. Heffner, President   | Phone: +1(609)919-0990
         ------------           | Fax:   +1(609)426-9880
Pennington Systems Incorporated | Email:  address@hidden
Princeton Corporate Center      | Web:
5 Independence Way, Suite 300   | XTRAN:  Our computer language
Princeton, NJ 08540 USA         |         expert system

reply via email to

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