Skip to content

Instantly share code, notes, and snippets.

@rand00
Created September 30, 2014 13:03
Show Gist options
  • Save rand00/e8a382e3aa1b64a53727 to your computer and use it in GitHub Desktop.
Save rand00/e8a382e3aa1b64a53727 to your computer and use it in GitHub Desktop.
Elisp function for copying Emacs-selection to the X primary selection (clipboard)
(defun yank-to-x-clipboard ()
(interactive)
(if (region-active-p)
(progn
(shell-command-on-region
(region-beginning) (region-end)
"xsel -pi")
(message "Yanked region to clipboard!")
(deactivate-mark))
(message "You havn't marked any text.")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment