I have (cua-mode t) in my .emacs, so that C-c is copy and C-v is paste just like most other programs on my desktop (Ubuntu, Gnome, Linux). However, Emacs does not seem to share the clipboard/copy buffer with other programs.
For example, if I C-c in Firefox I can S-C-v to paste into a terminal or C-v to paste into gedit. However, if I C-v (or C-y) in emacs, I do not get what I copied from Firefox.
Is there any way to make this work? Is there another command I can use to access the system's copy-paste buffer?
This works on my machine:
;; CUA OS copypasta even in ncurses mode (case system-type ('darwin (unless window-system (setq interprogram-cut-function (lambda (text &optional push) (let* ((process-connection-type nil) (pbproxy (start-process "pbcopy" "pbcopy" "/usr/bin/pbcopy"))) (process-send-string pbproxy text) (process-send-eof pbproxy)))))) ('gnu/linux (progn (setq x-select-enable-clipboard t) (defun xsel-cut-function (text &optional push) (with-temp-buffer (insert text) (call-process-region (point-min) (point-max) "xsel" nil 0 nil "--clipboard" "--input"))) (defun xsel-paste-function() (let ((xsel-output (shell-command-to-string "xsel --clipboard --output"))) (unless (string= (car kill-ring) xsel-output) xsel-output ))) (setq interprogram-cut-function 'xsel-cut-function) (setq interprogram-paste-function 'xsel-paste-function))))