Subject: bug#9305: emacsclient -n -c path/to/file # opens *scratch*

From: Chong Yidong <[email-masked]>
Date: Sat, 20 Aug 2011 18:35:50 -0400

Stefan Klinger <[email-masked]> writes:

> Now request first frame and start emacs daemon, works as expected
>
>   emacsclient -n -a '' -c ~/.bashrc
>
> Now, as long as the frame showing ‘~/.bashrc’ is visible (potentially
> on another desktop), the following three commands each open a new
> frame, each of them showing *scratch*:
>
>   emacsclient -n -a '' -c ~/.bashrc
>   emacsclient -n -c ~/.bashrc
>   emacsclient -c ~/.bashrc
>
> When there's no frame showing ‘~/.bashrc’, then each of the above
> creates a new frame showing the existing buffer.
>
> -- Expected bahavior --
>
> Check whether there is a buffer visiting test. If so, show that buffer
> in the new frame. Otherwise, visit the file in a new buffer and
> display that one.

Yeah, the -c option to emacsclient means "create a new graphical frame".
Currently, you need to omit -c if you want Emacs to reuse an existing
frame.

The trouble with this is that if no existing graphical frame exists,
that will create a tty frame.  Unfortunately, we don't offer an easy way
to change this behavior yet.  This ought to be fixed, though probably
for Emacs 24.2.