Created
November 16, 2009 09:14
-
-
Save youpy/235873 to your computer and use it in GitHub Desktop.
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
| ;; kill ring をOSX のクリップボードと共有 | |
| ;; http://blog.lathi.net/articles/2007/11/07/sharing-the-mac-clipboard-with-emacs | |
| ;; http://d.hatena.ne.jp/edvakf/20080929/1222657230 | |
| (defun copy-from-osx () | |
| ;; (shell-command-to-string "pbpaste")) | |
| (shell-command-to-string "__CF_USER_TEXT_ENCODING=0x$(printf %x $(id -u)):0x08000100:14 pbpaste | nkf -W")) | |
| (defun paste-to-osx (text &optional push) | |
| (let ((process-connection-type nil)) | |
| ;; (let ((proc (start-process "pbcopy" "*Messages*" "pbcopy"))) | |
| (let ((proc (start-process-shell-command "pbcopy" "*Messages*" "nkf -w | __CF_USER_TEXT_ENCODING=0x$(printf %x $(id -u)):0x08000100:14 pbcopy"))) | |
| (process-send-string proc text) | |
| (process-send-eof proc)))) | |
| (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