From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: exec-path and PATH Date: Sat, 19 Mar 2011 10:10:07 +0200 Message-ID: <83vczfr0o0.fsf@gnu.org> References: <86ipvfiyp0.fsf@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1300522229 15473 80.91.229.12 (19 Mar 2011 08:10:29 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 19 Mar 2011 08:10:29 +0000 (UTC) Cc: emacs-devel@gnu.org To: Christoph Scholtes Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 19 09:10:25 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q0rEu-0007C1-FK for ged-emacs-devel@m.gmane.org; Sat, 19 Mar 2011 09:10:24 +0100 Original-Received: from localhost ([127.0.0.1]:35651 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q0rEs-00010I-Ix for ged-emacs-devel@m.gmane.org; Sat, 19 Mar 2011 04:10:22 -0400 Original-Received: from [140.186.70.92] (port=48684 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q0rEl-0000vT-61 for emacs-devel@gnu.org; Sat, 19 Mar 2011 04:10:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q0rEj-0001GB-0b for emacs-devel@gnu.org; Sat, 19 Mar 2011 04:10:14 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:57425) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q0rEi-0001Fz-Qk for emacs-devel@gnu.org; Sat, 19 Mar 2011 04:10:12 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0LIA00K00PCGNV00@a-mtaout20.012.net.il> for emacs-devel@gnu.org; Sat, 19 Mar 2011 10:10:11 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.124.131.120]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LIA00JEQPCQQ1C0@a-mtaout20.012.net.il>; Sat, 19 Mar 2011 10:10:09 +0200 (IST) In-reply-to: <86ipvfiyp0.fsf@gmail.com> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 80.179.55.166 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:137415 Archived-At: > From: Christoph Scholtes > 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.