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

From: Chong Yidong <[email-masked]>
Date: Wed, 04 Aug 2010 22:20:39 -0400

David De La Harpe Golden <[email-masked]> writes:

> The problem is that we may really want the selection bound to
> something _non-current_, if we don't want it to instantly reflect a
> restored boring active region as per above.  And there's the
> two-windows-onto-the-same buffer case to consider

It would be nice to leave boring selections alone, but it doesn't seem
worth it if a lot of new infrastructure has to be added to handle this.

If this problem can't be solved simply, I would prefer to tweak the
behavior of select-active-regions instead.  Here's an idea:

  When the mark is set for a temporarily active region---a region
  created by mouse dragging or shift selection---we keep the current
  behavior; i.e. (x-set-selection 'PRIMARY (current-buffer)).

  Otherwise, do *not* call x-set-selection when setting the mark.

  Before any change to the buffer, save a copy of the region if the mark
  is active, whether or not the region is temporary.

  In deactivate-mark, whether or not the region is temporary, set the
  primary selection to the region that we just deactivated, or to the
  saved copy if that region is empty.

The main difference, as you see, is that non-temporary regions made with
C-SPC would not affect the primary selection until deactivation (either
via buffer change, or commands such as M-w).