* Re: Problems starting emacs with correct environmental settings [not found] <mailman.1714.1246572018.2239.help-gnu-emacs@gnu.org> @ 2009-07-02 22:45 ` Pascal J. Bourguignon 2009-07-04 22:01 ` Johan Bockgård [not found] ` <mailman.1831.1246744930.2239.help-gnu-emacs@gnu.org> 2009-07-03 10:08 ` Pascal J. Bourguignon 1 sibling, 2 replies; 10+ messages in thread From: Pascal J. Bourguignon @ 2009-07-02 22:45 UTC (permalink / raw) To: help-gnu-emacs Alain Muls <alain.muls@telenet.be> writes: > Hi emacs users, > > On my ubuntu system I have in the top bar the icon (dragged from the > menu entry in Accessories) to launch emacs. By doing so, I have no > access to my PATH variable, eg. a compile (make -k) won't run. > > When I launch emacs from a shell, than there is no problem and make or > other scripts are available. What should I do to have the icon launch > emacs with my PATH set. You could launch a script instead of emacs. But you may also set the environment variables from emacs: (require 'cl) (defun join (los sep) (with-output-to-string (princ (first los)) (dolist (s (rest los)) (princ sep) (princ s)))) (setf (getenv "PATH") (join (list* "/your/path" "/and/some/more" (getenv "PATH")) ":")) -- __Pascal Bourguignon__ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Problems starting emacs with correct environmental settings 2009-07-02 22:45 ` Problems starting emacs with correct environmental settings Pascal J. Bourguignon @ 2009-07-04 22:01 ` Johan Bockgård [not found] ` <mailman.1831.1246744930.2239.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 10+ messages in thread From: Johan Bockgård @ 2009-07-04 22:01 UTC (permalink / raw) To: help-gnu-emacs pjb@informatimago.com (Pascal J. Bourguignon) writes: > (defun join (los sep) > (with-output-to-string > (princ (first los)) > (dolist (s (rest los)) > (princ sep) (princ s)))) (mapconcat 'identity los sep) ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <mailman.1831.1246744930.2239.help-gnu-emacs@gnu.org>]
* Re: Problems starting emacs with correct environmental settings [not found] ` <mailman.1831.1246744930.2239.help-gnu-emacs@gnu.org> @ 2009-07-04 23:39 ` Pascal J. Bourguignon 0 siblings, 0 replies; 10+ messages in thread From: Pascal J. Bourguignon @ 2009-07-04 23:39 UTC (permalink / raw) To: help-gnu-emacs bojohan+news@dd.chalmers.se (Johan Bockgård) writes: > pjb@informatimago.com (Pascal J. Bourguignon) writes: > >> (defun join (los sep) >> (with-output-to-string >> (princ (first los)) >> (dolist (s (rest los)) >> (princ sep) (princ s)))) > > (mapconcat 'identity los sep) Great! Thank you. -- __Pascal Bourguignon__ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Problems starting emacs with correct environmental settings [not found] <mailman.1714.1246572018.2239.help-gnu-emacs@gnu.org> 2009-07-02 22:45 ` Problems starting emacs with correct environmental settings Pascal J. Bourguignon @ 2009-07-03 10:08 ` Pascal J. Bourguignon 2009-07-03 11:12 ` Peter Dyballa [not found] ` <mailman.1742.1246619589.2239.help-gnu-emacs@gnu.org> 1 sibling, 2 replies; 10+ messages in thread From: Pascal J. Bourguignon @ 2009-07-03 10:08 UTC (permalink / raw) To: help-gnu-emacs Alain Muls <alain.muls@telenet.be> writes: > Hi emacs users, > > On my ubuntu system I have in the top bar the icon (dragged from the > menu entry in Accessories) to launch emacs. By doing so, I have no > access to my PATH variable, eg. a compile (make -k) won't run. > > When I launch emacs from a shell, than there is no problem and make or > other scripts are available. What should I do to have the icon launch > emacs with my PATH set. If you answer Peter's questions, you will learn that environment variables are inherited from parent process to child process, (some programs do clean up environment variables before forking a child, but normal programs leave them pass from parent to grand-child). So ultimately, it depend on the process that forks emacs. This is the "desktop manager" (does something like KDE, Gnome, GNUstep Workspace Manager, etc, ring a bell?). Some of these desktop managers may provide a preference panel to set the environment variables for the child processes. Or they may load them from a special file or store. So if you identify your desktop manager, you may try to find this file or this preference and set it. Otherwise, you could set the environment in the process that launches the desktop manager. When you log in with X, the login window manager restarts the X server which will execute some script to fork your window manager, desktop manager, etc. Various user scripts may be used, like ~/.xsession or ~/.xinitrc, depending on the login window manager you use or how you start X. In the absence of user scripts, default scripts in /etc/X11/* are used. Depending on the shell used by these scripts, you may edit one of the file used by these shell to set the environment. Eg. in case of bash, you could set your environment in ~/.bash_env or ~/.bash_login or ~/.bashrc ; for other Bourne shells, ~/.profile or ~/.login could be used. In the last resort, you can directly edit the X startup scrip that is used in your configuration. You may follow the login process by starting from /etc/inittab, and following the track of the programs/processes. -- __Pascal Bourguignon__ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Problems starting emacs with correct environmental settings 2009-07-03 10:08 ` Pascal J. Bourguignon @ 2009-07-03 11:12 ` Peter Dyballa [not found] ` <mailman.1742.1246619589.2239.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 10+ messages in thread From: Peter Dyballa @ 2009-07-03 11:12 UTC (permalink / raw) To: Pascal J. Bourguignon; +Cc: help-gnu-emacs Am 03.07.2009 um 12:08 schrieb Pascal J. Bourguignon: > Depending on the shell used by these scripts, you may edit one of the > file used by these shell to set the environment. Eg. in case of bash, > you could set your environment in ~/.bash_env or ~/.bash_login or > ~/.bashrc ; for other Bourne shells, ~/.profile or ~/.login could be > used. In the last resort, you can directly edit the X startup scrip > that is used in your configuration. Alain send me some answers privately. To me it seems that processes created from the menu icons inherit only a small environment, could be that of a privileged process. It obviously has some basic components in PATH, but not Alain's private parts. And GNU Emacs actually is opened via emacsclient, from a shell script, which is passed to the launcher as " ~/..." and "~/" does not get expanded to something like "/home/<user>/..." With pstree, observing such a launched process, one might find some basic clues. By using a shell script that creates a login shell to launch emacsclient from inside it a few problems could be cured… -- Greetings Pete It's not the valleys in life I dread so much as the dips. – Garfield ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <mailman.1742.1246619589.2239.help-gnu-emacs@gnu.org>]
* Re: Problems starting emacs with correct environmental settings [not found] ` <mailman.1742.1246619589.2239.help-gnu-emacs@gnu.org> @ 2009-07-04 0:42 ` Tim X 0 siblings, 0 replies; 10+ messages in thread From: Tim X @ 2009-07-04 0:42 UTC (permalink / raw) To: help-gnu-emacs Peter Dyballa <Peter_Dyballa@Web.DE> writes: > Am 03.07.2009 um 12:08 schrieb Pascal J. Bourguignon: > >> Depending on the shell used by these scripts, you may edit one of the >> file used by these shell to set the environment. Eg. in case of bash, >> you could set your environment in ~/.bash_env or ~/.bash_login or >> ~/.bashrc ; for other Bourne shells, ~/.profile or ~/.login could be >> used. In the last resort, you can directly edit the X startup scrip >> that is used in your configuration. > > > Alain send me some answers privately. To me it seems that processes created > from the menu icons inherit only a small environment, could be that of a > privileged process. It obviously has some basic components in PATH, but > not Alain's private parts. And GNU Emacs actually is opened via > emacsclient, from a shell script, which is passed to the launcher as " > ~/..." and "~/" does not get expanded to something like "/home/<user>/..." > > With pstree, observing such a launched process, one might find some basic > clues. By using a shell script that creates a login shell to launch > emacsclient from inside it a few problems could be cured… > > -- > Greetings > Note that I'm speaking about accessing X from gdm/xdm/etc rather than starting it with something like startx. On modern Linux boxes, the scripts that start X do so in a non-login shell. This means files like .bash_profile are not sourced. The X session is normally run as the last stage in the startup process - often the last line is something like exec <window manager> which makes the current running process your X window manager process. When you kill that process, you are logged out. The limitation of this approach is that your X window manager process does not have all the environment settings that you would normally see in a standard login shell. When the window manager forks another process to launch something like emacs, it passes on its environment variables, but as its not a login shell and .bash_profile has not been sourced, the envrionment is somewhat limited. There are a number of solutions you can use. 1. In the case of GDM, edit /etc/gdm/Xsession and make it either run as a login shell or have it source your .bash_profile etc. 2. Write a shell wrapper script which sources your environment scripts and use it to launch programs from menus/icons etc. 3. Start an xterm witht he -ls switches so that it starts as a login shell and execute the programs from there. 4. You can set some environment settings in the /etc/environment file, but note that all processes source this file, including processes that are not started by a specific user. I use to change the first line of the Xsession script so that it runs as a login shell and then I have all my environment settings. However, I stopped doing that because everytime GDM was updated, I'd lose my changes if the update included a new Xsession script. Now, I place settings that are common to all users/processes in /etc/environment and I have a basic 'launcher' script that sources my .bash_profile before starting a program like emacs. I use this script in place of the standard things for opening an xterm or starting emacs. HTH Tim -- tcross (at) rapttech dot com dot au ^ permalink raw reply [flat|nested] 10+ messages in thread
* Problems starting emacs with correct environmental settings @ 2009-07-02 19:22 Alain Muls 2009-07-02 23:05 ` Peter Dyballa 2009-07-02 23:11 ` Jeff Clough 0 siblings, 2 replies; 10+ messages in thread From: Alain Muls @ 2009-07-02 19:22 UTC (permalink / raw) To: help-gnu-emacs Hi emacs users, On my ubuntu system I have in the top bar the icon (dragged from the menu entry in Accessories) to launch emacs. By doing so, I have no access to my PATH variable, eg. a compile (make -k) won't run. When I launch emacs from a shell, than there is no problem and make or other scripts are available. What should I do to have the icon launch emacs with my PATH set. Tx/Alain --------------------------------------------------------------------- Alain Muls alain.muls@septentrio.com +32.477.675091 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Problems starting emacs with correct environmental settings 2009-07-02 19:22 Alain Muls @ 2009-07-02 23:05 ` Peter Dyballa 2009-07-02 23:11 ` Jeff Clough 1 sibling, 0 replies; 10+ messages in thread From: Peter Dyballa @ 2009-07-02 23:05 UTC (permalink / raw) To: Alain Muls; +Cc: help-gnu-emacs Am 02.07.2009 um 21:22 schrieb Alain Muls: > On my ubuntu system I have in the top bar the icon (dragged from > the menu entry in Accessories) to launch emacs. By doing so, I have > no access to my PATH variable, eg. a compile (make -k) won't run. What is the mechanism behind it? What is the behaviour when you launch GNU Emacs with '-u <your login name>'? What is the behaviour when you launch GNU Emacs with '-l <some rather empty Emacs Lisp file, for example a message>'? Is it possible to use a shell script as GNU Emacs entry which launches GNU Emacs? -- Greetings Pete The human animal differs from the lesser primates in his passion for lists of "Ten Best." – H. Allen Smith ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Problems starting emacs with correct environmental settings 2009-07-02 19:22 Alain Muls 2009-07-02 23:05 ` Peter Dyballa @ 2009-07-02 23:11 ` Jeff Clough 2009-07-02 23:14 ` Jeff Clough 1 sibling, 1 reply; 10+ messages in thread From: Jeff Clough @ 2009-07-02 23:11 UTC (permalink / raw) To: help-gnu-emacs@gnu.org >> GNU Emacs List Alain Muls wrote: > Hi emacs users, > > On my ubuntu system I have in the top bar the icon (dragged from the > menu entry in Accessories) to launch emacs. By doing so, I have no > access to my PATH variable, eg. a compile (make -k) won't run. > > When I launch emacs from a shell, than there is no problem and make or > other scripts are available. What should I do to have the icon launch > emacs with my PATH set. > Running ubuntu 8.04 I have the following as my launcher in the same place it seems you do: /usr/bin/emacs2-x M-x compile brings up make -k and it works just fine. No problems at all. Anything I feed to this command as a "compiler" (cp, etc.) that's in my path resolves. If your launcher is set up the same way, it smells like something more fundamental is broken. :( Jeff -- Author of the Genesys System A "free" universal role-playing game. http://www.chaosphere.com/genesys/ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Problems starting emacs with correct environmental settings 2009-07-02 23:11 ` Jeff Clough @ 2009-07-02 23:14 ` Jeff Clough 0 siblings, 0 replies; 10+ messages in thread From: Jeff Clough @ 2009-07-02 23:14 UTC (permalink / raw) To: help-gnu-emacs@gnu.org >> GNU Emacs List Jeff Clough wrote: > Alain Muls wrote: >> Hi emacs users, >> >> On my ubuntu system I have in the top bar the icon (dragged from the >> menu entry in Accessories) to launch emacs. By doing so, I have no >> access to my PATH variable, eg. a compile (make -k) won't run. >> >> When I launch emacs from a shell, than there is no problem and make >> or other scripts are available. What should I do to have the icon >> launch emacs with my PATH set. >> > > Running ubuntu 8.04 I have the following as my launcher in the same > place it seems you do: > > /usr/bin/emacs2-x > Err... that's /usr/bin/emacs22-x Dang '2' key sticks. :) Jeff -- Author of the Genesys System A "free" universal role-playing game. http://www.chaosphere.com/genesys/ ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2009-07-04 23:39 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <mailman.1714.1246572018.2239.help-gnu-emacs@gnu.org> 2009-07-02 22:45 ` Problems starting emacs with correct environmental settings Pascal J. Bourguignon 2009-07-04 22:01 ` Johan Bockgård [not found] ` <mailman.1831.1246744930.2239.help-gnu-emacs@gnu.org> 2009-07-04 23:39 ` Pascal J. Bourguignon 2009-07-03 10:08 ` Pascal J. Bourguignon 2009-07-03 11:12 ` Peter Dyballa [not found] ` <mailman.1742.1246619589.2239.help-gnu-emacs@gnu.org> 2009-07-04 0:42 ` Tim X 2009-07-02 19:22 Alain Muls 2009-07-02 23:05 ` Peter Dyballa 2009-07-02 23:11 ` Jeff Clough 2009-07-02 23:14 ` Jeff Clough
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).