views:

802

answers:

1

Hi all, I wonder if anyone has any recommendations as to setup of emacs 23 on OS X. I have been using Linux/Windows for a while and there, I would just open many instances of emacs and they were self-contained - for instance, I could have two separate files in separate frames, each with their own R, Python, and/or shell running. I think this is frowned upon(?) - but it kept the working directory for each script file separate, which I loved.

I understand there is some advantage to setting (server-start) in my .emacs file and calling 'emacsclient' rather than 'Emacs' is now the preferred way(?). I found this thread which facilitates this to occur through an Applescript: http://stackoverflow.com/questions/945709/emacs-23-os-x-multi-tty-and-emacsclient

But I wonder if this the only way to go about it - when I open two emacs instances on OS X it gives me the error:

** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x3803, name = 'org.gnu.Emacs.ServiceProvider'

but opens a new frame allows me to edit files. I understand that for vim on OS X there is something called 'mvim' which allows multiple instances of vim to be launched, but is there something similar for emacs? Sorry for the long-winded question - in summary, I guess these are the questions for which I would like to solicit your expertise:

(1) Is 'emacsclient' the way of the experts, and (2) if not necessarily, is there a way to get multiple instances of emacs 23 (not just frames) running on OS X?

Thanks! -Stephen

+2  A: 

Let me answer your questions indirectly.

As you know, emacsclient provides a service, allowing users to open documents from outside Emacs in an existing Emacs. Is this "the way" of the experts? Depends on the expert. I'm a heavy user of Emacs, but never use emacsclient. Why? Because I never leave Emacs in the first place. All the shells I run are inside Emacs (using a home-brewed screen package), I read mail in Emacs, etc. There's never a reason for me to type emacsclient at a command line.

Your usage model seems to be that you prefer having multiple Emacsen running, making it easier to keep track of which processes and files are being used together. And that makes sense. You could do it all in one Emacs if you wish, but it might take some changes in your usage model, or some customizations to help manage multiple interpreters/shells/whatever to your liking.

So, if you like multiple instances of Emacs running, then by all means, continue doing so.

Regarding the second question, it appears as though having (server-start) in your .emacs is causing problems - likely because there's a conflict with two Emacsen trying to use the same port. Check out the documentation for starting the server, and perhaps remove that line from your .emacs, and instead start the server once by using the --daemon command line option.

Then, at the command line, you have the choice of whether you want to start a new emacs (by typing emacs) or connect to the server you started (by typing emacsclient).

Trey Jackson
Thanks for your response - I don't have (server-start) on when I get the bootstrap_register fail, and still get a warning (can't connect to server) when the server is running and I start another instance. I think this is an OS X app thing: http://osdir.com/ml/emacs.macintosh.osx/2005-07/msg00036.html, and the Carbon Emacs page foreshadows warnings when opening multiple instances. From what I gather my options are to (1) ignore the warnings and continue working in the second/third/... instance, or (2) become better at trying to manage multiple working directories.
Stephen
to continue (hit 600char limit before) - thanks for the suggestion. Your suggestion does indeed work, albeit with warnings (and the first file I edit is associated with the server instance).
Stephen
I needed to run emacsclient a few days ago to access my session at work from home so I could check the output of some commands running in a shell. I also like using it for $EDITOR so I can have a nice environment for editing crontabs, etc.
Just Some Guy