When launched at system start-up, the Emacs daemon doesn't pick up modifications to the
PATH introduced by shell initialization scripts.
Emacswiki suggests to use this function to update Emacs' PATH,
(defun set-exec-path-from-shell-PATH () "Set up Emacs' `exec-path' and PATH environment variable to match that used by the user's shell. This is particularly useful under Mac OS X and macOS, where GUI apps are not started from a shell." (interactive) (let ((path-from-shell (replace-regexp-in-string "[ \t\n]*$" "" (shell-command-to-string "$SHELL --login -i -c 'echo $PATH'" )))) (setenv "PATH" path-from-shell) (setq exec-path (split-string path-from-shell path-separator)))) (set-exec-path-from-shell-PATH)
but it returns some errors:
bash: cannot set terminal process group (-1): Inappropriate ioctl for device bash: no job control in this shell stty: 'standard input': Inappropriate ioctl for device
As far as I understand (my main reference), since I want to run Bash in interactive mode (so that it loads
~/.bashrc) I should use
-shell-command) to invoke the shell process. However, I can't figure out how to store the output of the command in a string when I do so.