Subject: bug#40924: 27.0.91; default-directory launched via Dock MacOS

From: Tak Kunihiro <[email-masked]>
Date: Sun, 3 May 2020 11:52:49 +0900

> From scratch buffer on emacs 26.3, C-x C-f prompts home directory
> "~/".  However, from scratch buffer on emacs 27.0.91, C-x C-f prompts
> root directory "/", which is inconvenient.

When launched from Dock, on scratch buffer, default-directory is set to “~/“
and “/“ on 26.3 and 27.0.91, respectively.  I checked environmental variables
on 26.3 and 27.0.91 as shown below.  There is no difference, as expected.

* emacs 27.0.91 from dock

$ mv .emacs.d dot.emacs.d
launch emacs-27.0.91 from Dock

(switch-to-buffer "*scratch*")
(with-output-to-temp-buffer "*Result*"
  (princ (format "default-directory=%s\n" default-directory))
  (princ (mapconcat 'identity process-environment "\n")))

default-directory=/
TERM=dumb
LANG=en_JP.UTF-8
XPC_FLAGS=0x0
XPC_SERVICE_NAME=org.gnu.Emacs.5376
TMPDIR=/var/folders/j1/1j1j4tj11wjg257v4vj1qh7r0000gn/T/
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
SHELL=/bin/bash
HOME=/Users/tkk
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.sn3vHBJoI0/Listeners
LOGNAME=tkk
PATH=/usr/bin:/bin:/usr/sbin:/sbin
USER=tkk

* emacs 27.0.91 from terminal

$ mv .emacs.d dot.emacs.d
$ ~/Downloads/emacs-27.0.91/nextstep/Emacs.app/Contents/MacOS/Emacs &

(switch-to-buffer "*scratch*")
(with-output-to-temp-buffer "*Result*"
  (princ (format "default-directory=%s\n" default-directory))
  (princ (mapconcat 'identity process-environment "\n")))

default-directory=~/
LANG=en_JP.UTF-8
_=/Users/tkk/Downloads/emacs-27.0.91/nextstep/Emacs.app/Contents/MacOS/Emacs
COLORTERM=truecolor
PERL_MM_OPT=INSTALL_BASE=/Users/tkk/perl5
ALTERNATE_EDITOR=/Applications/Emacs.app/Contents/MacOS/Emacs
LC_TERMINAL=iTerm2
PKG_CONFIG_PATH=/usr/local/opt/libxml2/lib/pkgconfig
LC_CTYPE=UTF-8
VISUAL=vi
LOGNAME=tkk
ITERM_SESSION_ID=w0t0p0:45E1D075-35E1-42BC-AE8D-50A61792E779
PERL_LOCAL_LIB_ROOT=/Users/tkk/perl5:/Users/tkk/perl5
RUNEMACS=/Applications/Emacs.app/Contents/MacOS/Emacs
LC_TERMINAL_VERSION=3.3.8
COLORFGBG=0;15
HOME=/Users/tkk
SHLVL=2
TEXINPUTS=.:/Users/tkk/texmf/tex/latex//:
HISTCONTROL=ignoredups
XPC_SERVICE_NAME=0
HISTIGNORE=[   ]*:&:bg:fg:exit
PS1=\[\e]2;\u@\h \w\a\e[1;32m\]\h\[\e[0m\]> 
TMUX_PANE=%1
XPC_FLAGS=0x0
ITERM_PROFILE=Default
EDITOR=vi
PWD=/Users/tkk
WWW_HOME=http://dream.misasa.okayama-u.ac.jp/
PATH=/Users/tkk/perl5/bin:/Applications/Skim.app/Contents/SharedSupport/:/opt/local/bin:/opt/local/sbin:/opt/local/libexec/gnubin:/usr/sbin:/Users/tkk/bin:/Users/tkk/xtreeml/bin:/Users/tkk/xtreeml/perl:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Users/tkk/perl5/bin:/Applications/Skim.app/Contents/SharedSupport/:/opt/local/bin:/opt/local/sbin:/opt/local/libexec/gnubin:/Users/tkk/bin:/Users/tkk/xtreeml/bin:/Users/tkk/xtreeml/perl
EMACSCLIENT=/Applications/Emacs.app/Contents/MacOS/bin/emacsclient
TMUX=/private/tmp/tmux-501/default,48628,0
BASH_SILENCE_DEPRECATION_WARNING=1
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.sn3vHBJoI0/Listeners
USER=tkk
CDPATH=.:/Users/tkk:/Users/tkk/SpotDrive:/Users/tkk/Dropbox
LC_ALL=en_US.UTF-8
PERL_BADLANG=0
PERL_MB_OPT=--install_base "/Users/tkk/perl5"
TERM_SESSION_ID=w0t0p0:45E1D075-35E1-42BC-AE8D-50A61792E779
OLDPWD=/Users/tkk/.emacs.d
XTREEML=/Users/tkk/xtreeml
TERM_PROGRAM_VERSION=3.3.8
PERL5LIB=/Users/tkk/perl5/lib/perl5:/Users/tkk/xtreeml/perl:/Users/tkk/perl5/lib/perl5:/Users/tkk/xtreeml/perl:
TMPDIR=/var/folders/j1/1j1j4tj11wjg257v4vj1qh7r0000gn/T/
SHELL=/bin/bash
TERM=dumb
BSTINPUTS=.:/Users/tkk/texmf/bibtex/bst//:
TERM_PROGRAM=iTerm.app
MANPATH=/opt/local/share/man:/usr/share/man:/usr/local/share/man:/Library/TeX/Distributions/.DefaultTeX/Contents/Man:/opt/local/share/man
BIBINPUTS=.:/Users/tkk/texmf/bibtex/bib//:

* emacs 26.3 from Dock

$ mv .emacs.d dot.emacs.d
launch emacs-26.3 from Dock

(switch-to-buffer "*scratch*")
(with-output-to-temp-buffer "*Result*"
  (princ (format "default-directory=%s\n" default-directory))
  (princ (mapconcat 'identity process-environment "\n")))

default-directory=~/
TERM=dumb
LANG=en_JP.UTF-8
XPC_FLAGS=0x0
XPC_SERVICE_NAME=org.gnu.Emacs.4972
TMPDIR=/var/folders/j1/1j1j4tj11wjg257v4vj1qh7r0000gn/T/
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
SHELL=/bin/bash
HOME=/Users/tkk
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.sn3vHBJoI0/Listeners
LOGNAME=tkk
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_14:/Applications/Emacs.app/Contents/MacOS/libexec-x86_64-10_14
USER=tkk