diff options
Diffstat (limited to 'lib-src/emacsclient.c')
-rw-r--r-- | lib-src/emacsclient.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 57a5eff3bf6..365e803e1cd 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -116,6 +116,9 @@ static bool eval; /* 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; @@ -165,6 +168,7 @@ static struct option const longopts[] = { "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 @@ -551,6 +555,11 @@ decode_options (int argc, char **argv) create_frame = true; break; + case 'r': + create_frame = true; + reuse_frame = true; + break; + case 'p': parent_id = optarg; create_frame = true; @@ -594,9 +603,16 @@ decode_options (int argc, char **argv) alt_display = "ns"; #elif defined (HAVE_NTGUI) alt_display = "w32"; +#elif defined (HAVE_HAIKU) + alt_display = "be"; #endif +#ifdef HAVE_PGTK + display = egetenv ("WAYLAND_DISPLAY"); + alt_display = egetenv ("DISPLAY"); +#else display = egetenv ("DISPLAY"); +#endif } if (!display) @@ -647,6 +663,8 @@ The following OPTIONS are accepted:\n\ -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\ @@ -1744,8 +1762,9 @@ start_daemon_and_retry_set_socket (void) } /* Try connecting, the daemon should have started by now. */ - message (true, - "Emacs daemon should have started, trying to connect again\n"); + if (!quiet) + message (true, + "Emacs daemon should have started, trying to connect again\n"); } else if (dpid < 0) { @@ -1836,7 +1855,7 @@ start_daemon_and_retry_set_socket (void) /* Try connecting, the daemon should have started by now. */ /* It's just a progress message, so don't pop a dialog if this is emacsclientw. */ - if (!w32_window_app ()) + if (!quiet && !w32_window_app ()) message (true, "Emacs daemon should have started, trying to connect again\n"); #endif /* WINDOWSNT */ @@ -1940,7 +1959,7 @@ main (int argc, char **argv) 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) |