Subject: Re: bug#8996: Set PRIMARY from last selection, not last selected window

From: David De La Harpe Golden <[email-masked]>
Date: Fri, 08 Jul 2011 06:54:11 +0100

On 05/07/11 04:26, Stefan Monnier wrote:

> The window manager is ctwm rather than Metacity, in case it matters.
>

I can replicate this (not just with ctwm)

The issue I was thinking of is still present too, and is likely
closely related / really the same thing.

emacs -Q

C-x 2

point is at end of scratch buffer in the window you're in.

Now select word "create" with M-SPC and arrow keys, mark at start of 
word, point at end of word.

C-x o

create to the end of buffer is highlighted in current window.*

select word "visit" in window you're now in with M-SPC and arrow keys, 
mark at start of word, point at end of word.

C-x o

Note " a file, " is highlighted.*

hit mouse-2 on the end of the word "enter" in current window.

++ " a file, " is inserted, whereas user expectation is probably 
"visit", as the most recently actively selected by the user.

If we made it insert "visit", and (unlikely) the user did actually want 
" a file, ", they could hit C-x C-x [C-x C-x], say, to make that region 
the last actively selected by the user.

* Notionally pretty separate issue, best considered a separate bug or 
wishlist item: Point position is saved/restored on a per-window basis by 
select-window, but the mark position (and active status) is not.  IMO 
both point and mark (and active status) could do with being saved 
per-window and restored on window switches. That would be a noticeable 
behavioural change if done by default (could be optional though), and is 
presumably not a runner even as an option right at this very moment 
(feature freeze).  And of course, an ability to set the mark in one 
window open on a large buffer and the point in another window open onto 
a different place in the same large buffer is sortof a feature (though 
it's also possible to imagine both switch-window and, uh, 
switch-window-keeping-current-mark-position being available on different 
bindings).