Tiny update to apply to current cvs head without large fuzz, functionally unchanged. Not sure it's handling 100% of cases - maybe it should be copying and "holding" as a string the selection before a command runs, and resetting it to the buffer object only if the mark hasn't been deactivated during the run of the command. Otherwise there may be some odd situations where the primary selection doesn't reflect the last _user visible_ highlight on screen, which is surprising. OTOH, that sounds more complex, and such cases don't seem to arise much (or at all) in practice - at least I haven't noticed them.