[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Erase Region and paste in once?
From: |
Samuel Karl Peterson |
Subject: |
Re: Erase Region and paste in once? |
Date: |
04 Apr 2007 02:37:37 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
"Daniel" <hanmoai@gmail.com> on 3 Apr 2007 18:33:47 -0700 didst step
forth and proclaim thus:
> Hi all,
>
> In general editors, I do copy (ctrl-c) some text in firefox and make a
> region in a editor where I want to replace and paste(ctrl-v) it.
>
> I tried to do in emacs, but I can't find a way to overwrite a certain
> region by doing yank at one time.
>
> Is it possible to do it in emacs?
Anything's possible in Emacs ;)
Behold my lisp snippet:
(defun sams-zap-yank (beg end)
(interactive "r")
(delete-region beg end)
(yank))
Assign it to a key such as:
(global-set-key "\C-cv" 'sams-zap-yank)
Who knows, Emacs may have already had this functionality. I may have
just reinvented the wheel, but eh, it was a small wheel.
--
Sam Peterson
skpeterson At nospam ucdavis.edu
"if programmers were paid to remove code instead of adding it,
software would be much better" -- unknown