Different linux initialized environments for shells vs. emacs?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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")) )
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:
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
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).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.