The GNU elisp documentation states:
"Generally, you should not modify exec-path directly. Instead, ensure that your PATH environment variable is set appropriately before starting Emacs. Trying to modify exec-path independently of PATH can lead to confusing results."
Given that it is not, in general, possible to ensure the path is correctly set before launching emacs (macOS GUI v's terminal being my case of interest), is it possible to modify the PATH variable from my .emacs, and then have Emacs regerenate the exec-path variable as is done during start-up?
Edited after comment from @lawlist
Using the exec-path-from-shell I observe the following behaviour:
When starting Emacs:
$PATH = "/usr/bin:/bin:/usr/sbin:/sbin"
exec-path = "/usr/bin" "/bin" "/usr/sbin" "/sbin" "/Applications/MacPorts/Emacs.app/Contents/MacOS/libexec" "/Applications/MacPorts/Emacs.app/Contents/MacOS/bin"
After running exec-path-from-shell-initialize:
$PATH = "/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin"
exec-path = "/opt/local/bin/" "/opt/local/sbin/" "/Library/Frameworks/Python.framework/Versions/3.7/bin/" "/usr/local/bin/" "/usr/bin/" "/bin/" "/usr/sbin/" "/sbin/" "/Library/TeX/texbin/" "/opt/X11/bin/" "/Applications/MacPorts/Emacs.app/Contents/MacOS/libexec/"
So the "/Applications/MacPorts/Emacs.app/Contents/MacOS/bin" component that is added to exec-path during Emacs start-up is removed by the exec-path-from-shell package. Is this expected? What is the rational for the package removing it from exec-path?