Subject: Re: bug#6774: Cut and paste with C-w/mouse-2 not working?

From: Kenichi Handa <[email-masked]>
Date: Mon, 16 Aug 2010 17:16:09 +0900

In article <[email-masked]>, Stefan Monnier <[email-masked]> writes:

> > And, first of all, from a user point of view, as these two
> > highlights a region exactly the same way (with the default
> > setting),
> >   (1) S-C-n
> >   (2) C-@ C-n
> > it's very confusing that they behave differently as to
> > selection.

> I haven't seen any report indicating that users really get confused
> by that.

As I don't like transient-mark-mode (both the default one
and the temporary one), I have not used it.  But, for the
discussion of this thread, I tried it and found the current
behaviour is confusing.

> But I'm not opposed to eliminating this confusion.  I just
> really don't want to see it implemented in set_point_both, and I'm not
> excited to seeing it in command_loop_1 either.

How about this?

We own the primary selection when mark is activated by C-@
in transient-mark-mode or C-@ C-@ not in
transient-mark-mode, and record somehow that selection is
owned that way (i.e. selection contents is a text in the
region).  At that time the contents is null, but I think
it's not the problem.  We do nothing special for all point
moving commands (except for highlighting the region).  When
Emacs receives selection request, it returns the text in the
region if the selection is still owned as the above way.  We
disown the selection when mark is deactivated.

And any commands that cut/copy text own the selection too
but in the different way (i.e. the way done by the current
code).

The handling of shift-selection and
selecting-by-mouse-dragging can use this mechanism which
causes less internal text-copying.

---
Kenichi Handa
[email-masked]