From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Camille Bourgoin Newsgroups: gmane.emacs.help Subject: Re: PATH Variable Date: Mon, 16 Jul 2007 08:39:19 +0200 Organization: Guest of ProXad - France Message-ID: <87lkdgx36w.fsf@gmail.com> References: <1184562801.128350.227380@r34g2000hsd.googlegroups.com> Reply-To: Camille Bourgoin NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1184568045 21864 80.91.229.12 (16 Jul 2007 06:40:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 16 Jul 2007 06:40:45 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 16 08:40:44 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IAKGB-0006Hy-Td for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Jul 2007 08:40:44 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IAKGB-0001rI-BH for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Jul 2007 02:40:43 -0400 Original-Path: shelby.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!club-internet.fr!feedme-small.clubint.net!proxad.net!feeder1-1.proxad.net!cleanfeed2-b.proxad.net!nnrp10-1.free.fr!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:h74+/dWCnE6JCZ12CMxLAdbHtlk= Original-Lines: 56 Original-NNTP-Posting-Date: 16 Jul 2007 08:39:19 MEST Original-NNTP-Posting-Host: 82.235.33.35 Original-X-Trace: 1184567959 news-3.free.fr 29935 82.235.33.35:43386 Original-X-Complaints-To: abuse@proxad.net Original-Xref: shelby.stanford.edu gnu.emacs.help:150116 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:45699 Archived-At: Anupam Sengupta writes: >>>>>> "Srandby" == srandby writes: > > Srandby> Hi: Would somebody please tell me how to change the PATH variable > Srandby> used by Emacs? I want to use a shell command, but Emacs can't find > Srandby> the command. I've tried a bunch of stuff, but so far nothing works. > > Try adding this code fragment in your .emacs file: > > (setenv "PATH" > (concat (expand-file-name <>) > path-separator (getenv "PATH"))) > > You may want to make this a function and invoke it for each path-element you > want to be accessible from within Emacs. > > E.g., > > ;;; Define a function to setup additional path > (defun my-add-path (path-element) > "Add the specified path element to the Emacs PATH" > (interactive "DEnter directory to be added to path: ") > (if (file-directory-p path-element) > (setenv "PATH" > (concat (expand-file-name path-element) > path-separator (getenv "PATH"))))) > > and then: > > ;;; Set localized PATH for Emacs. > ;;; Example only > (if (fboundp 'my-add-path) > (let ((my-paths (list > "/opt/local/bin" > "/usr/local/bin" > "/usr/local/sbin" > "/usr/local/mysql/bin" > "~/bin"))) > (dolist (path-to-add my-paths (getenv "PATH")) > (my-add-path path-to-add)))) > > BTW, this needs the cl package for the `dolist', which is present in Emacs 22 > and /possibly/ on V21 as well. If not present in your Emacs version, just > replace the `dolist' with an alternate looping mechanism. > > HTH, > -- > Anupam dolist is present in Emacs 21. -- Camille "Mesmento" Bourgoin jabber : mr.camille@im.apinc.org web : http://jbbourgoin.free.fr