all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Changing $PATH in eshell, in a bash-like behaviour
@ 2010-08-13  9:22 Gabriele Lanaro
  2010-08-13  9:31 ` Andrea Crotti
  2010-08-16 20:42 ` John Wiegley
  0 siblings, 2 replies; 4+ messages in thread
From: Gabriele Lanaro @ 2010-08-13  9:22 UTC (permalink / raw)
  To: johnw, help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1018 bytes --]

I'm trying to add an additional directory to PATH, in order to use python
virtual environments (virtualenv).

A virtual environment is a directory that contains different version of
various programs/script in its bin directory.

--- virtualenv hello ---
hello/
  - hello/bin
           python
           pip
           easy_install
           ...
   - hello/lib/
        ---

The problem here is tat if I add the directory /abs/path/to/hello/bin as the
first element of PATH (using getenv/setenv), eshell modifies correctly the
variable but doesn't prefer the commands defined in hello/bin, for example:

eshell> which python
/usr/bin/python
eshell> # path modification
eshell> echo $PATH # or getenv PATH
/abs/path/to/hello/bin:/bin:/usr/bin:...
eshell> which python
/usr/bin/python

If i launch the command in another way, using for example shell-command..

M-! which python
/abs/path/to/hello/bin/python

So it works in the correct way.

How to make eshell behaving the same way, are there any workaround I can do?

[-- Attachment #2: Type: text/html, Size: 1142 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Changing $PATH in eshell, in a bash-like behaviour
  2010-08-13  9:22 Changing $PATH in eshell, in a bash-like behaviour Gabriele Lanaro
@ 2010-08-13  9:31 ` Andrea Crotti
  2010-08-16 20:42 ` John Wiegley
  1 sibling, 0 replies; 4+ messages in thread
From: Andrea Crotti @ 2010-08-13  9:31 UTC (permalink / raw)
  To: help-gnu-emacs

Gabriele Lanaro <gabriele.lanaro@gmail.com> writes:

> I'm trying to add an additional directory to PATH, in order to use python
> virtual environments (virtualenv).
>
> A virtual environment is a directory that contains different version of
> various programs/script in its bin directory.
>
> --- virtualenv hello ---
> hello/
>   - hello/bin
>   python
>   pip
>   easy_install
>   ...
> - hello/lib/
>   ---
>
> The problem here is tat if I add the directory /abs/path/to/hello/bin as
> the first element of PATH (using getenv/setenv), eshell modifies correctly
> the variable but doesn't prefer the commands defined in hello/bin, for
> example:
>
> eshell> which python
> /usr/bin/python
> eshell> # path modification
> eshell> echo $PATH # or getenv PATH
> /abs/path/to/hello/bin:/bin:/usr/bin:...
> eshell> which python
> /usr/bin/python
>
> If i launch the command in another way, using for example shell-command..
>
> M-! which python
> /abs/path/to/hello/bin/python
>
> So it works in the correct way.
>
> How to make eshell behaving the same way, are there any workaround I can
> do?

For python you should instead set the py-python-command, see this
article [fn:1]

For your problem maybe eshell doesn't read that variable at run time?

*-*-*-*-*-*-*-*-*-*

[fn:1] http://jesselegg.com/archives/2010/03/14/emacs-python-programmers-2-virtualenv-ipython-daemon-mode/




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Changing $PATH in eshell, in a bash-like behaviour
       [not found] <mailman.6.1281691379.25007.help-gnu-emacs@gnu.org>
@ 2010-08-13 11:06 ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2010-08-13 11:06 UTC (permalink / raw)
  To: help-gnu-emacs

eshell> which python
> /usr/bin/python
eshell> # path modification
eshell> echo $PATH # or getenv PATH
> /abs/path/to/hello/bin:/bin:/usr/bin:...
eshell> which python
> /usr/bin/python

You probably want to modify `exec-path' at the same time as you
modify $PATH.  What you see as $PATH is part of `process-environment',
i.e. the environment to use for subprocesses, but not for Emacs itself.


        Stefan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Changing $PATH in eshell, in a bash-like behaviour
  2010-08-13  9:22 Changing $PATH in eshell, in a bash-like behaviour Gabriele Lanaro
  2010-08-13  9:31 ` Andrea Crotti
@ 2010-08-16 20:42 ` John Wiegley
  1 sibling, 0 replies; 4+ messages in thread
From: John Wiegley @ 2010-08-16 20:42 UTC (permalink / raw)
  To: Gabriele Lanaro; +Cc: help-gnu-emacs, johnw

On Aug 13, 2010, at 5:22 AM, Gabriele Lanaro wrote:

> eshell> # path modification

You omitted the one detail I needed to answer your question. :)

Eshell has a "addpath DIR" command for extending your PATH.  Use "addpath -b DIR" to prepend DIR at the beginning of the PATH.

John


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-08-16 20:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-13  9:22 Changing $PATH in eshell, in a bash-like behaviour Gabriele Lanaro
2010-08-13  9:31 ` Andrea Crotti
2010-08-16 20:42 ` John Wiegley
     [not found] <mailman.6.1281691379.25007.help-gnu-emacs@gnu.org>
2010-08-13 11:06 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.