can customize this behavior with the variable @code{initial-buffer-choice}
(@pxref{Entering Emacs}).
+@item -r
+@itemx --reuse-frame
+Create a new graphical @dfn{client frame} if none exists, otherwise
+use an existing Emacs frame.
+
@item -F @var{alist}
@itemx --frame-parameters=@var{alist}
Set the parameters for a newly-created graphical frame
suspicious and could be malicious.
\f
+
+** Emacs server and client changes
+
++++
+*** New command-line option '-r' for emacsclient.
+With this command-line option, Emacs reuses an existing graphical client
+frame if one exists; otherwise a new frame is created.
+
* Editing Changes in Emacs 29.1
---
/* True means open a new frame. --create-frame etc. */
static bool create_frame;
+/* True means reuse a frame if it already exists. */
+static bool reuse_frame;
+
/* The display on which Emacs should work. --display. */
static char const *display;
{ "tty", no_argument, NULL, 't' },
{ "nw", no_argument, NULL, 't' },
{ "create-frame", no_argument, NULL, 'c' },
+ { "reuse-frame", no_argument, NULL, 'r' },
{ "alternate-editor", required_argument, NULL, 'a' },
{ "frame-parameters", required_argument, NULL, 'F' },
#ifdef SOCKETS_IN_FILE_SYSTEM
create_frame = true;
break;
+ case 'r':
+ create_frame = true;
+ reuse_frame = true;
+ break;
+
case 'p':
parent_id = optarg;
create_frame = true;
-nw, -t, --tty Open a new Emacs frame on the current terminal\n\
-c, --create-frame Create a new frame instead of trying to\n\
use the current Emacs frame\n\
+-r, --reuse-frame Create a new frame if none exists, otherwise\n\
+ use the current Emacs frame\n\
", "\
-F ALIST, --frame-parameters=ALIST\n\
Set the parameters of a new frame\n\
if (nowait)
send_to_emacs (emacs_socket, "-nowait ");
- if (!create_frame)
+ if (!create_frame || reuse_frame)
send_to_emacs (emacs_socket, "-current-frame ");
if (display)