Skip to content

Instantly share code, notes, and snippets.

@znz
Last active December 27, 2015 06:08
Show Gist options
  • Save znz/7279123 to your computer and use it in GitHub Desktop.
Save znz/7279123 to your computer and use it in GitHub Desktop.
=== modified file 'src/ChangeLog'
--- src/ChangeLog 2013-10-20 09:55:25 +0000
+++ src/ChangeLog 2013-10-20 16:47:42 +0000
@@ -1,5 +1,8 @@
2013-10-20 Jan Djärv <[email protected]>
+ * 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.
=== modified file 'src/emacs.c'
--- src/emacs.c 2013-10-17 03:08:59 +0000
+++ src/emacs.c 2013-10-20 16:47:42 +0000
@@ -1187,10 +1187,13 @@
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;
=== modified file 'src/ChangeLog'
--- src/ChangeLog 2013-10-31 07:18:42 +0000
+++ src/ChangeLog 2013-10-31 08:32:42 +0000
@@ -1,3 +1,7 @@
+2013-10-31 Jan Djärv <[email protected]>
+
+ * emacs.c (main): Skip -psn args on OSX even if ! isatty (0).
+
2013-10-31 Glenn Morris <[email protected]>
* emacs.c (original_pwd): New char.
=== modified file 'src/emacs.c'
--- src/emacs.c 2013-10-31 07:18:42 +0000
+++ src/emacs.c 2013-10-31 08:32:42 +0000
@@ -1201,7 +1201,7 @@
chdir fails. */
if (! inhibit_window_system && ! isatty (0))
chdir (getenv ("HOME"));
- else if (skip_args < argc)
+ if (skip_args < argc)
{
if (!strncmp (argv[skip_args], "-psn", 4))
{
--- src/emacs.c.orig 2013-02-06 13:33:36.000000000 +0900
+++ src/emacs.c 2013-11-02 22:38:45.000000000 +0900
@@ -1158,10 +1158,13 @@
if (!noninteractive)
{
#ifdef NS_IMPL_COCOA
+ /* 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"));
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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment