purcell / exec-path-from-shell

Make Emacs use the $PATH set up by the user's shell
Other
1.41k stars 81 forks source link

update the init snippet in readme for more accurately OS detect #84

Closed ukari closed 5 years ago

ukari commented 5 years ago

The original snippet use a window-system to determine whether to copy the outisde PATH, it might not work well when emacs start as a daemon.

Until "Starting Emacs daemon." be messaged in daemon mode, the value of window-system would always been nil.

window-system:

When Emacs is invoked as a daemon, it does not create any initial frames, so initial-window-system is nil

system-type could return a correct OS type in daemon mode.

doc: system-type

purcell commented 5 years ago

This isn't the right solution, sorry. If I start GUI Emacs via the window manager in Linux or MacOS, the system-type reported will be the same as if I had started it in a terminal on the same platform. But the intention of the snippet is to enable exec-path-from-shell only in the former case. When started as a daemon, you'll want some explicit handling anyway, otherwise the existing snippet will (reasonably) assume that you have set up the environment correctly for the daemon execution.