Re: Why doesn't compile command set path from login shell

Larry Evans <[email protected]> Sun, 28 May 2006 07:23:39 -0500
Newsgroups gmane.emacs.xemacs.general
Message-ID <[email protected]>
Thanks for quick reply, Stephen.

On 05/28/2006 03:51 AM, Stephen J. Turnbull wrote:
>>>>>>"Larry" == Larry Evans <[email protected]> writes:
> 
> 
>     Larry>  From Xemacs, when the `Shell command` from tools menu is
>     Larry> used, the path is not what's produced by my login shell
>     Larry> script, .bash_profile.  OTOH, when the `Shell` command from
>     Larry> the tools menu is invoked, I get an e-shell in which:
[snip]
> something to do with that.  What's an "e-shell"?  Do you mean the
> eshell package which implements a shell in elisp?

Yes. It has the same PATH value as set by my .bash_profile.

> 
> AFAIK XEmacs itself does not set environment variables at all.  If
> you invoke XEmacs from a login shell, it will inherit the PATH from
> its environment, and pass that in the environment of both interactive
> and batch shells under it.  XEmacs should not be creating login shells
> as subprocesses, so the profile will not be sourced.

Well, I did invoke it from some icewm submenu that was reached by
point/click from the main IceWm item of the taskbar at the bottom
of my screen.

> 
> If that's not what you're getting, then your may have something set in
> the BASH_ENV or ENV environment variables, or in your .bashrc, which
> can cause a difference since batch shells read the former while
> interactive shells read the latter.  

In an xterm window, both BASH_ENV and ENV show empty when printed with
echo.

> Or the shell may be being invoked
> as "sh", in which case it ignores all the bash-specific files.  Check
> to see what the value of `shell-file-name' is, and the SHELL
> environment variable when XEmacs is invoked.

   shell-file-name is /bin/bash
   SHELL, from echo in the xterm, is same.

> 
> Finally, the `setenv' command may be used in a package or in your
> startup files to set environment variables like PATH.  I don't know of
> any XEmacs packages that would set PATH, though.
> 

But apparently the eshell command gets the correct value; so, it can
be done.  But it's inconsistent that the eshell and the command shell 
(I'm referring to the command invoked from 'tools.
shell.shell command' as the 'command shell'.) get inconsistent values
and that emacs gets the correct value.  There is the following:

   (custom-set-variables
  '(explicit-shell-file-name "/bin/bash")
  )

in my custom.el; however, that also has the correct value as shown
by printing the value within my xemacs window (actually using the
'options.advanced.variables...' menu items ).

Thanks anyway.

-regards,
Larry