From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Anupam Sengupta Newsgroups: gmane.emacs.help Subject: Re: PATH Variable Date: Sun, 15 Jul 2007 22:39:46 -0700 Organization: Cox Message-ID: References: <1184562801.128350.227380@r34g2000hsd.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1184564465 12556 80.91.229.12 (16 Jul 2007 05:41:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 16 Jul 2007 05:41:05 +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 07:41:03 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 1IAJKR-0004JA-9V for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Jul 2007 07:41:03 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IAJKQ-0002Lj-Aq for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Jul 2007 01:41:02 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news3.google.com!out04a.usenetserver.com!news.usenetserver.com!in02.usenetserver.com!news.usenetserver.com!in03.usenetserver.com!news.usenetserver.com!hwmnpeer01.phx!news.highwinds-media.com!hw-filter.phx!newsfe03.phx.POSTED!53ab2750!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (darwin) Cancel-Lock: sha1:bVzTr6WsDft952KP/zHV5B5Gz+I= Original-Lines: 47 Original-NNTP-Posting-Host: 72.222.192.8 Original-X-Complaints-To: admin@cox.net Original-X-Trace: newsfe03.phx 1184564387 72.222.192.8 (Sun, 15 Jul 2007 22:39:47 PDT) Original-NNTP-Posting-Date: Sun, 15 Jul 2007 22:39:47 PDT Original-Xref: shelby.stanford.edu gnu.emacs.help:150115 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:45698 Archived-At: >>>>> "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