emacs-devel
[Top][All Lists]
Advanced

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

Re: exec-path and PATH


From: Eli Zaretskii
Subject: Re: exec-path and PATH
Date: Sat, 19 Mar 2011 10:10:07 +0200

> From: Christoph Scholtes <address@hidden>
> Date: Fri, 18 Mar 2011 21:19:55 -0600
> 
> I noticed that there seem to be two ways that external programs are
> invoked:
> 
> 1. directly, via start-process
> 2. indirectly, through the shell
> 
> It was a little confusing that it was not enough to add the path to
> grep.exe to exec-path for Emacs to find it. The same would work fine for
> svn.exe when invoked by the vc backend. 
> 
> I add the paths to certain programs in my init.el, e.g. GnuWin32 for
> grep. For them to work in every situation I have to remember to add them
> to exec-path and the Windows PATH environment variable. This seems
> somewhat redundant, no? I would prefer only manipulating the exec-path
> to tell Emacs where to find the programs.

When a program is invoked via the shell, the shell will look for it
via PATH.  More generally, any program invoked by Emacs that needs to
invoke other programs (e.g., compiler, Make, etc.) will look for those
subordinate programs via PATH.  Only Emacs knows about exec-path.  So
for your life quality in Emacs to be much better, I suggest to always
have exec-path and PATH in sync.

Maybe we should consider the possibility to automatically set PATH
from exec-path each time Emacs invokes a subprocess, because this
issue comes up time and again in gnu.emacs.help.

> Maybe this is a silly question, but why are some of the programs invoked
> different than others? 

Because the shell has features ready for our use that would be a
wasted effort to re-implement in Lisp or C.  E.g., complex
redirection, pipes, etc.

> PS: Here is a small docfix patch for process.c for review:

This is obviously correct, so please commit it on the emacs-23
branch.

> +PROGRAM is the program file name.  It is searched for in EXEC-PATH.  If

"PATH" is a literal name of an environment variable, that's why it is
in caps.  But `exec-path' is spelled in lower case, so please don't
up-case it here.  Also, please enclose in quotes, so it produces a
link in Emacs.  I would even say


  It is searched for in `exec-path' (which see).

Thanks.



reply via email to

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