Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm running OSX 10.6.8. Lets say I have two terminal windows open and in each window I begin editing a different file using emacs. In the first file I select some text and then copy it (M-w), and in the second file I then try and paste it (C-y). I thought this would paste what I copied from the other file but instead I get the error message "previous command was not a yank".

Those commands work just fine for copying and pasting within a single file, how do I copy and paste between different files?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

As far as I know, emacs has no idea that a completely different instance of emacs is running in a separate Terminal.app window. You need to use the Mac's Cmd-C and Cmd-V.

I could be wrong, perhaps emacs can be set up to use some form of IPC to find other separate running instances of emacs and try to share things like clipboards between them, but that seems unusual.See @IvanAndrus' Answer for how to use emacsclient to have emacs instances work together.

If you want emacs in separate GUI windows, you might also look at Aquamacs.

Updated to add: You could also learn to use emacs' native ability to edit multiple files/buffers within the same instance: http://www.gnu.org/software/emacs/manual/html_node/emacs/Buffers.html

share|improve this answer
1  
You can (and should) use emacsclient if you want to use emacs in another terminal window. Then you'll be running the same emacs session in both terminals and copy/paste will work correctly. –  Ivan Andrus Mar 23 '12 at 8:57
    
@IvanAndrus Please post that as an Answer. I might keep my Answer up to give people other options to consider, but I think your answer is more in the spirit of what JStarx was trying to do. –  Spiff Mar 23 '12 at 9:01
    
It was what I was trying to do, but I wasn't aware I could open more than one file! Thanx. –  Jim Mar 23 '12 at 21:09
add comment

You can (and should) use emacsclient if you want to use emacs in another terminal window (or even on a remote server). Then you'll be running the same emacs session in both terminals and copy/paste will work correctly. You can also combine this with GUI sessions. You do have to start the server in your .emacs file.

On this EmacsWiki page there are many examples of how to write scripts which will start an Emacs session if one isn't already running or connect to it if it's started. You may also want to try running Emacs as a daemon so that Emacs will keep running even though you have disconnected all your terminals.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.