1

If I open emacs from the command line, it loads my .bashrc and correctly sets my paths.

M-: (getenv "PATH")

Returns my actual $PATH variable.

If I open emacs from the command line, pin the icon to favorites, close emacs, then open emacs from the favorites panel, it does not load .bashrc and does not correctly set my paths.

M-: (getenv "PATH")

Produces very different results that look like system defaults. This is emacs 27.1 and Ubuntu 18.04.

Questions:

  1. What is happening?
  2. How can I fix it?
  3. What bashrc is being read if not mine?
6
  • Also noting, this caused me tremendous frustration while thinking I had my $GOPATH variable set incorrectly. It was set correctly, and emacs found it in the shell, but emacs.d/init.el did not find it. Jun 11, 2018 at 21:04
  • What do you mean by "emacs found it in the shell"? My guess is that the emacs started by the .desktop file you pinned to favourites is not started from bash and thus .bashrc is not sourced.
    – danzel
    Jun 11, 2018 at 22:13
  • If I M-x shell, and echo $PATH, it is right. But if I M-x getenv it is not right. Jun 11, 2018 at 22:32
  • My guess remains the same. If you M-x shell, it starts bash, which in turn sources .bashrc (just tested it in Kubuntu 18.04). getenv doesn't start a bash, so .bashrc is not sourced and thus the environment variables exported in .bashrc aren't visible.
    – danzel
    Jun 11, 2018 at 22:51
  • Thanks, @danzel. In previous ubuntus, this is the way I would pin things to the launcher, and they would retain the start environment they had when I launched them, as far as I can tell. Is there a new process for adding things to the launcher without breaking them now? Did I do something wrong? Jun 11, 2018 at 22:54

1 Answer 1

0

I had the same problem with Ubuntu 19.04, and the solution I found is based on this answer:

  1. Move PATH-related stuff from my ~/.bashrc to ~/.profile (which apparently is the proper place for it)

  2. Logout and login again

Then my Emacs (launched from both from the Favorites bar and a bash console) had the proper PATH values.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .