Automatic copy from X11.app to MacOS Clipboard
Well, from emacs under X11 anyway...
This has bugged me for a long lONG time. I have been doing a bit of unix coding on my laptop this weekend and it finally got to me. There MUST be a way I thought.
A lot of people suggest autocutsel but all that does is synchronise the X11 CLIPBOARD buffer (or PRIMARY buffer) with the selection buffer. I'm sure this solves issues with some X11 apps that only use one or the other and X11.app may get confused. But that's not what I'm talking about.
I'm talking about:
- make a selection in emacs, yank a line, do whatever you want that "copies" a piece of text to the "clipboard" (for suitably vague meanings of those terms)
- switch to a MacOS app
- paste in the text copied in step 1.
(if (eq window-system 'x) (progn (defun paste-to-osx (text &optional push) (progn (let ((process-connection-type nil)) ; use pipe (let ((proc (start-process "pbcopy" "*Messages*" "pbcopy"))) (process-send-string proc text) (process-send-eof proc))))) (setq interprogram-cut-function 'paste-to-osx)))Update: After reviewing this entry on my front page it occurred to me how unlikely it is that anyone has ever hacked up a lisp code fragment directly after some visual basic! At least the foray into a little visual basic hasn't rotted my coding brain :)
03:26 AM, 30 Oct 2006 by Mark Aufflick Permalink