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

Re: Emacs and shell variables



Lo, on Wednesday, May 22, Tom Cook did write:

> On  0, Stefan Bellon <sbellon@sbellon.de> wrote:
> > Felix Natter wrote:
> > > Stefan Bellon <sbellon@sbellon.de> writes:
> > 
> > > > When using Emacs to start a compilation (e.g. with C-c C-c from C++
> > > > mode) you get "make -k" as default. The problem I'm experiencing
> > > > is, that I need some shell variables set in the Makefile. I've set
> > > > them in my ~/.bashrc and it works fine if I start Emacs from an
> > > > xterm which has this variable set in its shell.
> > > > 
> > > > But when I start Emacs with a function key, then the ~/.bashrc
> > > > obviously isn't executed, the shell variable isn't set and the make
> > > > process fails.
> > > > 
> > > > So, how do I tell Emacs always to execute ~/.bashrc in order to get
> > > > at my shell variables?
> > 
> > > You can put your variables both in ~/.bashrc and ~/.bash_profile.
> > > Or you can use (setenv "TEST" "foo").
> > 
> > It looks like I didn't make my problem clear enough.
> > 
> > The variables *are* already in ~/.bashrc (and they're exported there).
> > But Emacs only knows about them if I start Emacs from a bash. If I
> > however use a function key I have defined with fvwm, then Emacs doesn't
> > start with the shell as parent and therefore hasn't the variables set.
> > And I'd like Emacs to have those variables set even then.

I would think that you'd want the environment variables to be visible to
your entire X session, including FVWM and all of the programs it starts.

How are you starting X?  Are you running one of the display managers
like xdm, or do you run startx?

Your .bashrc is only read for interactive shells, not scripts or
anything else.  Does moving the environment settings into .bash_login or
.bash_profile work?  See bash's manpage for details about when it reads
each of the various configuration files.

> So put (setenv "variable" "value") in your .emacs

Also a possibility, but a bit of a kluge.

HTH,

Richard


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: