4
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 09 Nov 2023
4 points (100.0% liked)
Emacs
1978 readers
17 users here now
Our infinitely powerful editor.
founded 4 years ago
MODERATORS
@aard how does this differ from
exec-path-from-shell
?I wasn't aware of that one - seems for my own use my code predates that.¹
Quick check of their code:
They focus on getting it from a shell, and parse results directly. They also make synchronous function calls, and have some code to monitor if the process takes too long. I also went down that path originally, but abandoned it for just ding asynchronous calls on platforms which are too slow.
I also just allow specifying arbitrary commands to get the key/value pairs - exec-path-from-shell runs starts a new sh in non-standard shells and relies on variables being exported to be visible there. It doesn't look like querying something like systemctl for variables would work, and I'm pretty sure it won't work on Windows with Powershell or something similar.
Additionally it seems to allow importing all or only variables on a list, while mine also additionally allows all but the variables on a list.
With my implementation setting exec path after execution is optional - but unlike with theirs it's implemented in a hook, which also allows hooking in arbitrary functions to run afterwards.
¹ I originally wrote this thing probably close to two decades ago to have the same Emacs config running on Solaris and Linux. The reason for starting it was that after an update some tools to talk to my Palm no longer used the correct port from within Emacs - I had the relevant variable set separately in the shell and in Emacs. Pulling this from the shell fixed the problem for the future as well.
I've added the async functions when building a configuration for Windows as everything is horribly slow there.