summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2013-10-20 18:47:42 +0200
committerJan Djärv <jan.h.d@swipnet.se>2013-10-20 18:47:42 +0200
commita9f8deecce02a4acdb5259297878799b69d56a21 (patch)
treeb82dc27c4e754a3ec330f9e790b92955af57eb65
parent87756ca9f45b37ad8f7fbc6f392de4200ba5940b (diff)
downloademacs-a9f8deecce02a4acdb5259297878799b69d56a21.tar.gz
* emacs.c (main): On Cocoa, if GUI session and 0 is not a tty,
chdir to HOME. Fixes: debbugs:15607
-rw-r--r--src/ChangeLog3
-rw-r--r--src/emacs.c9
2 files changed, 9 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 48d681fed67..3ef9c636f0a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
2013-10-20 Jan Djärv <jan.h.d@swipnet.se>
+ * emacs.c (main): On Cocoa, if GUI session and 0 is not a tty,
+ chdir to HOME (bug#15607).
+
* nsterm.m (Qcocoa, Qgnustep): New variables.
(syms_of_nsterm): Defsym Qcocoa, Qgnustep. Fprovide appropriate one.
(ns_get_color): Make selection color work for GNUStep also.
diff --git a/src/emacs.c b/src/emacs.c
index 06b8d290cae..540084abc44 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1187,10 +1187,13 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
if (!noninteractive)
{
#ifdef NS_IMPL_COCOA
- if (skip_args < argc)
+ /* Started from GUI? */
+ /* FIXME: Do the right thing if getenv returns NULL, or if
+ chdir fails. */
+ if (! inhibit_window_system && ! isatty (0))
+ chdir (getenv ("HOME"));
+ else if (skip_args < argc)
{
- /* FIXME: Do the right thing if getenv returns NULL, or if
- chdir fails. */
if (!strncmp (argv[skip_args], "-psn", 4))
{
skip_args += 1;