aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDan Nicolaescu2008-10-27 07:02:30 +0000
committerDan Nicolaescu2008-10-27 07:02:30 +0000
commit4ff029f613a6f9a4bd54bf3b3e7763c25a510045 (patch)
tree5cfd4a8426c9fed83af07e022aa3d148332b00eb /src
parentb918aa6b5d512ffbdca994d0e60dfabc43fed6c3 (diff)
downloademacs-4ff029f613a6f9a4bd54bf3b3e7763c25a510045.tar.gz
emacs-4ff029f613a6f9a4bd54bf3b3e7763c25a510045.zip
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/emacs.c19
2 files changed, 22 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4de35db502f..6379e86b9e6 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12008-10-27 Dan Nicolaescu <dann@ics.uci.edu>
2
3 * emacs.c (daemon_name): New variable.
4 (main): Deal with --daemon=SERVER_NAME.
5 (Fdaemonp): Return a name if one was passed to --daemon.
6
12008-10-26 Romain Francoise <romain@orebokech.com> 72008-10-26 Romain Francoise <romain@orebokech.com>
2 8
3 * emacs.c (daemon_pipe): New variable. 9 * emacs.c (daemon_pipe): New variable.
diff --git a/src/emacs.c b/src/emacs.c
index bcc7fb05792..6f54291a514 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -237,6 +237,8 @@ int noninteractive1;
237 237
238/* Nonzero means Emacs was started as a daemon. */ 238/* Nonzero means Emacs was started as a daemon. */
239int is_daemon = 0; 239int is_daemon = 0;
240/* Name for the server started by the daemon.*/
241static char *daemon_name;
240 242
241/* Pipe used to send exit notification to the daemon parent at 243/* Pipe used to send exit notification to the daemon parent at
242 startup. */ 244 startup. */
@@ -796,6 +798,7 @@ main (int argc, char **argv)
796#endif 798#endif
797 int no_loadup = 0; 799 int no_loadup = 0;
798 char *junk = 0; 800 char *junk = 0;
801 char *dname_arg = 0;
799 802
800#if GC_MARK_STACK 803#if GC_MARK_STACK
801 extern Lisp_Object *stack_base; 804 extern Lisp_Object *stack_base;
@@ -1074,7 +1077,8 @@ main (int argc, char **argv)
1074 exit (0); 1077 exit (0);
1075 } 1078 }
1076 1079
1077 if (argmatch (argv, argc, "-daemon", "--daemon", 5, NULL, &skip_args)) 1080 if (argmatch (argv, argc, "-daemon", "--daemon", 5, NULL, &skip_args)
1081 || argmatch (argv, argc, "-daemon", "--daemon", 5, &dname_arg, &skip_args))
1078 { 1082 {
1079#ifndef DOS_NT 1083#ifndef DOS_NT
1080 pid_t f; 1084 pid_t f;
@@ -1123,6 +1127,8 @@ main (int argc, char **argv)
1123 exit (1); 1127 exit (1);
1124 } 1128 }
1125 1129
1130 if (dname_arg)
1131 daemon_name = xstrdup (dname_arg);
1126 /* Close unused reading end of the pipe. */ 1132 /* Close unused reading end of the pipe. */
1127 close (daemon_pipe[0]); 1133 close (daemon_pipe[0]);
1128 is_daemon = 1; 1134 is_daemon = 1;
@@ -2419,10 +2425,17 @@ decode_env_path (evarname, defalt)
2419} 2425}
2420 2426
2421DEFUN ("daemonp", Fdaemonp, Sdaemonp, 0, 0, 0, 2427DEFUN ("daemonp", Fdaemonp, Sdaemonp, 0, 0, 0,
2422 doc: /* Return t if the current emacs process is a daemon. */) 2428 doc: /* Return non-nil if the current emacs process is a daemon.
2429If the daemon was given a name argument, return that name. */)
2423 () 2430 ()
2424{ 2431{
2425 return is_daemon ? Qt : Qnil; 2432 if (is_daemon)
2433 if (daemon_name)
2434 return build_string (daemon_name);
2435 else
2436 return Qt;
2437 else
2438 return Qnil;
2426} 2439}
2427 2440
2428DEFUN ("daemon-initialized", Fdaemon_initialized, Sdaemon_initialized, 0, 0, 0, 2441DEFUN ("daemon-initialized", Fdaemon_initialized, Sdaemon_initialized, 0, 0, 0,