diff options
Diffstat (limited to 'src/emacs.c')
| -rw-r--r-- | src/emacs.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/emacs.c b/src/emacs.c index 400a6b0e594..d40ff3662f0 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -268,6 +268,7 @@ read the main documentation for these command-line arguments.\n\ Initialization options:\n\ \n\ --batch do not do interactive display; implies -q\n\ +--chdir DIR change to directory DIR\n\ --daemon start a server in the background\n\ --debug-init enable Emacs Lisp debugger for init file\n\ --display, -d DISPLAY use X server DISPLAY\n\ @@ -385,6 +386,9 @@ fatal_error_signal (sig) { fatal_error_in_progress = 1; + if (sig == SIGTERM || sig == SIGHUP) + Fkill_emacs (make_number (sig)); + shut_down_emacs (sig, 0, Qnil); } @@ -765,6 +769,7 @@ main (int argc, char **argv) #ifdef NS_IMPL_COCOA char dname_arg2[80]; #endif + char *ch_to_dir; #if GC_MARK_STACK extern Lisp_Object *stack_base; @@ -832,6 +837,14 @@ main (int argc, char **argv) exit (0); } } + if (argmatch (argv, argc, "-chdir", "--chdir", 2, &ch_to_dir, &skip_args)) + if (chdir (ch_to_dir) == -1) + { + fprintf (stderr, "%s: Can't chdir to %s: %s\n", + argv[0], ch_to_dir, strerror (errno)); + exit (1); + } + #ifdef HAVE_PERSONALITY_LINUX32 if (!initialized @@ -1802,6 +1815,7 @@ struct standard_args const struct standard_args standard_args[] = { { "-version", "--version", 150, 0 }, + { "-chdir", "--chdir", 130, 1 }, { "-t", "--terminal", 120, 1 }, { "-nw", "--no-window-system", 110, 0 }, { "-nw", "--no-windows", 110, 0 }, |
