[ESS] R doesn't function in *R* buffer after "M-x R"

Martin Maechler maechler at stat.math.ethz.ch
Mon Nov 16 13:19:02 CET 2009

>>>>> "p" == pleydell  <pleydell at supagro.inra.fr>
>>>>>     on Mon, 16 Nov 2009 11:18:11 +0100 writes:

    >>> But as Emacs initializes exec-path from the active PATH
    >>> when emacs starts, the correct solution really is to
    >>> make sure R is in your PATH independently of emacs, and
    >>> then, also M-x R will work fine.
    >> Thanks for pointing that out; of course, the best
    >> solution is to set PATH outside of Emacs!
    >> Stephen

    p> I don't get it. I forgot to mentioned in my original post
    p> that my .bashrc did contain the lines

    p> PATH=$PATH:/home/david/lib/emacs23/bin export PATH
    p> PATH=$PATH:/home/david/lib/R-2.10.0/bin export PATH

    p> but this was not enough to get M-x R working in emacs. I
    p> suppose emacs needs to know where to find .bashrc or that
    p> I use bash and not some other shell, but I do use the
    p> default location (~/.bashrc) so why was this not a
    p> solution?

Aahh.... I think I know what's going on.
We are diverting from ESS here, definitely, but....

---> How do you start Emacs?

If you start emacs from a "terminal window",
I bet that everything will work
since PATH will be fine from the process where you start Emacs 
--> Emacs will have the correct  exec-path already.

HOWEVER, if you start emacs via menu / panel / ...
Emacs will take its environment (including PATH) from from
whatever the
	 " Gnome / xdm/gdm  Desktop - Enviroment "
has set the environment from.

In recent versions of Gnome/KDE/Linux/....
I think I have noticed, that indeed, a users  ~/.bashrc
may *NOT* have been run at all for the applications that are
started via "mouse click".

Instead , the PATH and all (?) other environment variables are
set from  something like 
or   ~/.Xclients-default
(e.g. by "sourcing" ~/.bash_profile  or ~/.bashrc or ...)


I must say that I found this (change of behavior, a few versions of
       	   	  	      Linux/Gnome/... ago) 
an inifinitely unwise decision, since for me this practically
means that I do need to 
- either start emacs from a terminal shell (which I do)
- or setup ~/.Xclients (or equivalently) correctly , e.g.,
  having it itself do something like sourcing
  ~/.bash_profile and ~/bashrc


BTW: If some X11/GNOME/... guru on this list can shed a brigher
light on this than me, I'm more than happy to learn ....


More information about the ESS-help mailing list