I have seen examples online where people add paths to the default path in Emacs with:
(add-to-list 'exec-path "/usr/local/bin/")
I am new to Elisp, and I think I understand what the statement above does, but I have a few questions:
In what order does Emacs search through the execution paths? For example, does it consider the value of
$PATH(env. variable) at all (and if so, before or after
How can I prepend multiple such paths? Can I just keep concatenating them? e.g.
(add-to-list 'exec-path "PATH1", "PATH2")
or should I do:
(add-to-list 'exec-path "PATH1:PATH2:PATH3")
I also found this interesting package on GitHub: exec-path-from-shell. Why is there a need for a package for this?
Ever find that a command works in your shell, but not in Emacs?
This happens a lot on OS X, where an Emacs instance started from the GUI inherits a default set of environment variables.
This library works solves this problem by copying important environment variables from the user's shell: it works by asking your shell to print out the variables of interest, then copying them into the Emacs environment.
C-h f) will give you the doc for the
add-to-listfunction, as well as links to the source. There's also
C-h v). This isn't meant to be a RTFM comment -- these docs don't answer all the questions you listed, just something useful.
C-h v exec-path, use the manual(s) (Emacs and Elisp). In a manual,
i exec-pathdirects you to a helpful explanation. Ask Emacs first - you won't be sorry you did.