I have the following command in my .emacs
(setq org-roam-directory
(concat (getenv "BASEDIR") "/data/org-roam/"))
The purpose is to the set the directory for org-roam
(but really it could be any other package) on different systems where the variable $BASEDIR
has different paths. $BASEDIR
is defined in .bashrc
. This works well if I start emacs from the command line, but fails if emacs is started from, e.g., the file manager.
Is there a way to have emacs read the shell environment variables at startup, regardless on how it is launched?
EDIT: I am running Ubuntu and Arch with GNOME. The file manager is graphical (nautilus or double commander) but of course this also happens if emacs is launched from the apps menu.
.bashrc
are inherited only by programs started from Bash. If by ‘file manager’ you mean a graphical file manager, then you need to look at how env vars are defined in your graphical environment (Gnome/KDE/whatever). If it's a terminal manager like Midnight Commander, launched from Bash, then the question is why it removes vars from the environment instead of passing them to the editor—you'll need to consult the manager's docs, or set its options. If everything else fails, perhaps the option is indeed to have a specific config file to be read by Emacs.