help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: default-directory launched from Dock macOS


From: Ben McGinnes
Subject: Re: default-directory launched from Dock macOS
Date: Mon, 04 May 2020 02:06:54 +0000 (UTC)

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: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]