From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?utf-8?B?7KGw7ISx67mI?= Newsgroups: gmane.emacs.devel Subject: Re: path, cwd in NS port Date: Fri, 29 May 2020 07:38:32 +0900 Message-ID: <8DB953E1-94E6-4587-873A-904A19F60048@icloud.com> References: <20200528123137.00369308@jabberwock.cb.piermont.com> Mime-Version: 1.0 (1.0) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="97525"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Emacs-devel@gnu.org To: "Perry E. Metzger" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri May 29 00:45:43 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jeRHT-000PFT-6L for ged-emacs-devel@m.gmane-mx.org; Fri, 29 May 2020 00:45:43 +0200 Original-Received: from localhost ([::1]:49874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jeRHS-0003jF-6N for ged-emacs-devel@m.gmane-mx.org; Thu, 28 May 2020 18:45:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60258) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jeRAc-00030m-Ns for emacs-devel@gnu.org; Thu, 28 May 2020 18:38:38 -0400 Original-Received: from mr85p00im-zteg06021501.me.com ([17.58.23.183]:37863) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jeRAb-0003sH-DK for emacs-devel@gnu.org; Thu, 28 May 2020 18:38:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1590705515; bh=iIxk9NuV/skNuSu70YoOnvVNqpZBzJP/+o28d9axt84=; h=Content-Type:From:Subject:Date:Message-Id:To; b=XQhm5v6dMshTFuVNOHs03wK/+FkEKK3G8xjL6/yIlNGY5gmfxNZv87UVxtjbh9V7f Rud+mWzOEcX6/kQSaaa6znYXXcCt718ad64psfjAAzoZPkzTEmabHm1869l7loBIHW 0EwBUSO5C4p4VVG6p+U5x3mRrOC4VugIt6VpDaH4qwigPpzejuZVRFacQ6ldnGFiMH HZYBW44/o31ihbZHKWlWPplF3A6+udXbXipjGuZjhIBtKxgAsFdpIDTn6XkBru23TT XeJknylFP1KEPiX5Pxug3q9XdvcHgKI4qei+696wjmvm2dWINd+qpp+vcjteD12U0Z 45lkYY6SWI1/A== Original-Received: from [10.8.175.222] (unknown [223.62.188.169]) by mr85p00im-zteg06021501.me.com (Postfix) with ESMTPSA id DB8E3380DC9; Thu, 28 May 2020 22:38:34 +0000 (UTC) In-Reply-To: <20200528123137.00369308@jabberwock.cb.piermont.com> X-Mailer: iPhone Mail (17F75) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-05-28_08:2020-05-28, 2020-05-28 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2002250000 definitions=main-2005280146 Received-SPF: pass client-ip=17.58.23.183; envelope-from=pcr910303@icloud.com; helo=mr85p00im-zteg06021501.me.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/28 18:38:35 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, FROM_EXCESS_BASE64=0.979, KHOP_DYNAMIC=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:251587 Archived-At: > On May 29, 2020, at 1:33 AM, Perry E. Metzger wrote: >=20 > =EF=BB=BFOn Thu, 28 May 2020 19:10:43 +0300 Eli Zaretskii w= rote: >>> Date: Thu, 28 May 2020 11:00:37 -0400 >>> From: "Perry E. Metzger" >>>=20 >>> 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 >>> "/". >>>=20 >>> 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.) >>>=20 >>> 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.) =20 >>=20 >> Is this the same problem as discussed in bug#40924? (I don't use >> macOS, so apologies if I;m confused about this issue.) >=20 > 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.) >=20 > 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=E2=80=99t mention this in that thread but (as a macOS user)= I=E2=80=99m not sure if Emacs having the shell env vars is expected behavio= r: I think most people would expect it to have the PATH as defined in /etc/p= aths and /etc/paths.d (as all GUI programs).=20 > 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 w= hatever login shell init file is) gets executed and the environment persists= during computer use =E2=80=94 that=E2=80=99s why the environment is inherit= ed. In macOS that=E2=80=99s not the case, and it=E2=80=99s rather unexpected= to have the shell variables. I=E2=80=99m not sure how to reliably get the env-vars as well, too. AFAIK ex= ec-path-with-shell requires the shell to be a POSIXy one =E2=80=94 something= that is usually true to not be a problem in practice as a package, but it w= on=E2=80=99t 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. >=20 > 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.=20 >=20 > Perry > --=20 > Perry E. Metzger perry@piermont.com >=20