How do you close an emacsclient frame without killing the server/daemon?
Doing C-x C-c
or C-x 5 0
in the gui will exit both frame and server (and other clients), while this just quit the current frame when done from terminal.
(Ps: My emacs version is 24.2,gtk. I've tried without init-file to see if it was coming from my config, but results were the same)
Kill Emacs ( save-buffers-kill-terminal ). On a text terminal, suspend Emacs; on a graphical display, iconify (or “minimize”) the selected frame ( suspend-frame ). Killing Emacs means terminating the Emacs program. To do this, type C-x C-c ( save-buffers-kill-terminal ).
EmacsClient allows one to open a file for editing in an already running Emacs. Because it doesn't start a new Emacs instance at each invocation, you can set up EmacsClient as the default editor, e.g. in the environment variable EDITOR or VISUAL. EmacsClient is part of and works only in conjunction with GNU Emacs.
From the minibuffer, when emacsclient
starts:
When done with a buffer, type C-x #
I think the key point here is you need to start the server in daemon mode. If the server runs in an existing emacs process - for instance if you have (server-start)
in your init file - the server dies with the emacs process.
There are a couple of ways of starting the server in daemon mode:
emacs
with the --daemon
command line optionemacsclient
with the --alternate-editor=""
command line option, which will in effect run emacs --daemon
for you then attempt to connect to itOnce you have the server in daemon mode, you should be able to close any frames and the daemon will continue to sit and wait for further connections.
Starting the emacsclient
with -n
/--no-wait
flag will:
Don't wait for the server to return
You won't need to close the client in that case.
And if you have to a close emacsclient
just kill the buffer the server will remain intact.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With