Lurker News
Back to discussion

Comment by jnpatel

jnpatel1 reply#
Don't you frequently deal with:

  /private/tmp/foo.txt locked by jnpatel@mac... (pid 14836): (s, q, p, ?)?
because of the lock files?
__david__1 reply#
Nope, because emacsclient ends up opening them all in the same process (that's the beauty/entire point): Fork off an emacs in the background:

  emacs --daemon
Then run emacsclient to connect to it (open a new buffer in the daemon and switch to it):

  emacsclient -nw some_file
When you "quit" (with C-x C-c), it really just quits that client, but the main emacs is left running.

This has a number of benefits: 1) no locks like you mention, 2) access to all open buffers (even unsaved) from every emacsclient that's currently running (since they're really all just opening buffers in a single instance), 3) blazing startup speed (emacs is already running, you're just connecting to it and splatting a new buffer to the terminal).

krylon#
I still remember how happy I was when I found out about that. On all servers I use (at home and at work), starting an emacs daemon is usually among the first things I do after rebooting.