From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: "Perry E. Metzger" Newsgroups: gmane.emacs.devel Subject: Re: path, cwd in NS port Date: Thu, 28 May 2020 12:31:37 -0400 Message-ID: <20200528123137.00369308@jabberwock.cb.piermont.com> References: <20200528110037.53f0b487@jabberwock.cb.piermont.com> <831rn4rqf0.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="27377"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu May 28 18:32:16 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 1jeLS3-00072W-Rg for ged-emacs-devel@m.gmane-mx.org; Thu, 28 May 2020 18:32:15 +0200 Original-Received: from localhost ([::1]:38766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jeLS2-0007JY-Ub for ged-emacs-devel@m.gmane-mx.org; Thu, 28 May 2020 12:32:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jeLRU-00069c-6k for emacs-devel@gnu.org; Thu, 28 May 2020 12:31:40 -0400 Original-Received: from hacklheber.piermont.com ([2001:470:30:84:e276:63ff:fe62:3400]:55708) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jeLRT-0002Oi-7e; Thu, 28 May 2020 12:31:39 -0400 Original-Received: from snark.cb.piermont.com (localhost [127.0.0.1]) by hacklheber.piermont.com (Postfix) with ESMTP id EFF293D; Thu, 28 May 2020 12:31:37 -0400 (EDT) Original-Received: from jabberwock.cb.piermont.com (jabberwock.cb.piermont.com [10.160.2.107]) by snark.cb.piermont.com (Postfix) with ESMTP id CDBFD3C2001; Thu, 28 May 2020 12:31:37 -0400 (EDT) In-Reply-To: <831rn4rqf0.fsf@gnu.org> Received-SPF: pass client-ip=2001:470:30:84:e276:63ff:fe62:3400; envelope-from=perry@piermont.com; helo=hacklheber.piermont.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/28 12:10:52 X-ACL-Warn: Detected OS = ??? X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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:251557 Archived-At: On Thu, 28 May 2020 19:10:43 +0300 Eli Zaretskii wrote: > > Date: Thu, 28 May 2020 11:00:37 -0400 > > From: "Perry E. Metzger" > > > > 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. I imagine such problems will also exist in some Linux window managers etc. as well. 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