help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: PATH Variable


From: srandby
Subject: Re: PATH Variable
Date: Mon, 16 Jul 2007 07:19:32 -0700
User-agent: G2/1.0

On Jul 16, 1:39 am, Anupam Sengupta <anupa...@gmail.com> wrote:
> >>>>> "Srandby" == srandby  <sran...@gmail.com> 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 <<YOUR PATH HERE>>)
>                       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



reply via email to

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