d12frosted / homebrew-emacs-plus

Emacs Plus formulae for the Homebrew package manager
MIT License
2.31k stars 181 forks source link

[Question]: Refresh PATH without reinstalling #700

Closed JulienTant closed 1 month ago

JulienTant commented 1 month ago

Feature request description

Do you know of a way to refresh the injected PATH without reinstalling?

Every time I have to update the PATH my next step has been to reinstall but I wonder if there's a quicker way to make this happen? Sometimes it's just not convenient to have to wait 😅

If the best solution is to install [exec-path-from-shell](https://github.com/purcell/exec-path-from-shell) I'm cool with this ~ just wondered if there's something "provided" with the formulae to make this happen without needed the extensions or recompiling!

neoheartbeats commented 1 month ago

You may check the variable exec-path, for example, the following appends .emacs.d/bin/ to PATH:

(add-to-list 'exec-path (expand-file-name "bin/" user-emacs-directory))
MatthiasPortzel commented 1 month ago

The app uses the path from $(find $(brew --prefix) -name 'Emacs.app')/Contents/Info.plist. You could edit the PATH string in that file, but it will be overwritten on reinstall or update.

d12frosted commented 1 month ago

The PATH injection feature is mostly for non-dynamic environments. You have two options. Either you modify Info.plist (i.e. what path injection feature does) - basically what @MatthiasPortzel does. Or you modify env from within Emacs either manually or using exec-path-from-shell package.

BTW, remember that environment is inherited if you start application from shell. Say, you are using terminal, you modify PATH and then start emacs -nw or just emacs - both ways you inherit the modified PATH. It's useful in some flows.