Emacs copy and paste

copy/pasteemacs

How can I copy from emacs and paste into another instance of emacs or else where?

If I do C-space, M-w, and then C-y, I can only paste in the open instance of Emacs. If I navigate to another Emacs window or outside of Emacs, Crtl + v does nothing or paste something I copied that wasn't in Emacs.

I am looking for a solution the updates the init lisp script (~/.emacs). I don't want to switch programs. As of now, I have this in my .emacs but it doesn't seem to do the trick.

;; Copy and paste between Emac instances                                          
(setq x-select-enable-clipboard t)
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)

Best Answer

If you aren't running emacs in X mode, then it doesn't have access to the X clipboard, so you can't copy/paste with other X apps. You will have to use the copy/paste function of your xterm instead.

To copy/paste between different emacs sessions, the emacs way is to not run multiple sessions. Instead you can open frames on different terminals that are all bound to the same session, so they share the same kill ring. You do this by using M-x server-start in the main instance, then use emacsclient -t to open a new frame in another terminal.

Related Question