Allow emacsclient to set parameters of new graphical frames (bug#5864)

* lib-src/emacsclient.c (longopts, decode_options, main): Add frame-parameters.

* lisp/server.el (server-create-window-system-frame): Add parameters arg.
(server-process-filter): Doc fix.  Handle frame-parameters.

* doc/emacs/misc.texi (emacsclient Options): Mention --frame-parameters.
* doc/man/emacsclient.1: Mention --frame-parameters.

* etc/NEWS: Mention this.
This commit is contained in:
Andreas Rottmann 2011-06-25 11:05:48 -07:00 committed by Glenn Morris
parent 919bbce05b
commit 18a4ce5ea1
9 changed files with 62 additions and 3 deletions

View file

@ -160,6 +160,10 @@ const char *server_file = NULL;
/* PID of the Emacs server process. */
int emacs_pid = 0;
/* If non-NULL, a string that should form a frame parameter alist to
be used for the new frame */
const char *frame_parameters = NULL;
static void print_help_and_exit (void) NO_RETURN;
static void fail (void) NO_RETURN;
@ -175,6 +179,7 @@ struct option longopts[] =
{ "nw", no_argument, NULL, 't' },
{ "create-frame", no_argument, NULL, 'c' },
{ "alternate-editor", required_argument, NULL, 'a' },
{ "frame-parameters", required_argument, NULL, 'F' },
#ifndef NO_SOCKETS_IN_FILE_SYSTEM
{ "socket-name", required_argument, NULL, 's' },
#endif
@ -599,6 +604,10 @@ decode_options (int argc, char **argv)
print_help_and_exit ();
break;
case 'F':
frame_parameters = optarg;
break;
default:
message (TRUE, "Try `%s --help' for more information\n", progname);
exit (EXIT_FAILURE);
@ -1630,6 +1639,13 @@ main (int argc, char **argv)
send_to_emacs (emacs_socket, " ");
}
if (frame_parameters && !current_frame)
{
send_to_emacs (emacs_socket, "-frame-parameters ");
quote_argument (emacs_socket, frame_parameters);
send_to_emacs (emacs_socket, " ");
}
/* If using the current frame, send tty information to Emacs anyway.
In daemon mode, Emacs may need to occupy this tty if no other
frame is available. */