I start emacs server using
emacs --daemon
then open files using
emacsclient filename.ext
but the first file has to be opened using
emacsclient -c filename.ext
in order to create a new frame which can be later used by subsequent files without using -c
command line flag for emacsclient.
I want to automate this. "if there is no emacs frame, emacsclient should create a frame else it should use the current frame". How can it be done?
Best Answer
This is like dimitri's solution, but it handles the case when emacs was launched as
emacs --daemon
.emacs --daemon
makes a hidden window that causesxprop
to give a false positive when checking for an existing window.