Commit c3f995a2 authored by Juanma Barranquero's avatar Juanma Barranquero

* emacsclient.c [!WINDOWSNT] (EMACS_DAEMON): New define.

  Changes when EMACS_DAEMON is not defined:
  (print_help_and_exit): Don't add daemon information to help.
  (start_daemon_and_retry_set_socket): Make a no-op.
  (main): Don't set `start_daemon_if_needed' (which is initialized to 0).
parent 08d03897
2008-12-10 Juanma Barranquero <lekktu@gmail.com>
* emacsclient.c [!WINDOWSNT] (EMACS_DAEMON): New define.
Changes when EMACS_DAEMON is not defined:
(print_help_and_exit): Don't add daemon information to help.
(start_daemon_and_retry_set_socket): Make a no-op.
(main): Don't set `start_daemon_if_needed' (which is initialized to 0).
2008-12-10 Dan Nicolaescu <dann@ics.uci.edu>
* emacsclient.c (print_help_and_exit): Describe what an empty
......
......@@ -54,6 +54,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
# define CLOSE_SOCKET close
# define INITIALIZE()
# define EMACS_DAEMON
#endif /* !WINDOWSNT */
#undef signal
......@@ -615,10 +617,12 @@ The following OPTIONS are accepted:\n\
"-f, --server-file=FILENAME\n\
Set filename of the TCP authentication file\n\
-a, --alternate-editor=EDITOR\n\
Editor to fallback to if the server is not running\n\
If EDITOR is the empty string, start Emacs in daemon\n\
mode and try connecting again
\n\
Editor to fallback to if the server is not running\n"
#ifdef EMACS_DAEMON
" If EDITOR is the empty string, start Emacs in daemon\n\
mode and try connecting again\n"
#endif
"\n\
Report bugs to bug-gnu-emacs@gnu.org.\n", progname);
exit (EXIT_SUCCESS);
}
......@@ -1410,12 +1414,12 @@ w32_give_focus ()
}
#endif
/* Start the emacs daemon and try to connect to it. */
void
start_daemon_and_retry_set_socket (void)
{
#ifdef EMACS_DAEMON
pid_t dpid;
int status;
pid_t p;
......@@ -1453,9 +1457,9 @@ start_daemon_and_retry_set_socket (void)
execvp ("emacs", d_argv);
message (TRUE, "%s: error starting emacs daemon\n", progname);
}
#endif /* EMACS_DAEMON */
}
int
main (argc, argv)
int argc;
......@@ -1464,7 +1468,7 @@ main (argc, argv)
int i, rl, needlf = 0;
char *cwd, *str;
char string[BUFSIZ+1];
int null_socket_name, null_server_file, start_daemon_if_needed;
int null_socket_name, null_server_file, start_daemon_if_needed = 0;
main_argv = argv;
progname = argv[0];
......@@ -1480,10 +1484,12 @@ main (argc, argv)
exit (EXIT_FAILURE);
}
#ifdef EMACS_DAEMON
/* If alternate_editor is the empty string, start the emacs daemon
in case of failure to connect. */
start_daemon_if_needed = (alternate_editor
&& (alternate_editor[0] == '\0'));
#endif /* EMACS_DAEMON */
if (start_daemon_if_needed)
{
/* set_socket changes the values for socket_name and
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment