unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tim X <timx@nospam.dev.null>
To: help-gnu-emacs@gnu.org
Subject: Re: Emacs Environment Variables
Date: Sun, 25 Nov 2007 17:02:32 +1100	[thread overview]
Message-ID: <87myt2zwuf.fsf@lion.rapttech.com.au> (raw)
In-Reply-To: mailman.4022.1195908516.18990.help-gnu-emacs@gnu.org

Ismael Valladolid Torres <ivalladt@ono.com> 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
> session.
>

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

HOME=/path/to/my/home/directory

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. 

HTH

Tim





-- 
tcross (at) rapttech dot com dot au

      parent reply	other threads:[~2007-11-25  6:02 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-23 13:43 Emacs Environment Variables Phi
2007-11-23 21:09 ` Barry Margolin
2007-11-24  9:34 ` Peter Dyballa
2007-11-24 12:48   ` Ismael Valladolid Torres
2007-11-24 13:38     ` Peter Dyballa
2007-11-24 14:02       ` Ismael Valladolid Torres
     [not found]       ` <mailman.4026.1195912966.18990.help-gnu-emacs@gnu.org>
2007-11-24 16:41         ` David Kastrup
2007-11-25  6:25           ` Tim X
2007-11-25  9:06             ` David Kastrup
     [not found]     ` <mailman.4025.1195911521.18990.help-gnu-emacs@gnu.org>
2007-11-24 13:45       ` Phi
2007-11-25  6:18       ` Tim X
2007-11-25 10:18         ` Peter Dyballa
     [not found]         ` <mailman.4054.1195985894.18990.help-gnu-emacs@gnu.org>
2007-11-25 10:44           ` David Kastrup
2007-11-25 11:36             ` Harald Hanche-Olsen
2007-11-25 13:25               ` Peter Dyballa
     [not found]               ` <mailman.4059.1195997121.18990.help-gnu-emacs@gnu.org>
2007-11-25 13:55                 ` David Kastrup
2007-11-25 14:54                   ` Peter Dyballa
2007-11-25 15:19                     ` David Kastrup
2007-11-25 15:50                       ` Peter Dyballa
     [not found]                     ` <mailman.4071.1196004563.18990.help-gnu-emacs@gnu.org>
2007-11-28 16:51                       ` Sven Utcke
2007-11-28 18:06                         ` David Kastrup
2007-11-30 12:25                           ` Sven Utcke
2007-11-30 11:46                         ` Johan Bockgård
2007-11-30 12:28                           ` Sven Utcke
2007-11-30 13:32                             ` Johan Bockgård
2007-11-30 15:17                               ` Peter Dyballa
2007-12-03 10:17                               ` Sven Utcke
     [not found]                               ` <mailman.4354.1196435852.18990.help-gnu-emacs@gnu.org>
2007-12-03 10:20                                 ` Sven Utcke
2007-11-28 16:43                   ` Sven Utcke
2007-12-01 10:54               ` Peter Dyballa
2007-11-25 13:25             ` Peter Dyballa
2007-11-27  8:03           ` Tim X
2007-11-27 10:00             ` Peter Dyballa
     [not found]             ` <mailman.4168.1196157656.18990.help-gnu-emacs@gnu.org>
2007-11-27 10:28               ` David Kastrup
2007-11-27 16:27                 ` Joel J. Adamson
2007-11-28  9:02                   ` Tim X
2007-12-23  2:01                   ` David Combs
2007-11-28  8:55               ` Tim X
     [not found]   ` <mailman.4022.1195908516.18990.help-gnu-emacs@gnu.org>
2007-11-25  6:02     ` Tim X [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87myt2zwuf.fsf@lion.rapttech.com.au \
    --to=timx@nospam.dev.null \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).