LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-07-2010, 05:59 PM   #1
odoncaoa
LQ Newbie
 
Registered: Aug 2010
Posts: 4

Rep: Reputation: 0
Question Different linux initialized environments for shells vs. emacs?


Greetings,

I'm finalizing the the dual-boot addition that I recently completed. I've added lubuntu to the LT3114u Netbook that I use. That's done, now I'm migrating my user environment back from the Cygwin one that I've been using on Windoze, as of late. One of features that's been useful has been the global environment management possible with the windoze UI functions.

As I coded my emacs environment while 'over there' (windoze side), I included a check for the lisp library repository path environment variable EMACSLOADPATH. It is globally available when one logs in, and does not get set in any user scripts, or dot files any to do with CYGWIN or emacs.

While it has been easy enough to set EMACSLOADPATH for the login shell environment, via .bashrc, .profile, and system wide via /etc/profile, I have not been able to have '/usr/bin/emacs23' have EMACSLOADPATH set when invoked via the LXDE UI. Thus, it would appear that emacs is not being initialized with the same environment that any of the shells are (old school?). Thus, what is it that one must update in order to have GNU emacs initialized with the same environment variables as bash? Or, put another way, why aren't the environment variable defined in /etc/profile, ~/.bashrc and/or ~/.profile ending up in the initialized environment upon invocation of emacs23 on lubuntu Linux?

Emacs Message:
Warning (initialization): An error occurred while loading `/home/odoncaoa/.emacs':

error:
-->> Not set in environ: EMACSLOADPATH

.emacs code:
;; ============================
;; MAKE SURE IT IS CLEAR WHERE WE KNOW WHERE TO LOOK FOR ELISP FUNCTIONS FILES
(if (eq (getenv "EMACSLOADPATH") nil) (error "\n-->> Not set in environ: %s\n" "EMACSLOADPATH") (message "EMACSLOADPATH\t\t=\t%s\n" (getenv "EMACSLOADPATH")) )
 
Old 08-07-2010, 06:24 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Try putting them in /etc/environment. It's the file used for loading system-wide environmental variables.

bashrc is usually only loaded when an interactive shell is started, so you don't generally get them at startup. And of course the personal $HOME versions don't load unless you're logged in as that user.

Also, the shell that the OS uses internally for running startup scripts may not be bash. My debian system is set to use dash, for example.

I'm not sure about /etc/profile though. I think it depends on how the distro's startup scripts are configured. I wonder if you could source it into /etc/environment? Or if it's wise to do so if possible.

Edit: To answer my own questions, it seems that when you do a graphical login, your login manager won't read /etc/profile unless specifically set up to do so. Also, /etc/environment can only contain simple key=value pairs, so no, you can't source anything else into it. This mailing list thread helped me to comprehend it:

https://lists.ubuntu.com/archives/ub...ay/146336.html

Last edited by David the H.; 08-07-2010 at 06:34 PM. Reason: as explained
 
1 members found this post helpful.
Old 08-07-2010, 07:35 PM   #3
odoncaoa
LQ Newbie
 
Registered: Aug 2010
Posts: 4

Original Poster
Rep: Reputation: 0
David the H., thanks so much. I had tracked down /etc/environment and tried that as well. I hadn't quite remembered it in the list that I specified in the post, however. Consequently, inclusion into /etc/environment didn't do didly for me, either? However, you gave me some leads to investigate, so thanks again!

As lubuntu is a relatively newly generated, I am begining to suspect that this little tidbit is, in fact, a booboo.
Cheers
 
Old 08-16-2010, 08:06 AM   #4
odoncaoa
LQ Newbie
 
Registered: Aug 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Exclamation Re: initialized environments for shells vs. emacs?

Greetings,

Sorry for the delay, and the delay on the socially immersive systems coordination. Anyway, while more light has been shed upon the issue, it has taken a bit of time. I have been able to verify that the environment variables that are initialized, and present in bash, also exist within emacs, I have not been able bring an initialized 'EMACSLOADPATH' into emacs. The final test I had was to see if this was true for any/all of the rest of this users exported (or not) environment variables (as 'EMACSLOADPATH' holds special significance within emacs).
 
  


Reply

Tags
bash, cygwin, emacs, environment, shell



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Can all shells read all environmental variables set by other shells? carlodelmundo Linux - Newbie 2 07-23-2010 02:03 PM
emacs: running multiple M-x shells? genmaicha Linux - Software 2 04-17-2009 12:41 PM
emacs prompt in shells (esp. py-shell) CoonerTheRed Linux - Software 0 05-08-2006 10:45 AM
Linux shells testament Linux - General 1 07-02-2004 11:07 PM
linux booting problem with non-initialized swap space the_twister Linux - General 1 09-04-2003 12:11 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration