mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-09 15:50:40 -08:00
New emacsclient option to either create or reuse an existing frame.
* doc/emacs/misc.texi (emacsclient Options): Document the new option. * doc/man/emacsclient.1: Mention the new option (bug#51374). * etc/NEWS: Mention the new option. * lib-src/emacsclient.c (reuse_frame): New variable. (longopts): New option. (decode_options): Decode the new option. (print_help_and_exit): Document the new option. (main): Use the new option.
This commit is contained in:
parent
a78ac0c5df
commit
2bcc2160c9
4 changed files with 28 additions and 1 deletions
|
|
@ -1992,6 +1992,11 @@ the new frame displays the @file{*scratch*} buffer by default. You
|
||||||
can customize this behavior with the variable @code{initial-buffer-choice}
|
can customize this behavior with the variable @code{initial-buffer-choice}
|
||||||
(@pxref{Entering Emacs}).
|
(@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}
|
@item -F @var{alist}
|
||||||
@itemx --frame-parameters=@var{alist}
|
@itemx --frame-parameters=@var{alist}
|
||||||
Set the parameters for a newly-created graphical frame
|
Set the parameters for a newly-created graphical frame
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,9 @@ start Emacs in daemon mode, and try to connect to it.
|
||||||
.B -c, \-\-create-frame
|
.B -c, \-\-create-frame
|
||||||
Create a new frame instead of trying to use the current Emacs frame.
|
Create a new frame instead of trying to use the current Emacs frame.
|
||||||
.TP
|
.TP
|
||||||
|
.B -r \-\-reuse-frame
|
||||||
|
Reuse an existing frame if one exists, otherwise create a new frame.
|
||||||
|
.TP
|
||||||
.B \-F, \-\-frame-parameters=ALIST
|
.B \-F, \-\-frame-parameters=ALIST
|
||||||
Set the parameters of a newly-created frame.
|
Set the parameters of a newly-created frame.
|
||||||
.TP
|
.TP
|
||||||
|
|
|
||||||
8
etc/NEWS
8
etc/NEWS
|
|
@ -102,6 +102,14 @@ highlights segments of buffer text whose reordering for display is
|
||||||
suspicious and could be malicious.
|
suspicious and could be malicious.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
** 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
|
* Editing Changes in Emacs 29.1
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,9 @@ static bool eval;
|
||||||
/* True means open a new frame. --create-frame etc. */
|
/* True means open a new frame. --create-frame etc. */
|
||||||
static bool create_frame;
|
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. */
|
/* The display on which Emacs should work. --display. */
|
||||||
static char const *display;
|
static char const *display;
|
||||||
|
|
||||||
|
|
@ -165,6 +168,7 @@ static struct option const longopts[] =
|
||||||
{ "tty", no_argument, NULL, 't' },
|
{ "tty", no_argument, NULL, 't' },
|
||||||
{ "nw", no_argument, NULL, 't' },
|
{ "nw", no_argument, NULL, 't' },
|
||||||
{ "create-frame", no_argument, NULL, 'c' },
|
{ "create-frame", no_argument, NULL, 'c' },
|
||||||
|
{ "reuse-frame", no_argument, NULL, 'r' },
|
||||||
{ "alternate-editor", required_argument, NULL, 'a' },
|
{ "alternate-editor", required_argument, NULL, 'a' },
|
||||||
{ "frame-parameters", required_argument, NULL, 'F' },
|
{ "frame-parameters", required_argument, NULL, 'F' },
|
||||||
#ifdef SOCKETS_IN_FILE_SYSTEM
|
#ifdef SOCKETS_IN_FILE_SYSTEM
|
||||||
|
|
@ -551,6 +555,11 @@ decode_options (int argc, char **argv)
|
||||||
create_frame = true;
|
create_frame = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'r':
|
||||||
|
create_frame = true;
|
||||||
|
reuse_frame = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'p':
|
case 'p':
|
||||||
parent_id = optarg;
|
parent_id = optarg;
|
||||||
create_frame = true;
|
create_frame = true;
|
||||||
|
|
@ -647,6 +656,8 @@ The following OPTIONS are accepted:\n\
|
||||||
-nw, -t, --tty Open a new Emacs frame on the current terminal\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\
|
-c, --create-frame Create a new frame instead of trying to\n\
|
||||||
use the current Emacs frame\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\
|
-F ALIST, --frame-parameters=ALIST\n\
|
||||||
Set the parameters of a new frame\n\
|
Set the parameters of a new frame\n\
|
||||||
|
|
@ -1941,7 +1952,7 @@ main (int argc, char **argv)
|
||||||
if (nowait)
|
if (nowait)
|
||||||
send_to_emacs (emacs_socket, "-nowait ");
|
send_to_emacs (emacs_socket, "-nowait ");
|
||||||
|
|
||||||
if (!create_frame)
|
if (!create_frame || reuse_frame)
|
||||||
send_to_emacs (emacs_socket, "-current-frame ");
|
send_to_emacs (emacs_socket, "-current-frame ");
|
||||||
|
|
||||||
if (display)
|
if (display)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue