This might be extraordinarily simple, but I am playing with Emacs (22.1.1) and I can\'t get it to paste text in the clipboard using Control-Y.
See http://blog.binchen.org/?p=589
Here is code:
(require 'simpleclip)
(defun copy-to-clipboard ()
(interactive)
(let ((thing (if (region-active-p)
(buffer-substring-no-properties (region-beginning) (region-end))
(thing-at-point 'symbol))))
(simpleclip-set-contents thing)
(message "thing => clipboard!")))
(defun paste-from-clipboard()
"Paste string clipboard"
(interactive)
(insert (simpleclip-get-contents)))
The code use simpleclip (https://github.com/rolandwalker/simpleclip)
Simpleclip requires you install some command line tool on Mac/Linux/Cygwin which . So even emacs without graphic support could also access clipboard.
This solution works on any version of Emacs, any OS. It also works when your remote ssh if the server enables X forward, the complete command is ssh -X -C -c blowfish-cbc,arcfour name@host.com
)