Created
October 20, 2011 11:52
-
-
Save ochko/1300960 to your computer and use it in GitHub Desktop.
It saves last item in emacs kill ring into clipboard
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-clipboard() | |
"Save last item in kill ring to clipboard" | |
(interactive) | |
(let ((tmp-file (make-temp-file "pbcopy"))) | |
(with-temp-buffer | |
(yank) | |
(when (file-writable-p tmp-file) | |
(write-region (point-min) | |
(point-max) | |
tmp-file) | |
(shell-command (concat "cat " tmp-file " | pbcopy"))) | |
(message "Selection is saved to clipboard")))) | |
(global-set-key (kbd "C-c C-c") 'copy-clipboard) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment