Created
February 4, 2014 08:57
-
-
Save youpy/8800251 to your computer and use it in GitHub Desktop.
Sharing clipboard between Emacs and OS X without invoking a shell
This file contains hidden or 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
(defun paste-to-osx (text &optional push) | |
(let ((process-connection-type nil)) | |
(let ((proc (start-process "pbcopy" "*Messages*" "pbcopy"))) | |
(process-send-string proc text) | |
(process-send-eof proc)))) | |
(defun copy-from-osx () | |
(let ((buf (get-buffer-create "*pbpaste*"))) | |
(with-current-buffer buf | |
(erase-buffer) | |
(call-process "pbpaste" nil "*pbpaste*") | |
(buffer-string)))) | |
(setq interprogram-cut-function 'paste-to-osx) | |
(setq interprogram-paste-function 'copy-from-osx) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment