Created
July 31, 2017 14:45
-
-
Save donilan/52fca391d50689516dfd5ca9cd6701e0 to your computer and use it in GitHub Desktop.
Copy/paste with system clipboard, support Chinese or other unicode.
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 copy-from-osx () | |
(shell-command-to-string "pbpaste")) | |
(defun paste-to-osx (text &optional push) | |
(let ((process-connection-type nil) | |
(lang (getenv "LANG")) | |
(default-directory "~")) | |
(setenv "LANG" "en_US.UTF-8") | |
(let ((proc (start-process "pbcopy" "*Messages*" "pbcopy"))) | |
(process-send-string proc text) | |
(process-send-eof proc)) | |
(setenv "LANG" lang))) | |
(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