Mercurial > emacs
diff src/emacs.c @ 99158:d1d986962044
* emacs.c (daemon_name): New variable.
(main): Deal with --daemon=SERVER_NAME.
(Fdaemonp): Return a name if one was passed to --daemon.
* startup.el (server-name): Pacify byte compiler.
(command-line): If --daemon=SERVER_NAME was used, set server-name
before calling server-start.
* cmdargs.texi (Initial Options): Document -daemon=SERVER_NAME.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Mon, 27 Oct 2008 07:02:30 +0000 |
parents | 638063658f67 |
children | 8af0a96bf7da |
line wrap: on
line diff
--- a/src/emacs.c Mon Oct 27 05:43:17 2008 +0000 +++ b/src/emacs.c Mon Oct 27 07:02:30 2008 +0000 @@ -237,6 +237,8 @@ /* Nonzero means Emacs was started as a daemon. */ int is_daemon = 0; +/* Name for the server started by the daemon.*/ +static char *daemon_name; /* Pipe used to send exit notification to the daemon parent at startup. */ @@ -796,6 +798,7 @@ #endif int no_loadup = 0; char *junk = 0; + char *dname_arg = 0; #if GC_MARK_STACK extern Lisp_Object *stack_base; @@ -1074,7 +1077,8 @@ exit (0); } - if (argmatch (argv, argc, "-daemon", "--daemon", 5, NULL, &skip_args)) + if (argmatch (argv, argc, "-daemon", "--daemon", 5, NULL, &skip_args) + || argmatch (argv, argc, "-daemon", "--daemon", 5, &dname_arg, &skip_args)) { #ifndef DOS_NT pid_t f; @@ -1123,6 +1127,8 @@ exit (1); } + if (dname_arg) + daemon_name = xstrdup (dname_arg); /* Close unused reading end of the pipe. */ close (daemon_pipe[0]); is_daemon = 1; @@ -2419,10 +2425,17 @@ } DEFUN ("daemonp", Fdaemonp, Sdaemonp, 0, 0, 0, - doc: /* Return t if the current emacs process is a daemon. */) + doc: /* Return non-nil if the current emacs process is a daemon. +If the daemon was given a name argument, return that name. */) () { - return is_daemon ? Qt : Qnil; + if (is_daemon) + if (daemon_name) + return build_string (daemon_name); + else + return Qt; + else + return Qnil; } DEFUN ("daemon-initialized", Fdaemon_initialized, Sdaemon_initialized, 0, 0, 0,