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

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

Re: PATH Variable


From: Camille Bourgoin
Subject: Re: PATH Variable
Date: Mon, 16 Jul 2007 08:39:19 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Anupam Sengupta <anupamsg@gmail.com> writes:

>>>>>> "Srandby" == srandby  <srandby@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

dolist is present in Emacs 21.

-- 
Camille "Mesmento" Bourgoin
jabber : mr.camille@im.apinc.org
web : http://jbbourgoin.free.fr


reply via email to

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