Created
August 29, 2012 18:00
-
-
Save abicky/3516310 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq x-select-enable-clipboard t) | |
(defun copy-from-clipboard (text &optional rest) | |
(let ((process-connection-type nil) proc) | |
(if (eq system-type 'darwin) | |
(setq proc (start-process "pbcopy" "*Messages*" "pbcopy")) | |
(setq proc (start-process "xsel" "*Messages*" "xsel" "-b" "-i"))) | |
(process-send-string proc text) | |
(process-send-eof proc))) | |
(defun paste-from-clipboard () | |
(if (eq system-type 'darwin) | |
(shell-command-to-string "pbpaste") | |
(shell-command-to-string "xsel -b -o"))) | |
(when (and (getenv "DISPLAY") (not window-system)) | |
(setq interprogram-cut-function 'copy-from-clipboard) | |
(setq interprogram-paste-function 'paste-from-clipboard)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment