all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* default-directory launched from Dock macOS
@ 2020-04-27  8:24 Tak Kunihiro
  2020-04-27 20:37 ` Perry Smith
  2020-04-28  4:47 ` Tak Kunihiro
  0 siblings, 2 replies; 17+ messages in thread
From: Tak Kunihiro @ 2020-04-27  8:24 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: tak.kunihiro

I want to launch emacs from Dock on macOS.

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 I launch emacs
27.0.91 by `cd; emacs &`, C-x C-f prompts "~/".

Is there a good way to launch emacs 27.0.91 from Dock with
default-directory "~/"?



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: default-directory launched from Dock macOS
  2020-04-27  8:24 default-directory launched from Dock macOS Tak Kunihiro
@ 2020-04-27 20:37 ` Perry Smith
  2020-04-28  4:47 ` Tak Kunihiro
  1 sibling, 0 replies; 17+ messages in thread
From: Perry Smith @ 2020-04-27 20:37 UTC (permalink / raw)
  To: Tak Kunihiro; +Cc: help-gnu-emacs

I noticed this too but I wasn’t sure if it was because MacOS changed
or emacs changed because I changed both roughly at the same time.

Aside from doing something in the init.el startup file, I’m curious what
the others suggest.

> On Apr 27, 2020, at 3:24 AM, Tak Kunihiro <tak.kunihiro@gmail.com> wrote:
> 
> I want to launch emacs from Dock on macOS.
> 
> 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 I launch emacs
> 27.0.91 by `cd; emacs &`, C-x C-f prompts "~/".
> 
> Is there a good way to launch emacs 27.0.91 from Dock with
> default-directory "~/"?
> 




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: default-directory launched from Dock macOS
  2020-04-27  8:24 default-directory launched from Dock macOS Tak Kunihiro
  2020-04-27 20:37 ` Perry Smith
@ 2020-04-28  4:47 ` Tak Kunihiro
  2020-04-28  7:32   ` Eli Zaretskii
                     ` (2 more replies)
  1 sibling, 3 replies; 17+ messages in thread
From: Tak Kunihiro @ 2020-04-28  4:47 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: tak.kunihiro

From: 조성빈 <pcr910303@icloud.com>
Subject: Re: default-directory launched from Dock macOS
Date: Tue, 28 Apr 2020 08:37:33 +0900

>> I want to launch emacs from Dock on macOS.
>>
>> 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.

> I also noticed this - I launch Emacs from spotlight, and it’s pretty
> inconvenient. Can anybody explain why the change happened?
> Was it explicit?

It's good to know I'm not the only one.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: default-directory launched from Dock macOS
  2020-04-28  4:47 ` Tak Kunihiro
@ 2020-04-28  7:32   ` Eli Zaretskii
  2020-04-28  7:33   ` Carlo Tambuatco
  2020-04-28  7:46   ` default-directory launched from Dock macOS Nicolas Cavigneaux
  2 siblings, 0 replies; 17+ messages in thread
From: Eli Zaretskii @ 2020-04-28  7:32 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Tue, 28 Apr 2020 13:47:10 +0900 (JST)
> From: Tak Kunihiro <tak.kunihiro@gmail.com>
> Cc: tak.kunihiro@gmail.com
> 
> From: 조성빈 <pcr910303@icloud.com>
> Subject: Re: default-directory launched from Dock macOS
> Date: Tue, 28 Apr 2020 08:37:33 +0900
> 
> >> I want to launch emacs from Dock on macOS.
> >>
> >> 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.
> 
> > I also noticed this - I launch Emacs from spotlight, and it’s pretty
> > inconvenient. Can anybody explain why the change happened?
> > Was it explicit?
> 
> It's good to know I'm not the only one.

If you want this issue to be investigated and maybe fixed, please
submit a bug report with all the details.

Thanks.



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: default-directory launched from Dock macOS
  2020-04-28  4:47 ` Tak Kunihiro
  2020-04-28  7:32   ` Eli Zaretskii
@ 2020-04-28  7:33   ` Carlo Tambuatco
  2020-04-28  8:08     ` Tak Kunihiro
  2020-04-28  7:46   ` default-directory launched from Dock macOS Nicolas Cavigneaux
  2 siblings, 1 reply; 17+ messages in thread
From: Carlo Tambuatco @ 2020-04-28  7:33 UTC (permalink / raw)
  To: Tak Kunihiro; +Cc: help-gnu-emacs

When I set ‘initial-buffer-choice to anything other than default, for example my 
home directory “~/“, C-x C-f prompts that directory.

If I set it to “~/foo/bar”, C-x C-f will prompt ~/foo/bar.

Maybe try that?


> On Apr 28, 2020, at 12:47 AM, Tak Kunihiro <tak.kunihiro@gmail.com> wrote:
> 
> From: 조성빈 <pcr910303@icloud.com>
> Subject: Re: default-directory launched from Dock macOS
> Date: Tue, 28 Apr 2020 08:37:33 +0900
> 
>>> I want to launch emacs from Dock on macOS.
>>> 
>>> 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.
> 
>> I also noticed this - I launch Emacs from spotlight, and it’s pretty
>> inconvenient. Can anybody explain why the change happened?
>> Was it explicit?
> 
> It's good to know I'm not the only one.
> 




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: default-directory launched from Dock macOS
  2020-04-28  4:47 ` Tak Kunihiro
  2020-04-28  7:32   ` Eli Zaretskii
  2020-04-28  7:33   ` Carlo Tambuatco
@ 2020-04-28  7:46   ` Nicolas Cavigneaux
  2020-04-28 12:45     ` Perry Smith
  2020-05-04  2:06     ` Ben McGinnes
  2 siblings, 2 replies; 17+ messages in thread
From: Nicolas Cavigneaux @ 2020-04-28  7:46 UTC (permalink / raw)
  To: help-gnu-emacs

Tak Kunihiro <tak.kunihiro@gmail.com> writes:

> From: 조성빈 <pcr910303@icloud.com>
> Subject: Re: default-directory launched from Dock macOS
> Date: Tue, 28 Apr 2020 08:37:33 +0900
>
>>> I want to launch emacs from Dock on macOS.
>>>
>>> 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.
>
>> I also noticed this - I launch Emacs from spotlight, and it’s pretty
>> inconvenient. Can anybody explain why the change happened?
>> Was it explicit?
>
> It's good to know I'm not the only one.

Maybe it's related to how MacOS and Spotlight handle environment
variables when the app is launch by clicking its icon or using
spotlight.

There are good chance that your HOME environment variable is empty.

You can instruct MacOS about these environment variables by following a
post I wrote about it:

https://www.bounga.org/tips/2020/04/07/instructs-mac-os-gui-apps-about-path-environment-variable/

Hope this helps.
-- 
Nicolas Cavigneaux
http://www.bounga.org
http://www.cavigneaux.net




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: default-directory launched from Dock macOS
  2020-04-28  7:33   ` Carlo Tambuatco
@ 2020-04-28  8:08     ` Tak Kunihiro
  2020-04-28  8:24       ` 27.0.91; default-directory launched via Dock MacOS Tak Kunihiro
  0 siblings, 1 reply; 17+ messages in thread
From: Tak Kunihiro @ 2020-04-28  8:08 UTC (permalink / raw)
  To: Carlo Tambuatco; +Cc: help-gnu-emacs, 国広卓也

>>>> I want to launch emacs from Dock on macOS.
>>>> 
>>>> 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 I set ‘initial-buffer-choice to anything other than default, for example my 
> home directory “~/“, C-x C-f prompts that directory.

Thank you for the suggestion.  That does not change the response.
I will submit a bug report.




^ permalink raw reply	[flat|nested] 17+ messages in thread

* 27.0.91; default-directory launched via Dock MacOS
  2020-04-28  8:08     ` Tak Kunihiro
@ 2020-04-28  8:24       ` Tak Kunihiro
  2020-05-03  2:52         ` bug#40924: " Tak Kunihiro
  0 siblings, 1 reply; 17+ messages in thread
From: Tak Kunihiro @ 2020-04-28  8:24 UTC (permalink / raw)
  To: bug-gnu-emacs; +Cc: help-gnu-emacs, tak.kunihiro

I want to launch emacs via Dock or Spotlight on MacOS.

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 emacs 27.0.91 is started in home directory, C-x C-f prompts
"~/", as expected.

I think that C-x C-f should prompt home directory "~/" instead of root
directory "/" when emacs is launched via Dock or Spotlight.  Since
that worked good until emacs 26.3, something was changed on emacs 27.

Can you store the behavior back?  I show the recipe below to reproduce
the problem.

 $ cd; mv .emacs.d dot.emacs.d
 click emacs 27.0.91 on Dock
 C-x b *scratch*
 C-x C-f ; => Find file: /
 M-x kill-emacs

 $ ./Downloads/emacs-27.0.91/nextstep/Emacs.app/Contents/MacOS/Emacs &
 C-x b *scratch*
 C-x C-f ; => Find file: ~/
 M-x kill-emacs

 click emacs 26.3 on Dock
 C-x b *scratch*
 C-x C-f ;=> Find file: ~/



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: default-directory launched from Dock macOS
  2020-04-28  7:46   ` default-directory launched from Dock macOS Nicolas Cavigneaux
@ 2020-04-28 12:45     ` Perry Smith
  2020-04-28 13:46       ` Nicolas Cavigneaux
  2020-05-04  2:06     ` Ben McGinnes
  1 sibling, 1 reply; 17+ messages in thread
From: Perry Smith @ 2020-04-28 12:45 UTC (permalink / raw)
  To: Nicolas Cavigneaux; +Cc: help-gnu-emacs



> On Apr 28, 2020, at 2:46 AM, Nicolas Cavigneaux <cavigneaux@gmail.com> wrote:
> 
> Tak Kunihiro <tak.kunihiro@gmail.com> writes:
> 
>> From: 조성빈 <pcr910303@icloud.com>
>> Subject: Re: default-directory launched from Dock macOS
>> Date: Tue, 28 Apr 2020 08:37:33 +0900
>> 
>>>> I want to launch emacs from Dock on macOS.
>>>> 
>>>> 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.
>> 
>>> I also noticed this - I launch Emacs from spotlight, and it’s pretty
>>> inconvenient. Can anybody explain why the change happened?
>>> Was it explicit?
>> 
>> It's good to know I'm not the only one.
> 
> Maybe it's related to how MacOS and Spotlight handle environment
> variables when the app is launch by clicking its icon or using
> spotlight.
> 
> There are good chance that your HOME environment variable is empty.
> 
> You can instruct MacOS about these environment variables by following a
> post I wrote about it:
> 
> https://www.bounga.org/tips/2020/04/07/instructs-mac-os-gui-apps-about-path-environment-variable/
> 
> Hope this helps.

This sounded plausible but HOME is set to my HOME directory and USER is set to my user name.

It will be curious to learn what changed.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: default-directory launched from Dock macOS
  2020-04-28 12:45     ` Perry Smith
@ 2020-04-28 13:46       ` Nicolas Cavigneaux
  2020-04-28 15:51         ` Perry Smith
  0 siblings, 1 reply; 17+ messages in thread
From: Nicolas Cavigneaux @ 2020-04-28 13:46 UTC (permalink / raw)
  To: help-gnu-emacs

Perry Smith <pedz@easesoftware.com> writes:

>> On Apr 28, 2020, at 2:46 AM, Nicolas Cavigneaux <cavigneaux@gmail.com> wrote:
>> 
>> Tak Kunihiro <tak.kunihiro@gmail.com> writes:
>> 
>>> From: 조성빈 <pcr910303@icloud.com>
>>> Subject: Re: default-directory launched from Dock macOS
>>> Date: Tue, 28 Apr 2020 08:37:33 +0900
>>> 
>>>>> I want to launch emacs from Dock on macOS.
>>>>> 
>>>>> 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.
>>> 
>>>> I also noticed this - I launch Emacs from spotlight, and it’s pretty
>>>> inconvenient. Can anybody explain why the change happened?
>>>> Was it explicit?
>>> 
>>> It's good to know I'm not the only one.
>> 
>> Maybe it's related to how MacOS and Spotlight handle environment
>> variables when the app is launch by clicking its icon or using
>> spotlight.
>> 
>> There are good chance that your HOME environment variable is empty.
>> 
>> You can instruct MacOS about these environment variables by following a
>> post I wrote about it:
>> 
>> https://www.bounga.org/tips/2020/04/07/instructs-mac-os-gui-apps-about-path-environment-variable/
>> 
>> Hope this helps.
>
> This sounded plausible but HOME is set to my HOME directory and USER is set to my user name.

In your shell or in launchd?

Launchd is responsible for the environment variables your GUI apps
(launched by clicking their icon or using Spotlight) have access to.

> It will be curious to learn what changed.

If my theory is right, previous Emacs versions were doing some black
magic to find your home even if the HOME environment variable wasn't set
and new version doesn't try anymore and defaults to "/".
-- 
Nicolas Cavigneaux
http://www.bounga.org
http://www.cavigneaux.net




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: default-directory launched from Dock macOS
  2020-04-28 13:46       ` Nicolas Cavigneaux
@ 2020-04-28 15:51         ` Perry Smith
  0 siblings, 0 replies; 17+ messages in thread
From: Perry Smith @ 2020-04-28 15:51 UTC (permalink / raw)
  To: Nicolas Cavigneaux; +Cc: help-gnu-emacs



> On Apr 28, 2020, at 8:46 AM, Nicolas Cavigneaux <cavigneaux@gmail.com> wrote:
> 
> Perry Smith <pedz@easesoftware.com> writes:
> 
>> 
>> This sounded plausible but HOME is set to my HOME directory and USER is set to my user name.
> 
> In your shell or in launchd?

via launchd (open from the dock)

And that makes sense because launchd knows who owns the process.  e.g. the UID of Emacs is my user, not root.

    -+= 00001 root /sbin/launchd
     \-+= 00811 pedz /Applications/Emacs.app/Contents/MacOS/Emacs-x86_64-10_14
       \--= 15598 pedz /usr/local/bin/aspell -a -m -B --encoding=utf-8




^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#40924: 27.0.91; default-directory launched via Dock MacOS
  2020-04-28  8:24       ` 27.0.91; default-directory launched via Dock MacOS Tak Kunihiro
@ 2020-05-03  2:52         ` Tak Kunihiro
  2021-01-28  6:44           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 17+ messages in thread
From: Tak Kunihiro @ 2020-05-03  2:52 UTC (permalink / raw)
  To: 40924

> 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






^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: default-directory launched from Dock macOS
  2020-04-28  7:46   ` default-directory launched from Dock macOS Nicolas Cavigneaux
  2020-04-28 12:45     ` Perry Smith
@ 2020-05-04  2:06     ` Ben McGinnes
  1 sibling, 0 replies; 17+ messages in thread
From: Ben McGinnes @ 2020-05-04  2:06 UTC (permalink / raw)
  To: Nicolas Cavigneaux; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1676 bytes --]

On Tue, Apr 28, 2020 at 09:46:17AM +0200, Nicolas Cavigneaux wrote:
> 
> Maybe it's related to how MacOS and Spotlight handle environment
> variables when the app is launch by clicking its icon or using
> spotlight.

It could be, but OS X has been doing weird things with that for a
while, and not just with paths.

> There are good chance that your HOME environment variable is empty.
> 
> You can instruct MacOS about these environment variables by following a
> post I wrote about it:
> 
> https://www.bounga.org/tips/2020/04/07/instructs-mac-os-gui-apps-about-path-environment-variable/

That's an interesting solution, but there are a couple of others.

One option for use entirely within Emacs with elisp is this:

    https://github.com/purcell/exec-path-from-shell

I took a slightly different approach for launching Emacs from the Dock
that would inherit environmental variables and one or two other things
(including several, preconfigured Emacs server options), by making a
handful of these:

    https://github.com/adversary-org/emacs-launcher-osx

My solution is a bit more configurable since it's basically just
stripped down app container with just the Emacs icon and a shell
script to run a few things (like "source ~/.bashrc"), sometimes set
custom variables, and then launch Emacs.  Most of these are also set
to launch an Emacs server (with various applications configured to use
the relevant corresponding client).

Most of the time these[1] these all behave exactly as expected.


Regards,
Ben

 1. I'd say "all," but Murphy's Law dictates that it would break the
    moment I made the claim, so I won't.  😉

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#40924: 27.0.91; default-directory launched via Dock MacOS
  2020-05-03  2:52         ` bug#40924: " Tak Kunihiro
@ 2021-01-28  6:44           ` Lars Ingebrigtsen
  2021-01-28 10:02             ` Tak Kunihiro
  0 siblings, 1 reply; 17+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-28  6:44 UTC (permalink / raw)
  To: Tak Kunihiro; +Cc: 40924

Tak Kunihiro <tak.kunihiro@gmail.com> writes:

> 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.

I tested this (with Emacs 28) on Big Sur, and was unable to reproduce
it.  I vaguely seem to remember discussion about this some months ago,
so I'm going to go ahead and guess that it really has been fixed, and
I'm closing this bug report.  If the problem still persists for you in
Emacs 28, please respond to the debbugs address and we'll reopen.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#40924: 27.0.91; default-directory launched via Dock MacOS
  2021-01-28  6:44           ` Lars Ingebrigtsen
@ 2021-01-28 10:02             ` Tak Kunihiro
  2021-01-28 10:25               ` Lars Ingebrigtsen
  0 siblings, 1 reply; 17+ messages in thread
From: Tak Kunihiro @ 2021-01-28 10:02 UTC (permalink / raw)
  To: 40924, Lars Ingebrigtsen; +Cc: 国広卓也

>> 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.
> 
> I tested this (with Emacs 28) on Big Sur, and was unable to reproduce
> it.  I vaguely seem to remember discussion about this some months ago,
> so I'm going to go ahead and guess that it really has been fixed, and
> I'm closing this bug report.

I also confirmed that it is fixed on 28.0.50 running on macOS Catalina.






^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#40924: 27.0.91; default-directory launched via Dock MacOS
  2021-01-28 10:02             ` Tak Kunihiro
@ 2021-01-28 10:25               ` Lars Ingebrigtsen
  2021-01-28 10:57                 ` Andrii Kolomoiets
  0 siblings, 1 reply; 17+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-28 10:25 UTC (permalink / raw)
  To: Tak Kunihiro; +Cc: 40924

Tak Kunihiro <tak.kunihiro@gmail.com> writes:

> I also confirmed that it is fixed on 28.0.50 running on macOS Catalina.

Thanks for checking.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#40924: 27.0.91; default-directory launched via Dock MacOS
  2021-01-28 10:25               ` Lars Ingebrigtsen
@ 2021-01-28 10:57                 ` Andrii Kolomoiets
  0 siblings, 0 replies; 17+ messages in thread
From: Andrii Kolomoiets @ 2021-01-28 10:57 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Tak Kunihiro, 40924

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Tak Kunihiro <tak.kunihiro@gmail.com> writes:
>
>> I also confirmed that it is fixed on 28.0.50 running on macOS Catalina.
>
> Thanks for checking.

It's fixed in Bug#42836
Commit 16f4f266324077f5a50090bd1c8147c7cbe37e0e





^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-01-28 10:57 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-27  8:24 default-directory launched from Dock macOS Tak Kunihiro
2020-04-27 20:37 ` Perry Smith
2020-04-28  4:47 ` Tak Kunihiro
2020-04-28  7:32   ` Eli Zaretskii
2020-04-28  7:33   ` Carlo Tambuatco
2020-04-28  8:08     ` Tak Kunihiro
2020-04-28  8:24       ` 27.0.91; default-directory launched via Dock MacOS Tak Kunihiro
2020-05-03  2:52         ` bug#40924: " Tak Kunihiro
2021-01-28  6:44           ` Lars Ingebrigtsen
2021-01-28 10:02             ` Tak Kunihiro
2021-01-28 10:25               ` Lars Ingebrigtsen
2021-01-28 10:57                 ` Andrii Kolomoiets
2020-04-28  7:46   ` default-directory launched from Dock macOS Nicolas Cavigneaux
2020-04-28 12:45     ` Perry Smith
2020-04-28 13:46       ` Nicolas Cavigneaux
2020-04-28 15:51         ` Perry Smith
2020-05-04  2:06     ` Ben McGinnes

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.