From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Ben McGinnes Newsgroups: gmane.emacs.help Subject: Re: default-directory launched from Dock macOS Date: Mon, 04 May 2020 02:06:54 +0000 (UTC) Message-ID: <20200504020650.a2qodziniqovws2u@adversary.org> References: <20200427.172441.848202153844253762.tak.kunihiro@gmail.com> <20200428.134710.626410507196052586.tak.kunihiro@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="27ztxzxqikiik3ax" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="41176"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Nicolas Cavigneaux Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 04 04:58:05 2020 Return-path: Envelope-to: geh-help-gnu-emacs@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 1jVRIy-000AaH-Ov for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 04 May 2020 04:58:04 +0200 Original-Received: from localhost ([::1]:33374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVRIx-00072G-RI for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 03 May 2020 22:58:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVQW1-0007JE-RX for help-gnu-emacs@gnu.org; Sun, 03 May 2020 22:07:29 -0400 Original-Received: from xtrwkvxq.outbound-mail.sendgrid.net ([167.89.24.164]:48049) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVQW0-00023K-7z for help-gnu-emacs@gnu.org; Sun, 03 May 2020 22:07:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adversary.org; h=from:subject:references:mime-version:content-type:in-reply-to:to:cc; s=s1; bh=o09zgabfMUjJClXYuyEX0LVrzDc4j9kloc/sIpl20uY=; b=c7hf9euV2TmUJexLzWe/SoL8gf5zuUzyfV80SsEny71Q4uU5awGn0EfcONZfNQ0hfkp9 V5OKSbmhrVxkJIAzVaE1VZ/qFjEaymbO90aUwd4HoDueQmzwCCC6JJM1Y5Ek7cHk4THKwl pGYPnhg4RRewQcZ7wuIQD+29AUKp3Rx14= Original-Received: by filter0073p3las1.sendgrid.net with SMTP id filter0073p3las1-3640-5EAF78BE-82 2020-05-04 02:06:54.772274883 +0000 UTC m=+1569873.455564252 Original-Received: from adversary.org (unknown) by ismtpd0005p1maa1.sendgrid.net (SG) with ESMTP id qjAegKZqSDO3o7eHbKULaQ Mon, 04 May 2020 02:06:53.786 +0000 (UTC) OpenPGP: "id=DB4724E6FA4286C92B4E55C4321E4E2373590E5D; url=http://www.adversary.org/ben-key.asc; preference=signencrypt" Codes-of-Conduct-policy: "url=https://gitlab.com/Hasimir/project-participation-policy" Content-Disposition: inline In-Reply-To: X-SG-EID: =?us-ascii?Q?M7XSpjS22pFeWms=2F9N=2FJSaMWinPNp56cHj3hYxizKL6T5hc=2FZqhJNSQiYFgtsM?= =?us-ascii?Q?TaPNM+I90CCgbQTZRYCodJHT=2FhZ0a6OgxWGOR=2Ft?= =?us-ascii?Q?OzzoLiiHQbQkMvI5gVOW4dAGfwJvuD8s2HRt8VR?= =?us-ascii?Q?TuwcWmAjV+ySiP32le85xXTDFWpdzVLODA5euMq?= =?us-ascii?Q?2QDWt3FV80GQcLA9LeiP3JvLgSYNxUrtpqV3qwE?= =?us-ascii?Q?yAH=2F7wMqw+ONXriAQ=3D?= Received-SPF: pass client-ip=167.89.24.164; envelope-from=bounces+15940057-53eb-help-gnu-emacs=gnu.org@em8820.adversary.org; helo=xtrwkvxq.outbound-mail.sendgrid.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/03 22:07:26 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Mailman-Approved-At: Sun, 03 May 2020 22:57:43 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:123011 Archived-At: --27ztxzxqikiik3ax Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 28, 2020 at 09:46:17AM +0200, Nicolas Cavigneaux wrote: >=20 > 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. >=20 > You can instruct MacOS about these environment variables by following a > post I wrote about it: >=20 > https://www.bounga.org/tips/2020/04/07/instructs-mac-os-gui-apps-about-pa= th-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. =F0=9F=98=89 --27ztxzxqikiik3ax Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABEKAB0WIQSkiyjzmoPmPFW48w5Icjp1eQQexgUCXq94sAAKCRBIcjp1eQQe xnldAP9ZTVkS18xYxmlmsFJQogmWLFb2xA9cUAnw8UTwy+CHRQD/UfJ0Ee2Zd4kB 6YP9QjrFS8cPuEUus5CZ08Epyo6G2ck= =pmIS -----END PGP SIGNATURE----- --27ztxzxqikiik3ax--