Ismael Valladolid Torres <ivalladt@xxxxxxx> writes:
> Peter Dyballa escribe:
>> Do you start bash in a way that it executes your .bashrc?
> I am afraid he means running emacs from an icon in its window manager
> menu. Then it doesn't honor .bashrc, as it wasn't run from a bash
Actually, I think the issue isn't so much that its not run from a bash/sh
session, but rather the parent process was not a login session and running
from a menu option isn't interpreted as an interactive bash shell.
> If running Debian or Ubuntu he could move important env definitions
> into /etc/environment. I am sure there are ways to do this on Fedora
> or Mandriva systems.
However, you need to keep a couple of things in mind when adding
environment variables to /etc/environment.
1. This file is sourced by *all* processes when they start, not just a
specific users processes. If you put something like
this could cause all sorts of problems for other users or system processes
that have/expect $HOME to point somewhere else (or at least somewhere the
process has access to.
2. This file is sourced before any login or shell init files, which means
anything set here may be over written, possibly a good thing or a bad thing
and definitely a possible gotcha when trying to debug a problem.
I think its a good idea only to put things in this file which are common to
all processes - possibly things like locale settings.
There are a number of ways to resolve the issue of programs started from a
wm menu inheriting user environment variables. One of the simplest is to
just change your Xsession to run as a login shell. As this is the parent
session, all exported environment variables will be inherited by all
processes you start while in X regardless of whether they are from a wm
menu, an xterm or some other 'launcher'. How you do this depends on the
way you start X. I have my system boot into X and run gdm. For me, it would
be as easy as changing /etc/gdm/Xsession to be a login shell rather than a
non-interactive sh shell (I'm on Debian).
some window managers allow you to tick a box when defining a menu entry
that essentially makes the process that will execute the menu item source
the users init files, such as .bash_profile or .profile. If you can't do
this with your wm, you can just make a simple wrapper script that sources
your init files and then exec's emacs. Finally, you can create your own
.xsession file and just have it source your init files.
tcross (at) rapttech dot com dot au