* Re: about the undocumented options -psn_*
2013-10-16 16:40 ` Jan Djärv
@ 2013-10-17 2:56 ` YAMAMOTO Mitsuharu
0 siblings, 0 replies; 3+ messages in thread
From: YAMAMOTO Mitsuharu @ 2013-10-17 2:56 UTC (permalink / raw)
To: Jan Djärv; +Cc: emacs-devel, Darren Hoo
>>>>> On Wed, 16 Oct 2013 18:40:52 +0200, Jan Djärv <jan.h.d@swipnet.se> said:
> Hello.
> When started from the GUI (Dock, Finder, open), the launcher adds a -psn_hi_low option where hi and low are numbers (hi usually 0) that form the process serial number. Not sure what it is used for. If however you pass any argument to the program, like:
> % open -a Emacs --args -Q
> no -psn-option is passed.
> In Emacs it acts like a "started from GUI"-detector.
I'm thinking about stopping relying on this option for changing the
default directory in the next version of the Mac port (planned shortly
after the release of OS X Mavericks.)
YAMAMOTO Mitsuharu
mituharu@math.s.chiba-u.ac.jp
=== modified file 'mac/Emacs.app/Contents/MacOS/Emacs.sh'
*** mac/Emacs.app/Contents/MacOS/Emacs.sh 2013-09-21 09:48:19 +0000
--- mac/Emacs.app/Contents/MacOS/Emacs.sh 2013-10-17 02:45:32 +0000
***************
*** 23,28 ****
--- 23,37 ----
filename="$(basename "$0")"
set "$(dirname "$0")/${filename%.sh}" "$@"
+ case $PWD in
+ /)
+ # As of OS X 10.8, this is always the case if invoked from the
+ # launch service. Just in case this behavior is changed on
+ # future versions...
+ cd
+ ;;
+ esac
+
case $(sw_vers -productVersion) in
10.[0-7]|10.[0-7].*)
# "$HOME/.MacOSX/environment.plist" is ignored on OS X 10.8.
=== modified file 'src/emacs.c'
*** src/emacs.c 2013-02-09 07:26:28 +0000
--- src/emacs.c 2013-10-17 02:45:32 +0000
***************
*** 794,809 ****
}
#endif /* HAVE_PERSONALITY_LINUX32 */
- #ifdef HAVE_MACGUI
- /* Skip process serial number passed in the form -psn_x_y as
- command-line argument. The WindowServer adds this option when
- Emacs is invoked from the Finder or by the `open' command. In
- these cases, the working directory becomes `/', so we change it
- to the user's home directory. */
- if (argc > skip_args + 1 && strncmp (argv[skip_args+1], "-psn_", 5) == 0)
- chdir (getenv ("HOME"));
- #endif /* HAVE_MACGUI */
-
#if defined (HAVE_SETRLIMIT) && defined (RLIMIT_STACK)
/* Extend the stack space available.
Don't do that if dumping, since some systems (e.g. DJGPP)
--- 794,799 ----
^ permalink raw reply [flat|nested] 3+ messages in thread