News for hackers. Stuff that matters.
Re:$Home, Not So Sweet $Home by LukeShu on Wednesday August 16, 2023 @06:39PM (#37154831)
I mean, Emacs respects the convention, developed ~40 years after Emacs was first released.
Re:$Home, Not So Sweet $Home by psanford on Wednesday August 16, 2023 @06:46PM (#37154896)
I'm not saying the developers couldn't support it. I'm saying you are not entitled to name call them if they choose to not support it.
Re:$Home, Not So Sweet $Home by lilyball on Wednesday August 16, 2023 @06:47PM (#37154904)
There are countless tools that write to the bash files though, which is not true for most programs. Bash changing its locations would break all of these.

Heck, git adopted ~/.config/git years ago, and yet just last week I ran across a tool that created and wrote to ~/.gitconfig instead of my ~/.config/git/config. If Bash tried to change then we'd be dealing with the fallout probably forever.

Re:$Home, Not So Sweet $Home by devnullbrain on Wednesday August 16, 2023 @06:54PM (#37154954)
>There are countless tools that write to the bash files though

Which is terrible, btw. Configuration using untyped, unchecked files, readable & writeable by almost everything is one of the worst parts of Linux. Especially when it exists in a directory the user should expect to be their exclusive domain.

Re:$Home, Not So Sweet $Home by arp242 on Wednesday August 16, 2023 @07:59PM (#37155477)
Whether it is or isn't terrible is sort of besides the point; the fact is that it exists, and that stuff would break.
Re:$Home, Not So Sweet $Home by LukeShu on Wednesday August 16, 2023 @08:03PM (#37155508)
IMO, it's terrible enough that that stuff breaking would be a good thing.
Re:$Home, Not So Sweet $Home by arp242 on Wednesday August 16, 2023 @08:32PM (#37155694)
It's not that "terrible" in the first place, all things considering, and breaking people's workflow just to satisfy your preferences is just anti-user and a good way to piss off people.
Re:$Home, Not So Sweet $Home by zlg_codes on Thursday August 17, 2023 @04:54AM (#37158961)
If I remember correctly, ncmpcpp did this crap.

$HOME/.ncmpcpp -> $XDG_CONFIG_HOME/ncmpcpp

The correct way to handle this, for any projects forcing the change, is to use a staged deprecation period:

* first, you add support for XDG

* second, wait at least one version to give people time to get used to it

* third, switch the config location search order so it checks XDG before .whatever

* lastly, after an announcement and deprecation period, and at least 2-3 releases, remove support for the .whatever folder.

(To be fair, it's totally possible that my upgrade path with ncmpcpp skipped over some steps and they actually did it correctly. Will have to check when I care enough to dig through commits.)

Re:$Home, Not So Sweet $Home by n0tinventedhere on Thursday August 17, 2023 @02:47AM (#37158083)
I agree with you there. I don't remember which it was, but one of the runtimes managers (was it pyenv, rvm or nvm?) wrote to my .bashrc and .zshrc without asking for permission to do so, instead of just telling me the locations it wants me to include in my $PATH. I don't do path munging in my zshrc, rather, I source a different file that I use to manage this stuff and set up a way to avoid duplicates in $PATH and only adding things to $PATH when they exist so that my shell configuration doesn't do anything dumb when used across multiple computers.

Well, I'd rather their attempt at writing to my shell config breaks.

This is one of the many reasons why you should, if you haven't yet, manage your dotfiles with version control. Many tools assist in giving you some sugar over the process, I use homeshick which will move files away into a git controlled folder and create symlinks.

Re:$Home, Not So Sweet $Home by prmoustache on Thursday August 17, 2023 @03:26AM (#37158348)
If it is that terrible, I guess the good way to do it is not to break stuff to people using bash, but to use another shell, possibly a fork that will be expressly known to not use bash original config files.

That way you can introduce the new guidelines while not breaking stuff to those who want the old bash.

Re:$Home, Not So Sweet $Home by tmtvl on Thursday August 17, 2023 @04:16AM (#37158647)
Wouldn't the tools which write to (and presumably read from) the Bash files break if the user were to do something like use another shell? While Bash has its niceties, I really can't go back to not being able to autocomplete "~/pr/l/Ka/RE" to "~/projects/lisp/Kandria/README.mess" with a single TAB.
Re:$Home, Not So Sweet $Home by yrro on Thursday August 17, 2023 @07:48AM (#37160171)
Any tool which dares to write to my .bashrc (or any other config file that it doesn't own) will not remain on my systems. How dare they!
Re:$Home, Not So Sweet $Home by soraminazuki on Thursday August 17, 2023 @10:45AM (#37162494)
There are multiple reasons why tools shouldn't be doing this.

First, I don't like tools overwriting my configuration. My dotfiles belong to me and I have things configured the way they are for a reason. Tools should inform me if changes are required to my configuration, and not just go and change it by itself.

Second, it prevents users from making their configuration files read only. This affects users of Home Manager by the way, which deploys configuration files as symlinks to read only files under /nix/store.

Even more egregious are files that write mutable state to configuration files, which makes them unsuitable for version control. Unfortunately, Docker is guilty of this and stores mutable state in config.json.

Finally, as mentioned, it interferes with XDG adoption.

Personally, I'm all for breaking tools that write to user configuration files. They cause too many headaches with no clear benefit.

Re:$Home, Not So Sweet $Home by NikkiA on Wednesday August 16, 2023 @07:05PM (#37155051)
Wait, it does? I'm still using .emacs.d like a schlub.
Re:$Home, Not So Sweet $Home by tsimionescu on Wednesday August 16, 2023 @07:07PM (#37155071)
I've never seen .emacs anywhere other than $HOME/.emacs, or seen Emacs write files outside $HOME/.emacs.d. In what situation does Emacs use $HOME/.config/?
Re:$Home, Not So Sweet $Home by LukeShu on Wednesday August 16, 2023 @07:18PM (#37155162)
Since Emacs 27.1, if $XDG_CONFIG_HOME/emacs/ exists and neither ~/.emacs nor ~/.emacs.d/ exist, then it will set user-emacs-directory to $XDG_CONFIG_HOME/emacs/ instead of ~/.emacs.d/.
Re:$Home, Not So Sweet $Home by tsimionescu on Thursday August 17, 2023 @02:24AM (#37157921)
So, if I understand correctly (and this would match my experience), if I compile emacs from sources on a new computer and just run make install, the "legacy" paths will be used instead of the XDG ones, unless I explicitly mkdir $XDG_CONFIG_HOME/emacs.

I would then say emacs supports XDG, but doesn't use it by default, right?

Re:$Home, Not So Sweet $Home by LukeShu on Thursday August 17, 2023 @02:54AM (#37158125)
That's correct.
Re:$Home, Not So Sweet $Home by guilherme-puida on Wednesday August 16, 2023 @07:33PM (#37155284)
When you create $XDG_CONFIG_HOME/emacs/init.el before starting emacs for the first time your `user-emacs-directory' will be set to it. However, the other locations (.emacs, .emacs.d) are always preferred if they exist.

Refer to section 50.4.4 (How Emacs Finds Your Init File) of the manual for more information.

Re:$Home, Not So Sweet $Home by delta_p_delta_x on Wednesday August 16, 2023 @07:18PM (#37155157)
If you already have legacy paths, then Emacs doesn't migrate things for you, as far as I understand.

This is fair behaviour IMO, because migrating configs automatically might break user setups.

Re:$Home, Not So Sweet $Home by psanford on Wednesday August 16, 2023 @10:46PM (#37156554)
Then you have to support both forever. Its not clear why that is better.
Re:$Home, Not So Sweet $Home by tsimionescu on Thursday August 17, 2023 @02:37AM (#37158011)
Based on the other comments, it sounds more like emacs supports XDG if you want it to, but still defaults to ~/.emacs if you don't explicitly set up an XDG environment for it. Distributions may choose to do so, but I don't think compiling from source does.