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

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

Re: clearing buffer


From: Tom Wurgler
Subject: Re: clearing buffer
Date: Mon, 9 Jul 2001 15:47:46 -0400 (EDT)

Here's my $.02....

With this you can type "clear" in a shell even while a program is outputting
to the shell.  It erases from that point backward.  If you are at the prompt
it leaves the prompt at the top of the window...


(defadvice comint-simple-send (around allow_clear_command activate)
  "If the input is the word \"clear\", erase buffer."
  (if (string-equal "clear" string)
      (progn
        (kill-word -1)
        (forward-line 0)
        (delete-region 1 (point))
        (end-of-buffer))
    ad-do-it))


Recently "Stephen F. Heffner" <address@hidden> wrote:

> From: "Stephen F. Heffner" <address@hidden>
> Reply-to: address@hidden
> Importance: Normal
> Sender: address@hidden
> 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
> 
> HTH,
> 
> Stephen F. Heffner, President   | Phone: +1(609)919-0990
>          ------------           | Fax:   +1(609)426-9880
> Pennington Systems Incorporated | Email:  address@hidden
> Princeton Corporate Center      | Web:    http://WWW.Pennington.com
> 5 Independence Way, Suite 300   | XTRAN:  Our computer language
> Princeton, NJ 08540 USA         |         expert system
> 
> 
> 
> _______________________________________________
> Gnu-emacs-sources mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/gnu-emacs-sources
> 



reply via email to

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