unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Alexander Zhukov <zuav@yandex.ru>
To: help-gnu-emacs@gnu.org
Subject: Re: Erase Region and paste in once?
Date: Wed, 04 Apr 2007 15:13:53 +0400	[thread overview]
Message-ID: <87vegcie8e.fsf@Sun.COM> (raw)
In-Reply-To: o36irccscny.fsf@pc13.cs.ucdavis.edu

>>>>> 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	other threads:[~2007-04-04 11:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-04  1:33 Erase Region and paste in once? Daniel
2007-04-04  3:08 ` Eli Zaretskii
2007-04-04  3:18   ` Matthew Flaschen
     [not found] ` <mailman.1733.1175656317.7795.help-gnu-emacs@gnu.org>
2007-04-04  4:37   ` Daniel
2007-04-04 10:28     ` cmr.Pent
2007-04-04  9:37 ` Samuel Karl Peterson
2007-04-04 11:13   ` Alexander Zhukov [this message]
2007-04-04 16:24     ` Daniel
2007-04-04 16:41       ` Drew Adams
2007-04-04 17:52     ` Matthew Flaschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vegcie8e.fsf@Sun.COM \
    --to=zuav@yandex.ru \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).