Copying from and to emacs 24 in Linux/X11

I regularly want to select text in some arbitrary window, and then yank it into my emacs buffer using C-y.  This used to work by default up to emacs 23, but no longer in emacs 24.

Linux’ X11 uses two selection buffers for text:

  • the primary selection, which is used when selecting text
  • the clipboard selection, typically used when selecting ‘Copy’ or pressing Ctrl-Shift-C

In order to be able to yank selected text (in the primary selection buffer) into emacs, I added the following two lines to my ~/.emacs file

  • (setq x-select-enable-clipboard nil)
  • (setq x-select-enable-primary t)

To generate the opposite effect, swap the ‘nil’ and ‘t’ between the two lines.

Advertisements
This entry was posted in All, Software and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s