From: 조성빈 <pcr910303@icloud.com>
To: "Perry E. Metzger" <perry@piermont.com>
Cc: Eli Zaretskii <eliz@gnu.org>, Emacs-devel@gnu.org
Subject: Re: path, cwd in NS port
Date: Fri, 29 May 2020 07:38:32 +0900 [thread overview]
Message-ID: <8DB953E1-94E6-4587-873A-904A19F60048@icloud.com> (raw)
In-Reply-To: <20200528123137.00369308@jabberwock.cb.piermont.com>
> On May 29, 2020, at 1:33 AM, Perry E. Metzger <perry@piermont.com> wrote:
>
> On Thu, 28 May 2020 19:10:43 +0300 Eli Zaretskii <eliz@gnu.org> wrote:
>>> Date: Thu, 28 May 2020 11:00:37 -0400
>>> From: "Perry E. Metzger" <perry@piermont.com>
>>>
>>> Howdy! For years, it has irritated me a bit that when Emacs is
>>> invoked by double-clicking the icon in the NS port, that the
>>> user's path is basically empty and the selected cwd is sometimes
>>> "/".
>>>
>>> I would like to make it possible for a user to at least correct
>>> this situation in their .emacs by knowing when Emacs has been
>>> invoked by launching the .app versus when it has been invoked
>>> from the command line (and has the proper PATH set etc.)
>>>
>>> Does anyone have ideas for ways that the user could figure out
>>> which it is correctly inside their init file? (It's okay if the
>>> method doesn't currently exist and it would require hacking to
>>> Emacs to add such a feature; I'll happily do that.)
>>
>> Is this the same problem as discussed in bug#40924? (I don't use
>> macOS, so apologies if I;m confused about this issue.)
>
> It's certainly a version of the same issue; something happened such
> that the default CWD is no longer set to ~/ recently. That should be
> fixed independently if anyone knows what changed. (I've noticed this
> issue myself and it is quite irritating.)
>
> However, the user's PATH has always been non-optimal on invocation
> from the dock, spotlight, clicking in the Applications directory, etc.
> If the thing invoking Emacs doesn't already have the user's PATH in
> its environment, it can't pass it to Emacs, and it would be nice for
> Emacs users to have an easy solution to fix this.
Actually, I didn’t mention this in that thread but (as a macOS user) I’m not sure if Emacs having the shell env vars is expected behavior: I think most people would expect it to have the PATH as defined in /etc/paths and /etc/paths.d (as all GUI programs).
> I imagine such problems will also exist in some Linux window managers
> etc. as well.
Linux has the concept of the login shell, which means that the .profile (or whatever login shell init file is) gets executed and the environment persists during computer use — that’s why the environment is inherited. In macOS that’s not the case, and it’s rather unexpected to have the shell variables.
I’m not sure how to reliably get the env-vars as well, too. AFAIK exec-path-with-shell requires the shell to be a POSIXy one — something that is usually true to not be a problem in practice as a package, but it won’t work if the user uses e.g. powershell as the default shellZ
> This issue was brought up on the list only a week or two ago I
> believe. I've started poking and prodding at it.
>
> One option that occurred to me was that it would be pretty easy to
> invoke an "echo $PATH" shell command in my .emacs and parse it into
> the exec-path, though I'd prefer only to do this if Emacs was invoked
> a certain way (from the dock, spotlight, etc.) where the PATH is
> known not to be set.
>
> Perry
> --
> Perry E. Metzger perry@piermont.com
>
next prev parent reply other threads:[~2020-05-28 22:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-28 15:00 path, cwd in NS port Perry E. Metzger
2020-05-28 16:10 ` Eli Zaretskii
2020-05-28 16:31 ` Perry E. Metzger
2020-05-28 20:46 ` Alan Third
2020-05-28 22:30 ` 조성빈
2020-05-30 1:03 ` Perry E. Metzger
2020-05-28 22:38 ` 조성빈 [this message]
2020-05-28 22:52 ` Stefan Monnier
2020-05-30 0:48 ` 조성빈
2020-05-30 14:17 ` Stefan Monnier
2020-05-28 17:45 ` Stefan Monnier
2020-05-28 20:30 ` Perry E. Metzger
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=8DB953E1-94E6-4587-873A-904A19F60048@icloud.com \
--to=pcr910303@icloud.com \
--cc=Emacs-devel@gnu.org \
--cc=eliz@gnu.org \
--cc=perry@piermont.com \
/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.