[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Erase Region and paste in once?
From: |
Daniel |
Subject: |
Re: Erase Region and paste in once? |
Date: |
4 Apr 2007 09:24:21 -0700 |
User-agent: |
G2/1.0 |
On Apr 4, 4:13 am, Alexander Zhukov <z...@yandex.ru> wrote:
> >>>>> Samuel Karl Peterson (SKP) writes:
>
> SKP> "Daniel" <hanm...@gmail.com> on 3 Apr 2007 18:33:47 -0700 didst
> SKP> 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?
>
> SKP> Anything's possible in Emacs ;)
>
> SKP> Behold my lisp snippet:
>
> SKP> (defun sams-zap-yank (beg end) (interactive "r") (delete-region
> SKP> beg end) (yank))
>
> SKP> Assign it to a key such as:
>
> SKP> (global-set-key "\C-cv" 'sams-zap-yank)
>
> SKP> Who knows, Emacs may have already had this functionality. I may
> SKP> have just reinvented the wheel, but eh, it was a small wheel.
>
> I use this:
>
> (delete-selection-mode 1)
>
> Here is description:
>
> delete-selection-mode is an interactive compiled Lisp function in
> `delsel.el'. (delete-selection-mode &optional arg)
>
> Toggle Delete Selection mode.
> With prefix arg, turn Delete Selection mode on if and only if arg is
> positive.
>
> When Delete Selection mode is enabled, Transient Mark mode is also
> enabled and typed text replaces the selection if the selection is
> active. Otherwise, typed text is just inserted at point regardless of
> any selection.
>
> --
> Alexander Zhukov
Thank you, Alexander Zhukov,
I didn't even know the mode. Great Help.
Thank you and other guys. I could know emacs do lot of things. Thanks.