unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Yanking wrong text
Date: Sat, 23 Jun 2007 12:45:23 +0300	[thread overview]
Message-ID: <87y7ibvwrn.fsf@jurta.org> (raw)
In-Reply-To: <jwvodj7xpm5.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat\, 23 Jun 2007 00\:28\:32 -0400")

>> The comment in the implementation says that this was done because
>> otherwise yank would be a no-op.  So what?  I still need to insert
>> the last copied region even if it happens to be the same as the selected
>> region, and not insert some arbitrary text from the rest of the kill ring.
>
> I do not understand.  Please explain in more details your scenario.  I don't
> really understand what you're trying to do and what you're getting instead.

I'll describe step by step what I do.  Let's suppose that I have some
text (e.g. "garbage") on the top of the kill ring.  I copied this text
to the kill ring long ago (with e.g. M-w or C-w) and forgot about its
existence in the kill ring.

Now I want to copy some region to another place (no matter in the
same buffer or another buffer).  I select this region and add it
to the kill ring with M-w.  Now I go to another place, select a region
I want to replace with the text added to the kill ring from the first
region.  Now I select this region, and I expect that typing C-y will
replace it with the text of the first region from the kill ring.
When delete-selection-mode and cua-selection-mode are enabled, and
transient-mark-mode is also enabled, then yanked text from the top of the
kill ring replaces the active selection.  But really C-y replaces the
selection not with the text of the first region from the top of the kill
ring, but with the text "garbage" which is the second element of the kill
ring.  That's because the selected region happens to be the same as the
first region added to the top of the kill ring, and due to optimization
C-y inserts the second element of the kill ring.

You may ask why do I want to replace a region with exactly same text.
Usually text is very large, so I don't see that these regions have
no differences.  My goal is to copy the region to another place regardless
of the fact that it happens to be the same as the selected region to be
replaced in another place.

-- 
Juri Linkov
http://www.jurta.org/emacs/

  parent reply	other threads:[~2007-06-23  9:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-22 20:59 Yanking wrong text Juri Linkov
2007-06-23  4:28 ` Stefan Monnier
2007-06-23  6:19   ` David Kastrup
2007-06-23  9:45   ` Juri Linkov [this message]
2007-06-23 18:26     ` Richard Stallman
2007-06-23 19:00       ` Stefan Monnier
2007-06-23 20:04         ` Juri Linkov
2007-08-21  1:26           ` Chris Moore
2007-08-21 20:05             ` Juri Linkov
2007-06-24 14:40         ` Richard Stallman
2007-06-29 16:34           ` Juri Linkov
2007-06-30 15:09             ` Richard Stallman
2007-07-15 16:50             ` Richard Stallman
2007-07-15 20:00               ` Juri Linkov
2007-07-23 18:06             ` Richard Stallman
2007-07-23 21:31               ` Juri Linkov

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=87y7ibvwrn.fsf@jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).