diff options
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ChangeLog | 8 | ||||
| -rw-r--r-- | lib-src/emacsclient.c | 20 |
2 files changed, 21 insertions, 7 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 7cb4cda2013..b8c5868a93e 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2008-12-10 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | * emacsclient.c [!WINDOWSNT] (EMACS_DAEMON): New define. | ||
| 4 | Changes when EMACS_DAEMON is not defined: | ||
| 5 | (print_help_and_exit): Don't add daemon information to help. | ||
| 6 | (start_daemon_and_retry_set_socket): Make a no-op. | ||
| 7 | (main): Don't set `start_daemon_if_needed' (which is initialized to 0). | ||
| 8 | |||
| 1 | 2008-12-10 Dan Nicolaescu <dann@ics.uci.edu> | 9 | 2008-12-10 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 10 | ||
| 3 | * emacsclient.c (print_help_and_exit): Describe what an empty | 11 | * emacsclient.c (print_help_and_exit): Describe what an empty |
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index e96cf4ef358..005d8853974 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -54,6 +54,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 54 | # define CLOSE_SOCKET close | 54 | # define CLOSE_SOCKET close |
| 55 | # define INITIALIZE() | 55 | # define INITIALIZE() |
| 56 | 56 | ||
| 57 | # define EMACS_DAEMON | ||
| 58 | |||
| 57 | #endif /* !WINDOWSNT */ | 59 | #endif /* !WINDOWSNT */ |
| 58 | 60 | ||
| 59 | #undef signal | 61 | #undef signal |
| @@ -615,10 +617,12 @@ The following OPTIONS are accepted:\n\ | |||
| 615 | "-f, --server-file=FILENAME\n\ | 617 | "-f, --server-file=FILENAME\n\ |
| 616 | Set filename of the TCP authentication file\n\ | 618 | Set filename of the TCP authentication file\n\ |
| 617 | -a, --alternate-editor=EDITOR\n\ | 619 | -a, --alternate-editor=EDITOR\n\ |
| 618 | Editor to fallback to if the server is not running\n\ | 620 | Editor to fallback to if the server is not running\n" |
| 619 | If EDITOR is the empty string, start Emacs in daemon\n\ | 621 | #ifdef EMACS_DAEMON |
| 620 | mode and try connecting again | 622 | " If EDITOR is the empty string, start Emacs in daemon\n\ |
| 621 | \n\ | 623 | mode and try connecting again\n" |
| 624 | #endif | ||
| 625 | "\n\ | ||
| 622 | Report bugs to bug-gnu-emacs@gnu.org.\n", progname); | 626 | Report bugs to bug-gnu-emacs@gnu.org.\n", progname); |
| 623 | exit (EXIT_SUCCESS); | 627 | exit (EXIT_SUCCESS); |
| 624 | } | 628 | } |
| @@ -1410,12 +1414,12 @@ w32_give_focus () | |||
| 1410 | } | 1414 | } |
| 1411 | #endif | 1415 | #endif |
| 1412 | 1416 | ||
| 1413 | |||
| 1414 | /* Start the emacs daemon and try to connect to it. */ | 1417 | /* Start the emacs daemon and try to connect to it. */ |
| 1415 | 1418 | ||
| 1416 | void | 1419 | void |
| 1417 | start_daemon_and_retry_set_socket (void) | 1420 | start_daemon_and_retry_set_socket (void) |
| 1418 | { | 1421 | { |
| 1422 | #ifdef EMACS_DAEMON | ||
| 1419 | pid_t dpid; | 1423 | pid_t dpid; |
| 1420 | int status; | 1424 | int status; |
| 1421 | pid_t p; | 1425 | pid_t p; |
| @@ -1453,9 +1457,9 @@ start_daemon_and_retry_set_socket (void) | |||
| 1453 | execvp ("emacs", d_argv); | 1457 | execvp ("emacs", d_argv); |
| 1454 | message (TRUE, "%s: error starting emacs daemon\n", progname); | 1458 | message (TRUE, "%s: error starting emacs daemon\n", progname); |
| 1455 | } | 1459 | } |
| 1460 | #endif /* EMACS_DAEMON */ | ||
| 1456 | } | 1461 | } |
| 1457 | 1462 | ||
| 1458 | |||
| 1459 | int | 1463 | int |
| 1460 | main (argc, argv) | 1464 | main (argc, argv) |
| 1461 | int argc; | 1465 | int argc; |
| @@ -1464,7 +1468,7 @@ main (argc, argv) | |||
| 1464 | int i, rl, needlf = 0; | 1468 | int i, rl, needlf = 0; |
| 1465 | char *cwd, *str; | 1469 | char *cwd, *str; |
| 1466 | char string[BUFSIZ+1]; | 1470 | char string[BUFSIZ+1]; |
| 1467 | int null_socket_name, null_server_file, start_daemon_if_needed; | 1471 | int null_socket_name, null_server_file, start_daemon_if_needed = 0; |
| 1468 | 1472 | ||
| 1469 | main_argv = argv; | 1473 | main_argv = argv; |
| 1470 | progname = argv[0]; | 1474 | progname = argv[0]; |
| @@ -1480,10 +1484,12 @@ main (argc, argv) | |||
| 1480 | exit (EXIT_FAILURE); | 1484 | exit (EXIT_FAILURE); |
| 1481 | } | 1485 | } |
| 1482 | 1486 | ||
| 1487 | #ifdef EMACS_DAEMON | ||
| 1483 | /* If alternate_editor is the empty string, start the emacs daemon | 1488 | /* If alternate_editor is the empty string, start the emacs daemon |
| 1484 | in case of failure to connect. */ | 1489 | in case of failure to connect. */ |
| 1485 | start_daemon_if_needed = (alternate_editor | 1490 | start_daemon_if_needed = (alternate_editor |
| 1486 | && (alternate_editor[0] == '\0')); | 1491 | && (alternate_editor[0] == '\0')); |
| 1492 | #endif /* EMACS_DAEMON */ | ||
| 1487 | if (start_daemon_if_needed) | 1493 | if (start_daemon_if_needed) |
| 1488 | { | 1494 | { |
| 1489 | /* set_socket changes the values for socket_name and | 1495 | /* set_socket changes the values for socket_name and |