radian-software / radian

🍉 Dotfiles that marry elegance and practicality.
MIT License
491 stars 47 forks source link

Don't source ~/.profile #494

Closed hrehfeld closed 1 year ago

hrehfeld commented 2 years ago

~/.profile is sourced once by the login shell, so you can put stuff like autostart there.

My strong impression is that it's a really bad idea to source it twice.

I just had to binary search debug radian.el, because when starting emacs without -Q, weird things were happening (because all my autostarts kept starting again).

hrehfeld commented 2 years ago

Hmmm,

https://www.unix.com/man-page/linux/4/profile (non-existent on my arch for some reason)

The file $HOME/.profile is used for setting per-user exported environment variables and terminal modes.

So, not completely sure what the right approach is.

raxod502 commented 2 years ago

Yeah... I certainly have no objection to making this feature configurable, but there is an important case for it, which is when starting Emacs from a desktop environment rather than from the terminal. In that case, on many Linux distros and on macOS, environment variables and such aren't set and none of the shell profile files are sourced. Sourcing ~/.profile at startup was my way of getting around that issue.

We could potentially try to make Radian detect when shell login has happened in the environment, and thus sourcing ~/.profile would not be needed, and could be skipped automatically. No objections to that, if we can come up with some way that works most of the time.

Alternatively, you could adjust your ~/.profile to set an environment variable, and then skip its functionality if that variable is already set. This would ensure that nothing goes wrong regardless of how many times ~/.profile is sourced.