help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setevn PATH vs exec-path [was Re: Flyspell error]


From: Xah Lee
Subject: Re: setevn PATH vs exec-path [was Re: Flyspell error]
Date: Wed, 5 Aug 2009 16:51:03 -0700 (PDT)
User-agent: G2/1.0

On Aug 5, 10:14 am, Eli Zaretskii <e...@gnu.org> wrote:
> > From: Xah Lee <xah...@gmail.com>
> > Date: Tue, 4 Aug 2009 15:06:35 -0700 (PDT)
>
> > So, the system's PATH env var and emacs exec-path needs not to be the
> > same, and ideally their values probably shouldn't be identical if one
> > is a control freak, since they serve different purposes.
>
> Actually, my advice is to have them both identical (well, actually,
> equivalent, not identical, because one is a list while the other is a
> string).  That's because exec-path is used when Emacs invokes programs
> directly (e.g., via `call-process') while PATH is used indirectly when
> Emacs invokes programs via the shell, like in "M-x compile" or "M-x grep".
> In the latter case, the shell will look for programs along PATH.
> If your values are not equivalent, some Emacs commands that invoke
> subsidiary programs will mysteriously fail, and unless you know very
> well which Emacs command uses the shell and which does not, you will
> have hard time figuring out how to set them correctly.
>
> Of course, if PATH is modified before Emacs is started, then exec-path
> will be automatically equivalent to PATH, because it's computed from
> PATH's value.

interesting and very informative.

For Windows emacs users who uses unix shell, won't there be
exceptions?

For example, i use emacs on windows, but right now predominately uses
unix shell cygwin

when i run “M-x shell” in emacs, i don't want my shell to touch any of
the Windows's executables if possible. e.g. i set PATH in emacs in a
way assuming i'm working in cygwin bash:

typical paths for unix shell:
"/usr/local/bin"
"/usr/bin"
"/bin"
"/usr/X11R6/bin"
"/cygdrive/c/Windows/Program Files (x86)/PHP/"

some Windows paths that are i think necessary in order for cygwin to
run.
"/cygdrive/c/Windows/system32"
"/cygdrive/c/Windows"
"/cygdrive/c/Windows/System32/Wbem"

but when i'm not in shell in emacs, i do want Windows emacs to be able
to access any normal Windows's executables, so my exec-path is like
this:

 "C:/cygwin/bin/"
 "C:/Program Files (x86)/Emacs/emacs/bin/"
 "C:/Program Files (x86)/PHP/"
 "C:/Windows/system32/"
 "C:/Windows/"
 "C:/Windows/System32/Wbem/"

if i just setenv PATH and just let emacs set exec-path, i think i ran
into some problems in emacs... that could be i messed something up in
my setenv PATH...

  Xah
∑ http://xahlee.org/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]