all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Fazal Majid <majid@apsalar.com>
To: 15776@debbugs.gnu.org
Subject: bug#15776: On Mac OS X 10.9 Mavericks, Cocoa Emacs starts in the root directory instead of the home directory
Date: Thu, 31 Oct 2013 23:04:46 -0700	[thread overview]
Message-ID: <8836FBC9-C1AB-4B94-AC54-86FB8FDC559C@apsalar.com> (raw)

I have a build of GNU Emacs for the Mac. On 10.8 Mountain Lion, launching the app works normally - the working directory is my home directory. On 10.9 Mavericks. when launched from the Dock or Finder, the default directory is the root directory instead of my home directory. If launched from the command-line, the correct behavior holds.

It looks like there is custom code in src/emacs.c #ifdef-ed for HAVE_NS and NS_IMPL_COCOA that checks to see if the first or second command-line argument starts with “-psn”, and if so, perform a chdir(getenv(“HOME”)).

It seems like the behavior changes in Mavericks, and apps no longer get the -psn command-line argument. Apps are always launched with a cwd of /, even in Mountain Lion, but now Emacs is not taking corrective action.

The solution is probably to do a version check of OS X and if 10.9 or above, do the chdir anyway.

Here is the patch I am using, which is cruder, as it does not check for OS X version:

--- emacs-24.3/src/emacs.c.dist	2013-10-31 22:36:23.000000000 -0700
+++ emacs-24.3/src/emacs.c	2013-10-31 23:00:45.000000000 -0700
@@ -1173,6 +1173,9 @@
               chdir (getenv ("HOME"));
             }
         }
+      /* On Mavericks, there is no -psn command-line argument so do this anyway,
+         otherwise the CWD would be the root directory */
+      chdir (getenv ("HOME"));
 #endif  /* COCOA */
     }
 #endif /* HAVE_NS */


— Fazal Majid

In GNU Emacs 24.3.1 (x86_64-apple-darwin13.0.0, NS apple-appkit-1265.00)
 of 2013-10-31 on undr.majid.org
Windowing system distributor `Apple', version 10.3.1265
Configured using:
 `configure '--prefix' '/usr/local' '--with-ns' '--with-gif=no'
 '--x-includes=/usr/X11R6/include' '--x-libraries=/usr/X11R6/lib'
 '--with-xpm' 'CC=clang''

Important settings:
  locale-coding-system: nil
  default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x C-f C-g M-x r e p <tab> o <tab> r <tab> <retur
n>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Quit
Making completion list... [2 times]

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr warnings emacsbug message format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils help-mode server disp-table ps-print
ps-def lpr vc vc-dispatcher python rx comint ring ansi-color cc-mode
cc-fonts easymenu cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs time-date tooltip ediff-hook vc-hooks lisp-float-type
mwheel ns-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process ns multi-tty emacs)

--
Fazal Majid
CTO, Apsalar Inc.
majid@apsalar.com
+1 415 347-1277 (347-1APP)






             reply	other threads:[~2013-11-01  6:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-01  6:04 Fazal Majid [this message]
2013-11-01  8:19 ` bug#15776: On Mac OS X 10.9 Mavericks, Cocoa Emacs starts in the root directory instead of the home directory Jan Djärv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8836FBC9-C1AB-4B94-AC54-86FB8FDC559C@apsalar.com \
    --to=majid@apsalar.com \
    --cc=15776@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.