purcell / exec-path-from-shell

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

fix usage code in README.md #67

Closed crazytan closed 7 years ago

crazytan commented 7 years ago

Hi,

From documentation, it seems that window-system cannot take value mac. Moreover, nil should be added in case someone run Emacs in terminal (sometimes I do).

purcell commented 7 years ago

Sorry, this is wrong in two ways, and there have been previous declined pull requests making this change:

  1. window-system can be mac, in either Aquamacs or Railwaycat's Mac Emacs app (I forget which).
  2. Running Emacs in a terminal, you'll generally automatically get the environment variables from the shell, so you don't need exec-path-from-shell there. If you want it anyway, don't add 'nil' - just remove the entire conditional, e.g. call exec-path-from-shell-initialize unconditionally. Hope that helps.
crazytan commented 7 years ago

Thanks for the reply! I tried and found that Railwaycat's Emacs has mac for window-system. Sorry for the PR without investigation... I have one minor question though, why not condition on system-type? It's obviously more robust than figuring out the window system for current Emacs frame (which could fail in some corner cases where emacs server runs as win32 app and client runs in X).

purcell commented 7 years ago

why not condition on system-type? It's obviously more robust than figuring out the window system for current Emacs frame (which could fail in some corner cases where emacs server runs as win32 app and client runs in X).

Because system-type is the same in both GUI and terminal frames. Specifically, I want to run exec-path-from-shell-initialize when starting Emacs with a GUI frame but not when starting it in a terminal window: system-type is darwin in both.