/* 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;
{ "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
#define IS_DEVICE_SEP(_c_) ((_c_) == DEVICE_SEP)
#endif
#endif
-#ifndef IS_ANY_SEP
-#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_))
-#endif
+char *get_current_dir_name (void);
/* Return the current working directory. Returns NULL on errors.
Any other returned value must be freed with free. This is used
/* Display a normal or error message.
On Windows, use a message box if compiled as a Windows app. */
+static void message (int, const char *, ...) ATTRIBUTE_FORMAT_PRINTF (2, 3);
static void
message (int is_error, const char *format, ...)
{
{
int opt = getopt_long_only (argc, argv,
#ifndef NO_SOCKETS_IN_FILE_SYSTEM
- "VHneqa:s:f:d:tc",
+ "VHneqa:s:f:d:F:tc",
#else
- "VHneqa:f:d:tc",
+ "VHneqa:f:d:F:tc",
#endif
longopts, 0);
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);
an empty string");
exit (EXIT_FAILURE);
}
+
+ /* TTY frames not supported on Windows. Continue using GUI rather than
+ forcing the user to change their command-line. This is required since
+ tty is set above if certain options are given and $DISPLAY is not set,
+ which is not obvious to users. */
+ if (tty)
+ tty = 0;
+
#endif /* WINDOWSNT */
}
-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\
+-F ALIST, --frame-parameters=ALIST\n\
+ Set the parameters of a new frame\n\
-e, --eval Evaluate the FILE arguments as ELisp expressions\n\
-n, --no-wait Don't wait for the server to return\n\
-q, --quiet Don't display messages on success\n\
0 - success: none of the above */
static int
-socket_status (char *name)
+socket_status (const char *name)
{
struct stat statbfr;
int
main (int argc, char **argv)
{
- int rl, needlf = 0;
+ int rl = 0, needlf = 0;
char *cwd, *str;
char string[BUFSIZ+1];
int null_socket_name IF_LINT ( = 0);
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. */