According to the documentation of the command server-edit
:
Switch to next server editing buffer; say "Done" for current buffer. If a server buffer is current, it is marked "done" and optionally saved. The buffer is also killed if it did not exist before the clients asked for it. When all of a client's buffers are marked as "done", the client is notified.
I have seen many sources which mention this command. For example https://emacs.stackexchange.com/a/29461 says emacsclient waits for emacs server. When you do server-edit, the server notifies emacsclient to terminate.
My question is when do I actually need to call this command? I have the following in my init file.
(require 'server)
(unless (server-running-p) (server-start))
I open the files with emacsclient -n. Do I ever need server-edit
command?
Added: Occasionally (for the reasons that I don't know) emacsclient fails to connect to the server and emacsclient -n
opens a new instance of emacs and even when I completely exit from emacs and restart emacs, this inconvenient phenomenon continues. I don't know why this happens despite the fact that I always call emacsclient by -n
option. Later, I discovered that by running server-edit
this issue can be resolved. Despite the fact that the post linked by YoungFrog claims that I don't need to call server-edit
in this situation, it seems that server-edit
performs a magic even in this situation. Thus I decided to ask this question to know more about the command server-edit
beyond the existing documentation and few posts on this subject in this site, because I felt that I don't completely understand this command.
-n
flag to emacsclient (if you use it,server-edit
is... less useful)