I'm trying to set my desktop environment to use emacsclient to open text files.

I would like only one emacs x-window to be opened. Yet I don't know which command can be used to have an x-window created if and only if no emacs x-window already exists.

  • The command emacsclient %F doesn't work when no x-window exists.

  • The command emacsclient -c %F always creates a new x-window.

  • I don't know how to check for the existence of an emacs x-window.

Which command / script should I use ?

By x-window I mean 'what a window is for the window-manager'

emacsclient -a /usr/bin/emacs %F

If you also want to use daemon mode, see Make emacsclient create a frame only if there isn't one already

Not the answer you're looking for? Browse other questions tagged or ask your own question.