From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: srandby Newsgroups: gmane.emacs.help Subject: Re: PATH Variable Date: Mon, 16 Jul 2007 07:19:32 -0700 Organization: http://groups.google.com Message-ID: <1184595572.941007.212460@n60g2000hse.googlegroups.com> 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 1184596910 20193 80.91.229.12 (16 Jul 2007 14:41:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 16 Jul 2007 14:41:50 +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 16:41:48 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 1IARlh-0000QH-6c for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Jul 2007 16:41:45 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IARlg-0006eB-Er for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Jul 2007 10:41:44 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!n60g2000hse.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 53 Original-NNTP-Posting-Host: 65.25.57.237 Original-X-Trace: posting.google.com 1184595573 24930 127.0.0.1 (16 Jul 2007 14:19:33 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Mon, 16 Jul 2007 14:19:33 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: n60g2000hse.googlegroups.com; posting-host=65.25.57.237; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Original-Xref: shelby.stanford.edu gnu.emacs.help:150143 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:45728 Archived-At: On Jul 16, 1:39 am, Anupam Sengupta wrote: > >>>>> "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 Thanks for the help, I've got it working now. Scott Randby