pazz / alot

Terminal-based Mail User Agent
GNU General Public License v3.0
681 stars 162 forks source link

Fix default hooks config path to conform to XDG #1644

Closed milhnl closed 5 months ago

milhnl commented 5 months ago

Hey!

A very small patch that makes the default value for the hooks file use $XDG_CONFIG_HOME instead of ~/.config. The previous behaviour was non-conforming.

I did not update the documentation because of two reasons:

pazz commented 5 months ago

I don't think this is correct.. This hardcoded location is used as fallback after we've already tried to read the suggested location. That is, if the env var is set then we've already read it here.

milhnl commented 5 months ago

The code you point to is finding the main configuration file. That's different from the path to the hooks file. You're correct in that it's only the fallback value.

It's easy to reproduce: copy your $XDG_CONFIG_HOME/alot to e.g. /tmp/config/alot, set XDG_CONFIG_HOME to /tmp/config. If you do not have hooksfile set, alot will try to read the hooks from ~/.config/alot/hooks.py instead of /tmp/config/alot/hooks.py. I observed this behaviour, and the patch fixes it.

Hopes this clears it up!

pazz commented 5 months ago

Oh I see. Thanks for the explanation and the fix!