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

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

Re: Erase Region and paste in once?


From: Alexander Zhukov
Subject: Re: Erase Region and paste in once?
Date: Wed, 04 Apr 2007 15:13:53 +0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.95 (gnu/linux)

>>>>> Samuel Karl Peterson (SKP) writes:

 SKP> "Daniel" <hanmoai@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


reply via email to

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