[Originally posted by]: http://emacs.stackexchange.com/questions/17170/how-to-auto-copy-when-a-region-is-selected
The selection can be copied automatically if the OS supports primary selection by setting the below variable.
(setq x-select-enable-primary t)
C-h v x-select-enable-primary, you get,
Non-nil means cutting and pasting uses the primary selection The existence of a primary selection depends on the underlying GUI you use. E.g. it doesn’t exist under MS-Windows.
To learn even more, visit the relevant info node by doing
C-h i g (emacs) Primary Selection.
Another variable setting that goes in tandem with the above is to set the
t. Doing that allows you to yank the contents copied from other X11 applications into emacs.
(setq x-select-enable-clipboard t)
When emacs 25.1 is released (supposedly the next stable version after 24.5), the
x-select-enable-primary variable name will be deprecated and
select-enable-primary must be used instead (removal of that
x- prefix). Similarly
x-select-enable-clipboard will be deprecated in favor of