(defun copy-from-osx () | |
(shell-command-to-string "pbpaste")) | |
(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)))) | |
(setq interprogram-cut-function 'paste-to-osx) | |
(setq interprogram-paste-function 'copy-from-osx)) |
Nice to hear! I'll check these days if Emacs 24 provides a better way of doing this.
One problem with this piece of code is encoding. It sometimes messes up unicode and I'm too lazy to fix this. Please let me hear if you find something better.
So I decided to try out tmux. It's great, except that I couldn't get it to work with Emacs. For some reason, C-y
was not yanking like it is supposed to. After much debugging, I finally traced it back to this code that I had copied into my init.el
. If I comment this out, C-y
works in Emacs under tmux
. I don't know exactly what the problem is; perhaps something related to the encoding issue you mentioned. Anyway, just an FYI for the next guy.
Thanks a lot for this. I've been using Emacs 24.3.1 and it works flawlessly (so far). Also works inside a tmux window/pane. Cheers !
ZOMG Thank you so much for this!
Thanks a lot!
This is just great! :D
typo:
(setq interprogram-paste-function 'copy-from-osx))
There is one )
too much.
Works as expected!!! Marked it as answer for http://emacs.stackexchange.com/questions/10900/copy-text-from-emacs-to-os-x-clipboard
It works like a charm, thanks!
Worked right off the bat!
Found this from Google search. Exactly what I wanted. Very nice indeed.
@the-kenny add (setenv "LANG" "en_US.UTF-8") can solve the non-ascii mess-up problem.
Thanks a lot!
Hey, I found this from a Google search, was exactly what I needed. Thanks!